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 {
496496 let sample_rate: f64 = super :: audio_session_get_property ( id) ?;
497497 ( sample_rate * seconds as f64 ) . round ( ) as u32
498498 } ;
499- let mut data: Vec < u8 > = vec ! [ ] ;
500499 let sample_bytes = stream_format. sample_format . size_in_bytes ( ) ;
501500 let n_channels = stream_format. channels_per_frame ;
502501 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 ] ;
504503 let audio_buffer = sys:: AudioBuffer {
505504 mDataByteSize : data_byte_size,
506505 mNumberChannels : n_channels,
507506 mData : data. as_mut_ptr ( ) as * mut _ ,
508507 } ;
509- unsafe {
510- data. set_len ( data_byte_size as usize ) ;
511- }
512508 // Relieve ownership of the `Vec` until we're ready to drop the `AudioBufferList`.
513509 mem:: forget ( data) ;
514510 let audio_buffer_list = Box :: new ( sys:: AudioBufferList {
You can’t perform that action at this time.
0 commit comments