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 @@ -484,19 +484,15 @@ impl AudioUnit {
484
484
// First, get the current buffer size for pre-allocating the `AudioBuffer`s.
485
485
let id = sys:: kAudioDevicePropertyBufferFrameSize;
486
486
let mut buffer_frame_size: u32 = self . get_property ( id, Scope :: Global , Element :: Output ) ?;
487
- let mut data: Vec < u8 > = vec ! [ ] ;
488
487
let sample_bytes = stream_format. sample_format . size_in_bytes ( ) ;
489
488
let n_channels = stream_format. channels_per_frame ;
490
489
let data_byte_size = buffer_frame_size * sample_bytes as u32 * n_channels;
491
- data. reserve_exact ( data_byte_size as usize ) ;
490
+ let data = vec ! [ 0u8 ; data_byte_size as usize ] ;
492
491
let audio_buffer = sys:: AudioBuffer {
493
492
mDataByteSize : data_byte_size,
494
493
mNumberChannels : n_channels,
495
494
mData : data. as_mut_ptr ( ) as * mut _ ,
496
495
} ;
497
- unsafe {
498
- data. set_len ( data_byte_size as usize ) ;
499
- }
500
496
// Relieve ownership of the `Vec` until we're ready to drop the `AudioBufferList`.
501
497
mem:: forget ( data) ;
502
498
let audio_buffer_list = Box :: new ( sys:: AudioBufferList {
You can’t perform that action at this time.
0 commit comments