summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun@centricular.com>2015-09-30 12:06:47 (GMT)
committerArun Raghavan <arun@centricular.com>2015-10-28 05:55:51 (GMT)
commit8262188d7e364cf0d80c9cb42bf29445d656106e (patch)
tree7ef7c052a2907c39c71bee5f5a2df406e453b6d5
parent72223b60e1c2818ada5765c5322cd6fd562ef45e (diff)
downloadopenwebrtc-gst-plugins-8262188d7e364cf0d80c9cb42bf29445d656106e.tar.gz
openwebrtc-gst-plugins-8262188d7e364cf0d80c9cb42bf29445d656106e.tar.xz
scream: Don't assume we'll have queued packets to approve
gst_data_queue_pop() is synchronous, and if the currently prioritised stream has no queued packets, we would block when we should not. This is easy to trigger when running two streams, one with adaptation enabled and one without. This makes the adapted stream eventually freeze.
-rw-r--r--gst/scream/gstscreamqueue.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gst/scream/gstscreamqueue.c b/gst/scream/gstscreamqueue.c
index 70b969d..f15b8fc 100644
--- a/gst/scream/gstscreamqueue.c
+++ b/gst/scream/gstscreamqueue.c
@@ -670,13 +670,15 @@ static void approve_transmit_cb(guint stream_id, GstScreamQueue *self) {
stream = g_hash_table_lookup(self->streams, GUINT_TO_POINTER(stream_id));
g_rw_lock_reader_unlock(&self->lock);
- if (gst_data_queue_pop(stream->packet_queue, (GstDataQueueItem **)&item)) {
+ if (!gst_data_queue_is_empty(stream->packet_queue) &&
+ gst_data_queue_pop(stream->packet_queue, (GstDataQueueItem **)&item)) {
stream->enqueued_payload_size -= item->rtp_payload_size;
stream->enqueued_packets--;
GST_LOG_OBJECT(self, "approving: pt = %u, seq: %u, pass: %u",
item->rtp_pt, item->rtp_seq, self->pass_through);
gst_data_queue_push(self->approved_packets, (GstDataQueueItem *)item);
- }
+ } else
+ GST_LOG_OBJECT(self, "Got approve callback on an empty queue, or flushing");
}
static void clear_queue(guint stream_id, GstScreamQueue *self)