mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-07 07:55:41 +00:00
1 cope with running out of data 2 add a few assertions
Original commit message from CVS: 1 cope with running out of data 2 add a few assertions
This commit is contained in:
parent
7f5ec15359
commit
b51de8d6ee
1 changed files with 16 additions and 4 deletions
|
@ -112,6 +112,10 @@ gst_bytestream_get_next_buf (GstByteStream * bs)
|
||||||
|
|
||||||
bs_print ("get_next_buf: pulling buffer\n");
|
bs_print ("get_next_buf: pulling buffer\n");
|
||||||
nextbuf = gst_pad_pull (bs->pad);
|
nextbuf = gst_pad_pull (bs->pad);
|
||||||
|
|
||||||
|
if (!nextbuf)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
bs_print ("get_next_buf: got buffer of %d bytes\n", GST_BUFFER_SIZE (nextbuf));
|
bs_print ("get_next_buf: got buffer of %d bytes\n", GST_BUFFER_SIZE (nextbuf));
|
||||||
|
|
||||||
// first see if there are any buffers in the list at all
|
// first see if there are any buffers in the list at all
|
||||||
|
@ -169,7 +173,8 @@ gst_bytestream_fill_bytes (GstByteStream * bs, guint32 len)
|
||||||
// as long as we don't have enough, we get more buffers
|
// as long as we don't have enough, we get more buffers
|
||||||
while (bs->listavail < len) {
|
while (bs->listavail < len) {
|
||||||
bs_print ("fill_bytes: there are %d bytes in the list, we need %d\n", bs->listavail, len);
|
bs_print ("fill_bytes: there are %d bytes in the list, we need %d\n", bs->listavail, len);
|
||||||
gst_bytestream_get_next_buf (bs);
|
if (!gst_bytestream_get_next_buf (bs))
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -189,7 +194,8 @@ gst_bytestream_peek_loc (GST_WHERE_ARGS_ GstByteStream * bs, guint32 len)
|
||||||
// make sure we have enough
|
// make sure we have enough
|
||||||
bs_print ("peek: there are %d bytes in the list\n", bs->listavail);
|
bs_print ("peek: there are %d bytes in the list\n", bs->listavail);
|
||||||
if (len > bs->listavail) {
|
if (len > bs->listavail) {
|
||||||
gst_bytestream_fill_bytes (bs, len);
|
if (!gst_bytestream_fill_bytes (bs, len))
|
||||||
|
return NULL;
|
||||||
bs_print ("peek: there are now %d bytes in the list\n", bs->listavail);
|
bs_print ("peek: there are now %d bytes in the list\n", bs->listavail);
|
||||||
}
|
}
|
||||||
gst_bytestream_print_status (bs);
|
gst_bytestream_print_status (bs);
|
||||||
|
@ -233,7 +239,8 @@ gst_bytestream_peek_bytes (GstByteStream * bs, guint32 len)
|
||||||
// make sure we have enough
|
// make sure we have enough
|
||||||
bs_print ("peek_bytes: there are %d bytes in the list\n", bs->listavail);
|
bs_print ("peek_bytes: there are %d bytes in the list\n", bs->listavail);
|
||||||
if (len > bs->listavail) {
|
if (len > bs->listavail) {
|
||||||
gst_bytestream_fill_bytes (bs, len);
|
if (!gst_bytestream_fill_bytes (bs, len))
|
||||||
|
return NULL;
|
||||||
bs_print ("peek_bytes: there are now %d bytes in the list\n", bs->listavail);
|
bs_print ("peek_bytes: there are now %d bytes in the list\n", bs->listavail);
|
||||||
}
|
}
|
||||||
gst_bytestream_print_status (bs);
|
gst_bytestream_print_status (bs);
|
||||||
|
@ -267,6 +274,8 @@ gst_bytestream_assemble (GstByteStream * bs, guint32 len)
|
||||||
guint32 copied = 0;
|
guint32 copied = 0;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
g_assert (len <= bs->listavail);
|
||||||
|
|
||||||
// copy the data from the curbuf
|
// copy the data from the curbuf
|
||||||
buf = GST_BUFFER (bs->buflist->data);
|
buf = GST_BUFFER (bs->buflist->data);
|
||||||
bs_print ("assemble: copying %d bytes from curbuf at %d to *data\n", bs->headbufavail,
|
bs_print ("assemble: copying %d bytes from curbuf at %d to *data\n", bs->headbufavail,
|
||||||
|
@ -277,6 +286,8 @@ gst_bytestream_assemble (GstByteStream * bs, guint32 len)
|
||||||
// asumption is made that the buffers all exist in the list
|
// asumption is made that the buffers all exist in the list
|
||||||
walk = g_slist_next (bs->buflist);
|
walk = g_slist_next (bs->buflist);
|
||||||
while (copied < len) {
|
while (copied < len) {
|
||||||
|
g_assert (walk);
|
||||||
|
|
||||||
buf = GST_BUFFER (walk->data);
|
buf = GST_BUFFER (walk->data);
|
||||||
if (GST_BUFFER_SIZE (buf) < (len - copied)) {
|
if (GST_BUFFER_SIZE (buf) < (len - copied)) {
|
||||||
bs_print ("assemble: copying %d bytes from buf to output offset %d\n", GST_BUFFER_SIZE (buf), copied);
|
bs_print ("assemble: copying %d bytes from buf to output offset %d\n", GST_BUFFER_SIZE (buf), copied);
|
||||||
|
@ -304,7 +315,8 @@ gst_bytestream_flush (GstByteStream * bs, guint32 len)
|
||||||
// make sure we have enough
|
// make sure we have enough
|
||||||
bs_print ("flush: there are %d bytes in the list\n", bs->listavail);
|
bs_print ("flush: there are %d bytes in the list\n", bs->listavail);
|
||||||
if (len > bs->listavail) {
|
if (len > bs->listavail) {
|
||||||
gst_bytestream_fill_bytes (bs, len);
|
if (!gst_bytestream_fill_bytes (bs, len))
|
||||||
|
return FALSE;
|
||||||
bs_print ("flush: there are now %d bytes in the list\n", bs->listavail);
|
bs_print ("flush: there are now %d bytes in the list\n", bs->listavail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue