File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -496,19 +496,15 @@ impl AudioUnit {
496
496
let sample_rate: f64 = super :: audio_session_get_property ( id) ?;
497
497
( sample_rate * seconds as f64 ) . round ( ) as u32
498
498
} ;
499
- let mut data: Vec < u8 > = vec ! [ ] ;
500
499
let sample_bytes = stream_format. sample_format . size_in_bytes ( ) ;
501
500
let n_channels = stream_format. channels_per_frame ;
502
501
let data_byte_size = buffer_frame_size * sample_bytes as u32 * n_channels;
503
- data. reserve_exact ( data_byte_size as usize ) ;
502
+ let mut data = vec ! [ 0u8 ; data_byte_size as usize ] ;
504
503
let audio_buffer = sys:: AudioBuffer {
505
504
mDataByteSize : data_byte_size,
506
505
mNumberChannels : n_channels,
507
506
mData : data. as_mut_ptr ( ) as * mut _ ,
508
507
} ;
509
- unsafe {
510
- data. set_len ( data_byte_size as usize ) ;
511
- }
512
508
// Relieve ownership of the `Vec` until we're ready to drop the `AudioBufferList`.
513
509
mem:: forget ( data) ;
514
510
let audio_buffer_list = Box :: new ( sys:: AudioBufferList {
You can’t perform that action at this time.
0 commit comments