From 1125e840481ccc8c13e8724d4c2b78e204bc8ef5 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sun, 11 Sep 2016 08:30:38 +0200 Subject: [PATCH] Return a more common sample rate is nothing is set in the matroska file. --- MP42/MP42MkvImporter.m | 4 ++++ MP42/muxer/MatroskaParser.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MP42/MP42MkvImporter.m b/MP42/MP42MkvImporter.m index ce2466a..f8f8c54 100644 --- a/MP42/MP42MkvImporter.m +++ b/MP42/MP42MkvImporter.m @@ -499,6 +499,10 @@ static NSString * TrackNameToString(TrackInfo *track) if (sampleRate < 24000) return 48000; } + // Sample rate is not set, so just guess one. + if (sampleRate == 0) { + return 48000; + } return mkv_TruncFloat(trackInfo->AV.Audio.SamplingFreq); } diff --git a/MP42/muxer/MatroskaParser.c b/MP42/muxer/MatroskaParser.c index 561921a..1a54a63 100644 --- a/MP42/muxer/MatroskaParser.c +++ b/MP42/muxer/MatroskaParser.c @@ -1265,8 +1265,6 @@ static void parseAudioInfo(MatroskaFile *mf,ulonglong toplen,struct TrackInfo *t if (ti->AV.Audio.Channels == 0) ti->AV.Audio.Channels = 1; - if (mkv_TruncFloat(ti->AV.Audio.SamplingFreq) == 0) - ti->AV.Audio.SamplingFreq = mkfi(8000); if (mkv_TruncFloat(ti->AV.Audio.OutputSamplingFreq)==0) ti->AV.Audio.OutputSamplingFreq = ti->AV.Audio.SamplingFreq; }