demux_mkv: work around bad OutputSamplingFrequency values

Something produces corrupt Matroska files with audio tracks that have
SamplingFrequency set to 44100 and OutputSamplingFrequency to 96000,
when the correct playback rate is 44100. Add a special case for this
44100/96000 combination and override it to 44100/44100; it's unlikely
that anyone would ever want to use this 44100/96000 combination for
real in valid files.
This commit is contained in:
Uoti Urpala 2012-12-16 11:02:42 +02:00 committed by wm4
parent c1232c9a01
commit e0d9ec60ad
1 changed files with 8 additions and 0 deletions

View File

@ -503,6 +503,14 @@ static void parse_trackaudio(struct demuxer *demuxer, struct mkv_track *track,
"[mkv] | + Output sampling frequency: %f\n", track->a_osfreq);
} else
track->a_osfreq = track->a_sfreq;
// Something creates files with osfreq incorrectly set
if (track->a_sfreq == 44100 && track->a_osfreq == 96000) {
mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Audio track has codec frequency "
"%.1f and playback frequency %.1f.\n[mkv] This looks wrong. "
"Assuming this file is corrupt and ignoring the latter.\n",
track->a_sfreq, track->a_osfreq);
track->a_osfreq = track->a_sfreq;
}
if (audio->n_bit_depth) {
track->a_bps = audio->bit_depth;
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Bit depth: %u\n",