Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-15 19:13:45 +0400
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-07-16 13:47:52 +0400
commit06190d75d09a2c2ac7d080c0633eef3fd2d51dca (patch)
treec360b3d185489a971b349446d79f1b1f6f47d472 /libavformat
parentc9ea1f7fc5e92bacf0418ec3be78237827cb9fd1 (diff)
avformat/matroskadec: Detect conflicting sample rate/default_duration
Fixes Ticket2508 Thanks-to: Moritz Bunkus Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 6158a3bcdf52fafc1d9ae9eb358a56c614b23aa3)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskadec.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index f8cd81f2ba..af407d7c56 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2205,6 +2205,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
+ int trust_default_duration = 1;
if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
@@ -2259,7 +2260,15 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (res)
goto end;
- if (!block_duration)
+ if (track->audio.samplerate == 8000) {
+ // If this is needed for more codecs, then add them here
+ if (st->codec->codec_id == AV_CODEC_ID_AC3) {
+ if(track->audio.samplerate != st->codec->sample_rate || !st->codec->frame_size)
+ trust_default_duration = 0;
+ }
+ }
+
+ if (!block_duration && trust_default_duration)
block_duration = track->default_duration * laces / matroska->time_scale;
if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))