mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
gst/gstsegment.c: Added some more docs.
Original commit message from CVS: * gst/gstsegment.c: Added some more docs. * libs/gst/base/gstbasesink.c: (gst_base_sink_perform_qos), (gst_base_sink_reset_qos): Calculate more accurate rate values.
This commit is contained in:
parent
78ee95a508
commit
c2d86926f5
3 changed files with 41 additions and 20 deletions
|
@ -1,3 +1,12 @@
|
|||
2006-04-10 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstsegment.c:
|
||||
Added some more docs.
|
||||
|
||||
* libs/gst/base/gstbasesink.c: (gst_base_sink_perform_qos),
|
||||
(gst_base_sink_reset_qos):
|
||||
Calculate more accurate rate values.
|
||||
|
||||
2006-04-09 Sebastien Moutte <sebastien@moutte.net>
|
||||
|
||||
* gst/gst_private.h:
|
||||
|
|
|
@ -412,14 +412,18 @@ gst_segment_set_newsegment (GstSegment * segment, gboolean update, gdouble rate,
|
|||
* @position: the position in the segment
|
||||
*
|
||||
* Translate @position to stream time using the currently configured
|
||||
* segment.
|
||||
* segment. The @position value must be between @segment start and
|
||||
* stop value.
|
||||
*
|
||||
* This function is typically used by elements that need to operate on
|
||||
* the stream time of the buffers it receives, such as effect plugins.
|
||||
* In those use cases, @position is typically the buffer timestamp that
|
||||
* one wants to convert to the stream time.
|
||||
* The stream time is always between 0 and the total duration of the
|
||||
* media stream.
|
||||
*
|
||||
* Returns: the position in stream_time.
|
||||
* Returns: the position in stream_time or -1 when an invalid position
|
||||
* was given.
|
||||
*/
|
||||
gint64
|
||||
gst_segment_to_stream_time (GstSegment * segment, GstFormat format,
|
||||
|
|
|
@ -1215,11 +1215,15 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
|
|||
|
||||
/* if we have the time when the last buffer left us, calculate
|
||||
* processing time */
|
||||
if (priv->last_left != -1 && entered > priv->last_left) {
|
||||
if (priv->last_left != -1) {
|
||||
if (entered > priv->last_left) {
|
||||
pt = entered - priv->last_left;
|
||||
} else {
|
||||
pt = 0;
|
||||
}
|
||||
} else {
|
||||
pt = priv->avg_pt;
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink, "start: %" GST_TIME_FORMAT
|
||||
", entered %" GST_TIME_FORMAT ", left %" GST_TIME_FORMAT ", pt: %"
|
||||
|
@ -1233,9 +1237,6 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
|
|||
GST_TIME_ARGS (priv->avg_duration), GST_TIME_ARGS (priv->avg_pt),
|
||||
priv->avg_rate);
|
||||
|
||||
/* record when this buffer will leave us */
|
||||
priv->last_left = left;
|
||||
|
||||
/* collect running averages. for first observations, we copy the
|
||||
* values */
|
||||
if (priv->avg_duration == -1)
|
||||
|
@ -1253,12 +1254,18 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
|
|||
gst_guint64_to_gdouble (priv->avg_pt) /
|
||||
gst_guint64_to_gdouble (priv->avg_duration);
|
||||
else
|
||||
rate = 1.0;
|
||||
rate = 0.0;
|
||||
|
||||
if (priv->last_left != -1) {
|
||||
if (dropped || priv->avg_rate < 0.0) {
|
||||
priv->avg_rate = rate;
|
||||
} else {
|
||||
if (rate > 1.0)
|
||||
priv->avg_rate = UPDATE_RUNNING_AVG_N (priv->avg_rate, rate);
|
||||
else
|
||||
priv->avg_rate = UPDATE_RUNNING_AVG_P (priv->avg_rate, rate);
|
||||
}
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink,
|
||||
"updated: avg_duration: %" GST_TIME_FORMAT ", avg_pt: %" GST_TIME_FORMAT
|
||||
|
@ -1266,13 +1273,14 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
|
|||
GST_TIME_ARGS (priv->avg_pt), priv->avg_rate);
|
||||
|
||||
|
||||
if (dropped) {
|
||||
priv->avg_rate = 2.0;
|
||||
}
|
||||
|
||||
/* always send QoS events */
|
||||
/* if we have a valid rate, start sending QoS messages */
|
||||
if (priv->avg_rate >= 0.0) {
|
||||
gst_base_sink_send_qos (sink, priv->avg_rate, priv->current_rstart,
|
||||
priv->current_jitter);
|
||||
}
|
||||
|
||||
/* record when this buffer will leave us */
|
||||
priv->last_left = left;
|
||||
}
|
||||
|
||||
/* reset all qos measuring */
|
||||
|
@ -1287,7 +1295,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink)
|
|||
priv->last_left = -1;
|
||||
priv->avg_duration = -1;
|
||||
priv->avg_pt = -1;
|
||||
priv->avg_rate = 1.0;
|
||||
priv->avg_rate = -1.0;
|
||||
priv->avg_render = -1;
|
||||
priv->rendered = 0;
|
||||
priv->dropped = 0;
|
||||
|
|
Loading…
Reference in a new issue