@@ -901,7 +901,7 @@ impl PlayerTrackLoader {
901901 }
902902 }
903903
904- fn stream_data_rate ( & self , format : AudioFileFormat ) -> usize {
904+ fn stream_data_rate ( & self , format : AudioFileFormat ) -> Option < usize > {
905905 let kbps = match format {
906906 AudioFileFormat :: OGG_VORBIS_96 => 12 ,
907907 AudioFileFormat :: OGG_VORBIS_160 => 20 ,
@@ -913,9 +913,17 @@ impl PlayerTrackLoader {
913913 AudioFileFormat :: MP3_160_ENC => 20 ,
914914 AudioFileFormat :: AAC_24 => 3 ,
915915 AudioFileFormat :: AAC_48 => 6 ,
916+ AudioFileFormat :: AAC_160 => 20 ,
917+ AudioFileFormat :: AAC_320 => 40 ,
918+ AudioFileFormat :: MP4_128 => 16 ,
919+ AudioFileFormat :: OTHER5 => 40 ,
916920 AudioFileFormat :: FLAC_FLAC => 112 , // assume 900 kbit/s on average
921+ AudioFileFormat :: UNKNOWN_FORMAT => {
922+ error ! ( "Unknown stream data rate" ) ;
923+ return None ;
924+ }
917925 } ;
918- kbps * 1024
926+ Some ( kbps * 1024 )
919927 }
920928
921929 async fn load_track (
@@ -993,7 +1001,7 @@ impl PlayerTrackLoader {
9931001 }
9941002 } ;
9951003
996- let bytes_per_second = self . stream_data_rate ( format) ;
1004+ let bytes_per_second = self . stream_data_rate ( format) ? ;
9971005
9981006 // This is only a loop to be able to reload the file if an error occurred
9991007 // while opening a cached file.
0 commit comments