mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
gst/playback/gstqueue2.c: Update the estimated input data when we push out a buffer.
Original commit message from CVS: * gst/playback/gstqueue2.c: (update_out_rates), (gst_queue_open_temp_location_file), (gst_queue_close_temp_location_file), (gst_queue_handle_src_event), (gst_queue_handle_src_query), (gst_queue_set_property): Update the estimated input data when we push out a buffer. Add some debug info about the temp file. Only forward src events when we are not using a temp file. Don't block the duration query, we need to find something better. Don't leak the temp filename.
This commit is contained in:
parent
0e7fb0ffa5
commit
fc13a73038
1 changed files with 17 additions and 18 deletions
|
@ -800,6 +800,10 @@ update_out_rates (GstQueue * queue)
|
|||
queue->last_out_elapsed = elapsed;
|
||||
queue->bytes_out = 0;
|
||||
}
|
||||
if (queue->byte_in_rate > 0.0) {
|
||||
queue->cur_level.rate_time =
|
||||
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
||||
}
|
||||
GST_DEBUG_OBJECT (queue, "rates: out %f, time %" GST_TIME_FORMAT,
|
||||
queue->byte_out_rate, GST_TIME_ARGS (queue->cur_level.rate_time));
|
||||
}
|
||||
|
@ -955,6 +959,8 @@ gst_queue_open_temp_location_file (GstQueue * queue)
|
|||
if (queue->temp_location == NULL)
|
||||
goto no_filename;
|
||||
|
||||
GST_DEBUG_OBJECT (queue, "opening temp file %s", queue->temp_location);
|
||||
|
||||
/* open the file for update/writing */
|
||||
queue->temp_file = g_fopen (queue->temp_location, "wb+");
|
||||
/* error creating file */
|
||||
|
@ -988,6 +994,7 @@ gst_queue_close_temp_location_file (GstQueue * queue)
|
|||
/* nothing to do */
|
||||
if (queue->temp_file == NULL)
|
||||
return;
|
||||
GST_DEBUG_OBJECT (queue, "closing temp file");
|
||||
|
||||
/* we don't remove the file so that the application can use it as a cache
|
||||
* later on */
|
||||
|
@ -1552,8 +1559,14 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
event, GST_EVENT_TYPE_NAME (event));
|
||||
#endif
|
||||
|
||||
/* just forward upstream */
|
||||
res = gst_pad_push_event (queue->sinkpad, event);
|
||||
if (!QUEUE_IS_USING_TEMP_FILE (queue)) {
|
||||
/* just forward upstream */
|
||||
res = gst_pad_push_event (queue->sinkpad, event);
|
||||
} else {
|
||||
/* when using a temp file, we unblock the pending read */
|
||||
res = TRUE;
|
||||
gst_event_unref (event);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1609,15 +1622,7 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GST_DEBUG_OBJECT (queue, "waiting for preroll in duration query");
|
||||
|
||||
GST_QUEUE_MUTEX_LOCK (queue);
|
||||
/* we have to wait until the upstream element is at least paused, which
|
||||
* happened when we received a first item. */
|
||||
while (gst_queue_is_empty (queue)) {
|
||||
GST_QUEUE_WAIT_ADD_CHECK (queue, flushing);
|
||||
}
|
||||
GST_QUEUE_MUTEX_UNLOCK (queue);
|
||||
GST_DEBUG_OBJECT (queue, "doing peer query");
|
||||
|
||||
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
|
||||
goto peer_failed;
|
||||
|
@ -1640,12 +1645,6 @@ peer_failed:
|
|||
GST_DEBUG_OBJECT (queue, "failed peer query");
|
||||
return FALSE;
|
||||
}
|
||||
flushing:
|
||||
{
|
||||
GST_DEBUG_OBJECT (queue, "flushing while waiting for query");
|
||||
GST_QUEUE_MUTEX_UNLOCK (queue);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -1928,7 +1927,7 @@ gst_queue_set_property (GObject * object,
|
|||
queue->high_percent = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_TEMP_LOCATION:
|
||||
gst_queue_set_temp_location (queue, g_value_dup_string (value));
|
||||
gst_queue_set_temp_location (queue, g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
Loading…
Reference in a new issue