Fixes Ticket3658
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 27856b2fe9cdbcf48ad996647cb104667b373fa4)
... | ... |
@@ -621,7 +621,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) |
621 | 621 |
bsfc = bsfc->next; |
622 | 622 |
} |
623 | 623 |
|
624 |
- if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS) && |
|
624 |
+ if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { |
|
625 |
+ if( |
|
625 | 626 |
(avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) && |
626 | 627 |
pkt->dts != AV_NOPTS_VALUE && |
627 | 628 |
ost->last_mux_dts != AV_NOPTS_VALUE) { |
... | ... |
@@ -642,6 +643,16 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) |
642 | 642 |
pkt->pts = FFMAX(pkt->pts, max); |
643 | 643 |
pkt->dts = max; |
644 | 644 |
} |
645 |
+ } |
|
646 |
+ if (pkt->dts != AV_NOPTS_VALUE && |
|
647 |
+ pkt->pts != AV_NOPTS_VALUE && |
|
648 |
+ pkt->dts > pkt->pts) { |
|
649 |
+ av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d\n", |
|
650 |
+ pkt->dts, pkt->pts, |
|
651 |
+ ost->file_index, ost->st->index); |
|
652 |
+ pkt->pts = AV_NOPTS_VALUE; |
|
653 |
+ pkt->dts = AV_NOPTS_VALUE; |
|
654 |
+ } |
|
645 | 655 |
} |
646 | 656 |
ost->last_mux_dts = pkt->dts; |
647 | 657 |
|