File tree Expand file tree Collapse file tree
playback/src/audio_backend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ use alsa::device_name::HintIter;
77use alsa:: pcm:: { Access , Format , HwParams , PCM } ;
88use alsa:: { Direction , ValueOr } ;
99use std:: cmp:: min;
10- use std:: cmp:: Ordering ;
1110use std:: process:: exit;
1211use std:: time:: Duration ;
1312use thiserror:: Error ;
@@ -226,16 +225,8 @@ impl Sink for AlsaSink {
226225 let ( pcm, bytes_per_period) = open_device ( & self . device , self . format ) ?;
227226 self . pcm = Some ( pcm) ;
228227
229- match self . period_buffer . capacity ( ) . cmp ( & bytes_per_period) {
230- Ordering :: Greater => {
231- self . period_buffer . truncate ( bytes_per_period) ;
232- self . period_buffer . shrink_to_fit ( ) ;
233- }
234- Ordering :: Less => {
235- let extra = bytes_per_period - self . period_buffer . len ( ) ;
236- self . period_buffer . reserve_exact ( extra) ;
237- }
238- Ordering :: Equal => ( ) ,
228+ if self . period_buffer . capacity ( ) != bytes_per_period {
229+ self . period_buffer = Vec :: with_capacity ( bytes_per_period) ;
239230 }
240231
241232 // Should always match the "Period Buffer size in bytes: " trace! message.
You can’t perform that action at this time.
0 commit comments