gst/mpegstream/: Also flush packetizer cache when we get a buffer that has the

Original commit message from CVS:
* gst/mpegstream/gstmpegpacketize.c:
(gst_mpeg_packetize_flush_cache), (gst_mpeg_packetize_put):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_chain):
Also flush packetizer cache when we get a buffer that has the
DISCONT flag set; update current byte position from buffer
offset after a flush.
This commit is contained in:
Tim-Philipp Müller 2006-06-23 12:24:56 +00:00
parent 8daf179ca4
commit 50962bbcb6
3 changed files with 23 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2006-06-23 Tim-Philipp Müller <tim at centricular dot net>
* gst/mpegstream/gstmpegpacketize.c:
(gst_mpeg_packetize_flush_cache), (gst_mpeg_packetize_put):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_chain):
Also flush packetizer cache when we get a buffer that has the
DISCONT flag set; update current byte position from buffer
offset after a flush.
2006-06-23 Tim-Philipp Müller <tim at centricular dot net>
* gst/mpegstream/gstmpegpacketize.c: (gst_mpeg_packetize_new),

View file

@ -57,6 +57,8 @@ gst_mpeg_packetize_flush_cache (GstMPEGPacketize * packetize)
{
g_return_if_fail (packetize != NULL);
packetize->cache_byte_pos += packetize->cache_tail;
packetize->resync = TRUE;
packetize->cache_head = 0;
packetize->cache_tail = 0;
@ -84,6 +86,13 @@ gst_mpeg_packetize_put (GstMPEGPacketize * packetize, GstBuffer * buf)
{
int cache_len = packetize->cache_tail - packetize->cache_head;
if (packetize->cache_head == 0 && cache_len == 0 &&
GST_BUFFER_OFFSET_IS_VALID (buf)) {
packetize->cache_byte_pos = GST_BUFFER_OFFSET (buf);
GST_DEBUG ("cache byte position now %" G_GINT64_FORMAT,
packetize->cache_byte_pos);
}
if (cache_len + GST_BUFFER_SIZE (buf) > packetize->cache_size) {
/* the buffer does not fit into the cache so grow the cache */

View file

@ -691,6 +691,11 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
GstClockTime time;
guint64 size;
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
GST_DEBUG_OBJECT (mpeg_parse, "buffer with DISCONT flag set");
gst_mpeg_packetize_flush_cache (mpeg_parse->packetize);
}
gst_mpeg_packetize_put (mpeg_parse->packetize, buffer);
buffer = NULL;