summaryrefslogtreecommitdiffstats
path: root/gst/mpegtsmux
diff options
context:
space:
mode:
authorvanista <vanista@gmail.com>2008-10-27 08:52:50 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-10-27 08:52:50 +0000
commit71043cd0f9cb7a57a820b450846a643b3d978727 (patch)
tree518fc4f5ee616248ce52999f42418feafd712311 /gst/mpegtsmux
parentb1c91d7ebe2a98f7bd47cea183e328dbc71b28b8 (diff)
downloadgst-plugins-bad-71043cd0f9cb7a57a820b450846a643b3d978727.tar.gz
gst-plugins-bad-71043cd0f9cb7a57a820b450846a643b3d978727.tar.bz2
gst-plugins-bad-71043cd0f9cb7a57a820b450846a643b3d978727.zip
gst/mpegtsmux/mpegtsmux.c: Fix EOS logic by correctly popping the collect pad buffers only when we've chosen to use t...
Original commit message from CVS: Patch by: vanista <vanista at gmail dot com> * gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_choose_best_stream): Fix EOS logic by correctly popping the collect pad buffers only when we've chosen to use them instead of popping them always and storing them in a private queue. Before the pipeline would deadlock if all pads go EOS at the same time. Fixes bug #557763.
Diffstat (limited to 'gst/mpegtsmux')
-rw-r--r--gst/mpegtsmux/mpegtsmux.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index 2b418f35..81757c63 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -418,6 +418,7 @@ static MpegTsPadData *
mpegtsmux_choose_best_stream (MpegTsMux * mux)
{
MpegTsPadData *best = NULL;
+ GstCollectData *c_best = NULL;
GSList *walk;
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) {
@@ -428,7 +429,8 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
if (ts_data->queued_buf == NULL) {
GstBuffer *buf;
- ts_data->queued_buf = buf = gst_collect_pads_pop (mux->collect, c_data);
+ ts_data->queued_buf = buf =
+ gst_collect_pads_peek (mux->collect, c_data);
if (buf != NULL) {
if (ts_data->prepare_func) {
@@ -463,8 +465,10 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
/* Choose a stream we've never seen a timestamp for to ensure
* we push enough buffers from it to reach a timestamp */
- if (ts_data->last_ts == GST_CLOCK_TIME_NONE)
+ if (ts_data->last_ts == GST_CLOCK_TIME_NONE) {
best = ts_data;
+ c_best = c_data;
+ }
} else {
ts_data->eos = TRUE;
continue;
@@ -478,12 +482,17 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
best->last_ts != GST_CLOCK_TIME_NONE &&
ts_data->last_ts < best->last_ts) {
best = ts_data;
+ c_best = c_data;
}
} else {
best = ts_data;
+ c_best = c_data;
}
}
}
+ if (c_best) {
+ gst_buffer_unref (gst_collect_pads_pop (mux->collect, c_best));
+ }
return best;
}