mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
gst/adder/gstadder.c: Fix timestamps and fix deadlock when stopping the collectpads.
Original commit message from CVS: * gst/adder/gstadder.c: (gst_adder_query), (gst_adder_collected), (gst_adder_change_state): Fix timestamps and fix deadlock when stopping the collectpads.
This commit is contained in:
parent
00e8471356
commit
2de274ea2c
2 changed files with 18 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-10-27 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/adder/gstadder.c: (gst_adder_query), (gst_adder_collected),
|
||||||
|
(gst_adder_change_state):
|
||||||
|
Fix timestamps and fix deadlock when stopping the collectpads.
|
||||||
|
|
||||||
2005-10-27 Zeeshan Ali <zeenix@gmail.com>
|
2005-10-27 Zeeshan Ali <zeenix@gmail.com>
|
||||||
|
|
||||||
* gst-libs/gst/rtp/gstrtpbuffer.h:
|
* gst-libs/gst/rtp/gstrtpbuffer.h:
|
||||||
|
|
|
@ -402,17 +402,21 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
|
|
||||||
/* set timestamps on the output buffer */
|
/* set timestamps on the output buffer */
|
||||||
{
|
{
|
||||||
|
guint64 samples;
|
||||||
guint64 duration;
|
guint64 duration;
|
||||||
|
|
||||||
/* width is in bits and we need bytes */
|
/* width is in bits and we need bytes */
|
||||||
duration = size * (adder->width / 8) / adder->channels;
|
samples = size / ((adder->width / 8) * adder->channels);
|
||||||
|
duration = samples * GST_SECOND / adder->rate;
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
|
GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
|
||||||
GST_BUFFER_OFFSET (outbuf) = adder->offset;
|
GST_BUFFER_OFFSET (outbuf) = adder->offset;
|
||||||
GST_BUFFER_DURATION (outbuf) = duration;
|
|
||||||
|
|
||||||
adder->offset += duration;
|
adder->offset += samples;
|
||||||
adder->timestamp = adder->offset * GST_SECOND / adder->rate;
|
adder->timestamp = adder->offset * GST_SECOND / adder->rate;
|
||||||
|
|
||||||
|
GST_BUFFER_DURATION (outbuf) = adder->timestamp -
|
||||||
|
GST_BUFFER_TIMESTAMP (outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send it out */
|
/* send it out */
|
||||||
|
@ -446,6 +450,11 @@ gst_adder_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
/* need to unblock the collectpads before calling the
|
||||||
|
* parent change_state so that streaming can finish */
|
||||||
|
gst_collectpads_stop (adder->collect);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -453,9 +462,6 @@ gst_adder_change_state (GstElement * element, GstStateChange transition)
|
||||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
||||||
gst_collectpads_stop (adder->collect);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue