summaryrefslogtreecommitdiff
path: root/libavformat/smoothstreamingenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-25 13:15:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-25 13:15:58 +0200
commitaa604e8e33ae06f3a106e44fff798fdd70d77230 (patch)
treede1f5670244e74d90e97b8dc69f054768c363959 /libavformat/smoothstreamingenc.c
parentd312ffdd79bd22b5a051790c993eda6b1366cdfc (diff)
parent2a91ada8282f18d2807abee5188225bba1b19bda (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avutil: Make LZO decoder code configure-time selectable avutil: Move memcpy_backptr() to mem.c configure: detect parisc64 automatically configure: detect ppc64 automatically configure: detect mips64 automatically configure: generalise 64-bit test smoothstreamingenc: Don't assume streams start from timestamp 0 Conflicts: configure libavutil/Makefile libavutil/lzo.c libavutil/lzo.h libavutil/mem.c libavutil/mem.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/smoothstreamingenc.c')
-rw-r--r--libavformat/smoothstreamingenc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index df7522ee1d..1104d5853f 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -559,12 +559,15 @@ static int ism_write_packet(AVFormatContext *s, AVPacket *pkt)
SmoothStreamingContext *c = s->priv_data;
AVStream *st = s->streams[pkt->stream_index];
OutputStream *os = &c->streams[pkt->stream_index];
- int64_t end_pts = (c->nb_fragments + 1) * c->min_frag_duration;
+ int64_t end_dts = (c->nb_fragments + 1) * c->min_frag_duration;
int ret;
+ if (st->first_dts == AV_NOPTS_VALUE)
+ st->first_dts = pkt->dts;
+
if ((!c->has_video || st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
- av_compare_ts(pkt->pts, st->time_base,
- end_pts, AV_TIME_BASE_Q) >= 0 &&
+ av_compare_ts(pkt->dts - st->first_dts, st->time_base,
+ end_dts, AV_TIME_BASE_Q) >= 0 &&
pkt->flags & AV_PKT_FLAG_KEY && os->packets_written) {
if ((ret = ism_flush(s, 0)) < 0)