From: Edward Hervey Date: Thu, 12 Apr 2012 13:49:44 +0000 (+0200) Subject: matroska: Check return value of GstByteReader/Writer X-Git-Tag: 1.19.3~509^2~7125 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4aef223db00a29da98218002cdfdee12857156bc;p=platform%2Fupstream%2Fgstreamer.git matroska: Check return value of GstByteReader/Writer --- diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index 2fd5a4cdc0..42a06fe82c 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -223,11 +223,12 @@ gst_ebml_peek_id_full (GstEbmlRead * ebml, guint32 * id, guint64 * length, GstByteReader *br = gst_ebml_read_br (ebml); guint size = gst_byte_reader_get_remaining (br); - gst_byte_reader_peek_data (br, size, &data); + if (gst_byte_reader_peek_data (br, size, &data)) { - GST_LOG_OBJECT (ebml->el, "current br %p; remaining %d", br, size); - if (data) - GST_MEMDUMP_OBJECT (ebml->el, "element", data, MIN (size, *length)); + GST_LOG_OBJECT (ebml->el, "current br %p; remaining %d", br, size); + if (data) + GST_MEMDUMP_OBJECT (ebml->el, "element", data, MIN (size, *length)); + } } #endif diff --git a/gst/matroska/ebml-write.c b/gst/matroska/ebml-write.c index 456cfa9433..0c7584e12f 100644 --- a/gst/matroska/ebml-write.c +++ b/gst/matroska/ebml-write.c @@ -427,14 +427,16 @@ gst_ebml_write_element_push (GstEbmlWrite * ebml, GstBuffer * buf, gst_buffer_map (buf, &map, GST_MAP_READ); buf_data = map.data; } - gst_byte_writer_put_data (ebml->streamheader, buf_data, data_size); + if (!gst_byte_writer_put_data (ebml->streamheader, buf_data, data_size)) + GST_WARNING ("Error writing data to streamheader"); } if (ebml->cache) { if (!buf_data) { gst_buffer_map (buf, &map, GST_MAP_READ); buf_data = map.data; } - gst_byte_writer_put_data (ebml->cache, buf_data, data_size); + if (!gst_byte_writer_put_data (ebml->cache, buf_data, data_size)) + GST_WARNING ("Error writing data to cache"); if (map.data) gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index bfe64e1ce0..f5b31164ff 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -1669,7 +1669,10 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos) if (cluster_pos >= 0) { newpos += cluster_pos; /* prepare resuming at next byte */ - gst_byte_reader_skip (&reader, cluster_pos + 1); + if (!gst_byte_reader_skip (&reader, cluster_pos + 1)) { + GST_DEBUG_OBJECT (demux, "Need more data -> continue"); + continue; + } GST_DEBUG_OBJECT (demux, "found cluster ebml id at offset %" G_GINT64_FORMAT, newpos); /* extra checks whether we really sync'ed to a cluster: