aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-05 18:37:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-05 18:37:32 +0200
commit27856b2fe9cdbcf48ad996647cb104667b373fa4 (patch)
tree82a845bbd8edfef5c0d726c6801b6565d78e7ff2 /ffmpeg.c
parent40e938a7edf44d395a216f2b0ad813e305e95466 (diff)
downloadffmpeg-27856b2fe9cdbcf48ad996647cb104667b373fa4.tar.gz
ffmpeg: prevent pts < dts to be passed through to the muxer on stream copy
Fixes Ticket3658 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 7978cf4e1a..d5e9afa8b7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -636,7 +636,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
bsfc = bsfc->next;
}
- if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS) &&
+ if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
+ if(
(avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) &&
pkt->dts != AV_NOPTS_VALUE &&
ost->last_mux_dts != AV_NOPTS_VALUE) {
@@ -657,6 +658,16 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
pkt->pts = FFMAX(pkt->pts, max);
pkt->dts = max;
}
+ }
+ if (pkt->dts != AV_NOPTS_VALUE &&
+ pkt->pts != AV_NOPTS_VALUE &&
+ pkt->dts > pkt->pts) {
+ av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d\n",
+ pkt->dts, pkt->pts,
+ ost->file_index, ost->st->index);
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ }
}
ost->last_mux_dts = pkt->dts;