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:
Wim Taymans 2007-05-17 15:22:44 +00:00 committed by Sebastian Dröge
parent aa02328e2b
commit b2486d65c6

View file

@ -80,8 +80,8 @@ enum
#define DEFAULT_MAX_SIZE_TIME 2 * GST_SECOND /* 2 seconds */ #define DEFAULT_MAX_SIZE_TIME 2 * GST_SECOND /* 2 seconds */
#define DEFAULT_USE_BUFFERING FALSE #define DEFAULT_USE_BUFFERING FALSE
#define DEFAULT_USE_RATE_ESTIMATE TRUE #define DEFAULT_USE_RATE_ESTIMATE TRUE
#define DEFAULT_LOW_PERCENT 15 #define DEFAULT_LOW_PERCENT 10
#define DEFAULT_HIGH_PERCENT 95 #define DEFAULT_HIGH_PERCENT 99
enum enum
{ {
@ -683,39 +683,40 @@ update_rates (GstQueue * queue)
elapsed = g_timer_elapsed (queue->timer, NULL); elapsed = g_timer_elapsed (queue->timer, NULL);
/* recalc after each interval. */ /* recalc after each interval. */
if (queue->last_elapsed + RATE_INTERVAL >= elapsed) if (queue->last_elapsed + RATE_INTERVAL < elapsed) {
return; 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, byte_in_rate = queue->bytes_in / period;
"rates: period %f, in %" G_GUINT64_FORMAT ", out %" G_GUINT64_FORMAT, byte_out_rate = queue->bytes_out / period;
period, queue->bytes_in, queue->bytes_out);
byte_in_rate = queue->bytes_in / period; if (queue->byte_in_rate == 0.0)
byte_out_rate = queue->bytes_out / period; 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) if (queue->byte_out_rate == 0.0)
queue->byte_in_rate = byte_in_rate; queue->byte_out_rate = byte_out_rate;
else else
queue->byte_in_rate = AVG_IN (queue->byte_in_rate, byte_in_rate); queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate);
if (queue->byte_out_rate == 0.0) /* reset the values to calculate rate over the next interval */
queue->byte_out_rate = byte_out_rate; queue->last_elapsed = elapsed;
else queue->bytes_in = 0;
queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate); queue->bytes_out = 0;
}
queue->cur_level.rate_time = if (queue->byte_in_rate > 0.0) {
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND; 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, GST_DEBUG_OBJECT (queue, "rates: in %f, out %f, time %" GST_TIME_FORMAT,
queue->byte_in_rate, queue->byte_out_rate, queue->byte_in_rate, queue->byte_out_rate,
GST_TIME_ARGS (queue->cur_level.rate_time)); 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 static void