File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -517,7 +517,18 @@ where
517
517
if duration > 0 {
518
518
// TODO: We should keep track of the `mdat` length when first reading the file.
519
519
// This extra read is unnecessary.
520
- let mdat_len = mdat_length ( reader) ?;
520
+ let mdat_len;
521
+ match mdat_length ( reader) {
522
+ Ok ( len) => mdat_len = len,
523
+ Err ( err) => {
524
+ if parse_mode == ParsingMode :: Strict {
525
+ return Err ( err) ;
526
+ }
527
+
528
+ log:: warn!( "No \" mdat\" atom found, any audio properties will be useless." ) ;
529
+ return Ok ( properties) ;
530
+ } ,
531
+ }
521
532
522
533
if let Some ( stts) = stts {
523
534
let stts_specifies_duration =
@@ -547,8 +558,7 @@ where
547
558
if properties. audio_bitrate == 0 {
548
559
log:: warn!( "Estimating audio bitrate from 'mdat' size" ) ;
549
560
550
- properties. audio_bitrate =
551
- ( u128:: from ( mdat_length ( reader) ? * 8 ) / duration_millis) as u32 ;
561
+ properties. audio_bitrate = ( u128:: from ( mdat_len * 8 ) / duration_millis) as u32 ;
552
562
}
553
563
}
554
564
You can’t perform that action at this time.
0 commit comments