summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-06-06 13:59:44 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-10-27 20:30:30 +0300
commitc1b0498c1fd347ffcf47c8962d39c1d0ce4640a7 (patch)
tree93c992daa62cc30a651531273c4f2910190f5a98
parentf604df4f766604e9ebfcbb9b972ac1487c1347ce (diff)
downloadmpv-c1b0498c1fd347ffcf47c8962d39c1d0ce4640a7.tar.bz2
mpv-c1b0498c1fd347ffcf47c8962d39c1d0ce4640a7.tar.xz
demuxer.c: Make ds_get_next_pts work for the first packet of a stream
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31338 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/demuxer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 71e75e2efb..767542b250 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -801,7 +801,9 @@ int ds_get_packet_sub(demux_stream_t *ds, unsigned char **start)
double ds_get_next_pts(demux_stream_t *ds)
{
demuxer_t *demux = ds->demuxer;
- while (!ds->first) {
+ // if we have not read from the "current" packet, consider it
+ // as the next, otherwise we never get the pts for the first packet.
+ while (!ds->first && (!ds->current || ds->buffer_pos)) {
if (demux->audio->packs >= MAX_PACKS
|| demux->audio->bytes >= MAX_PACK_BYTES) {
mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "\nToo many audio packets in the buffer: (%d in %d bytes).\n",
@@ -819,6 +821,9 @@ double ds_get_next_pts(demux_stream_t *ds)
if (!demux_fill_buffer(demux, ds))
return MP_NOPTS_VALUE;
}
+ // take pts from "current" if we never read from it.
+ if (ds->current && !ds->buffer_pos)
+ return ds->current->pts;
return ds->first->pts;
}