@@ -446,6 +446,11 @@ typedef struct AVPacketList {
* be discarded by the decoder. I.e. Non-reference frames.
*/
#define AV_PKT_FLAG_DISPOSABLE 0x0010
+/**
+ * Flag is used to indicate packets in which the duration is absolute
+ * and should not be changed.
+ */
+#define AV_PKT_FLAG_FIXED_DURATION 0x0020
enum AVSideDataParamChangeFlags {
#if FF_API_OLD_CHANNEL_LAYOUT
@@ -914,7 +914,8 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st,
pktl->pkt.dts = cur_dts;
if (!sti->avctx->has_b_frames)
pktl->pkt.pts = cur_dts;
- pktl->pkt.duration = duration;
+ if ((pktl->pkt.flags & AV_PKT_FLAG_FIXED_DURATION) != AV_PKT_FLAG_FIXED_DURATION)
+ pktl->pkt.duration = duration;
} else
break;
cur_dts = pktl->pkt.dts + pktl->pkt.duration;
@@ -3673,6 +3673,10 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
pkt->pos = pos;
pkt->duration = lace_duration;
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE &&
+ st->codecpar->codec_id != AV_CODEC_ID_HDMV_PGS_SUBTITLE)
+ pkt->flags |= AV_PKT_FLAG_FIXED_DURATION;
+
res = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0);
if (res < 0) {
av_packet_unref(pkt);