diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2010-01-20 23:42:48 +0100 |
---|---|---|
committer | Reinhard Nißl <rnissl@gmx.de> | 2010-01-20 23:42:48 +0100 |
commit | 64a1c261e9dbbe32372cd2d8970186e4b62a5d80 (patch) | |
tree | 0ca35bf4a5e814ee1583a5645e664632eeb781ad | |
parent | 2fb4e0a646eb374031106e099cfce9ffd73f1b19 (diff) | |
download | xine-lib-64a1c261e9dbbe32372cd2d8970186e4b62a5d80.tar.gz xine-lib-64a1c261e9dbbe32372cd2d8970186e4b62a5d80.tar.bz2 |
demux_ts: pass each pts just once to buf (and to decoder)
The content of large PES packets must be split into several input buffers.
The current code attaches the PTS of the PES packet to all input buffers.
A decoder must attach PTS to the image for example which starts next in
the data. If the same PTS appears on several input buffers, a decoder
might buffer the PTS and attach it to the next image for which the
broadcaster didn't supply a PTS. Finally xine's metronom gets confused
about those incorrect PTS and tries to correct that issue which usually
makes things even more worse. By passing on PTS just once to the decoder
it is less likely that the decoder behaves incorrect.
I must admit that this is the second approach to fix this issue. The
first approach slipped through into a totally different changeset and
instead of passing the PTS just on the first buf, it passed it on the
last buf of a PES packet which was totally wrong. This incorrect approach
has been reverted recently.
-rw-r--r-- | src/demuxers/demux_ts.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1a19340f3..1a016fea9 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -987,6 +987,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->decoder_flags |= BUF_FLAG_FRAME_END; } m->buf->pts = m->pts; + m->pts = 0; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) @@ -995,12 +996,12 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); +#ifdef TS_LOG + printf ("demux_ts: produced buffer, pts=%lld\n", m->buf->pts); +#endif m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = NULL; /* forget about buf -- not our responsibility anymore */ -#ifdef TS_LOG - printf ("demux_ts: produced buffer, pts=%lld\n", m->pts); -#endif } /* allocate the buffer here, as pes_header needs a valid buf for dvbsubs */ m->buf = m->fifo->buffer_pool_alloc(m->fifo); @@ -1033,6 +1034,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->size = m->buffered_bytes; m->buf->type = m->type; m->buf->pts = m->pts; + m->pts = 0; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * @@ -1040,15 +1042,12 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); - +#ifdef TS_LOG + printf ("demux_ts: produced buffer, pts=%lld\n", m->buf->pts); +#endif m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = m->fifo->buffer_pool_alloc(m->fifo); - -#ifdef TS_LOG - printf ("demux_ts: produced buffer, pts=%lld\n", m->pts); -#endif - } memcpy(m->buf->mem + m->buffered_bytes, ts, len); m->buffered_bytes += len; |