mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS: * gst/playback/gstqueue2.c: (update_rates): Tweak the buffering thresholds a little. Update the buffer size with the previously calculate rate instead of only when we calculate a new rate so that we get smoother buffering updates. * gst/playback/Makefile.am: * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init), (gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init), (gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property), (gst_uri_decode_bin_get_property), (unknown_type), (add_element_stream), (no_more_pads_full), (no_more_pads), (source_no_more_pads), (new_decoded_pad), (array_has_value), (gen_source_element), (has_all_raw_caps), (analyse_source), (remove_decoders), (make_decoder), (remove_source), (source_new_pad), (setup_source), (decoder_query_init), (decoder_query_duration_fold), (decoder_query_duration_done), (decoder_query_position_fold), (decoder_query_position_done), (decoder_query_latency_fold), (decoder_query_latency_done), (decoder_query_seeking_fold), (decoder_query_seeking_done), (decoder_query_generic_fold), (gst_uri_decode_bin_query), (gst_uri_decode_bin_change_state), (plugin_init): New element that intergrates a source, optional buffering element and decodebin.
This commit is contained in:
parent
aa02328e2b
commit
b2486d65c6
1 changed files with 26 additions and 25 deletions
|
@ -80,8 +80,8 @@ enum
|
|||
#define DEFAULT_MAX_SIZE_TIME 2 * GST_SECOND /* 2 seconds */
|
||||
#define DEFAULT_USE_BUFFERING FALSE
|
||||
#define DEFAULT_USE_RATE_ESTIMATE TRUE
|
||||
#define DEFAULT_LOW_PERCENT 15
|
||||
#define DEFAULT_HIGH_PERCENT 95
|
||||
#define DEFAULT_LOW_PERCENT 10
|
||||
#define DEFAULT_HIGH_PERCENT 99
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -683,39 +683,40 @@ update_rates (GstQueue * queue)
|
|||
elapsed = g_timer_elapsed (queue->timer, NULL);
|
||||
|
||||
/* recalc after each interval. */
|
||||
if (queue->last_elapsed + RATE_INTERVAL >= elapsed)
|
||||
return;
|
||||
if (queue->last_elapsed + RATE_INTERVAL < elapsed) {
|
||||
period = elapsed - queue->last_elapsed;
|
||||
|
||||
period = elapsed - queue->last_elapsed;
|
||||
GST_DEBUG_OBJECT (queue,
|
||||
"rates: period %f, in %" G_GUINT64_FORMAT ", out %" G_GUINT64_FORMAT,
|
||||
period, queue->bytes_in, queue->bytes_out);
|
||||
|
||||
GST_DEBUG_OBJECT (queue,
|
||||
"rates: period %f, in %" G_GUINT64_FORMAT ", out %" G_GUINT64_FORMAT,
|
||||
period, queue->bytes_in, queue->bytes_out);
|
||||
byte_in_rate = queue->bytes_in / period;
|
||||
byte_out_rate = queue->bytes_out / period;
|
||||
|
||||
byte_in_rate = queue->bytes_in / period;
|
||||
byte_out_rate = queue->bytes_out / period;
|
||||
if (queue->byte_in_rate == 0.0)
|
||||
queue->byte_in_rate = byte_in_rate;
|
||||
else
|
||||
queue->byte_in_rate = AVG_IN (queue->byte_in_rate, byte_in_rate);
|
||||
|
||||
if (queue->byte_in_rate == 0.0)
|
||||
queue->byte_in_rate = byte_in_rate;
|
||||
else
|
||||
queue->byte_in_rate = AVG_IN (queue->byte_in_rate, byte_in_rate);
|
||||
if (queue->byte_out_rate == 0.0)
|
||||
queue->byte_out_rate = byte_out_rate;
|
||||
else
|
||||
queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate);
|
||||
|
||||
if (queue->byte_out_rate == 0.0)
|
||||
queue->byte_out_rate = byte_out_rate;
|
||||
else
|
||||
queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate);
|
||||
/* reset the values to calculate rate over the next interval */
|
||||
queue->last_elapsed = elapsed;
|
||||
queue->bytes_in = 0;
|
||||
queue->bytes_out = 0;
|
||||
}
|
||||
|
||||
queue->cur_level.rate_time =
|
||||
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
||||
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: in %f, out %f, time %" GST_TIME_FORMAT,
|
||||
queue->byte_in_rate, queue->byte_out_rate,
|
||||
GST_TIME_ARGS (queue->cur_level.rate_time));
|
||||
|
||||
/* reset the values to calculate rate over the next interval */
|
||||
queue->last_elapsed = elapsed;
|
||||
queue->bytes_in = 0;
|
||||
queue->bytes_out = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue