mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
playsink: make playsink reusable
The sinkpads are unblocked when going from PAUSED->READY, we need to block them again when going READY->PAUSED. The blocking of the pad previously only happened when it was freshly obtained with _request_pad or when the caps changed. If we don't release the pad when going to READY it was previously never blocked again causing not-linked errors.
This commit is contained in:
parent
f21b7437e7
commit
7736044d45
1 changed files with 36 additions and 0 deletions
|
@ -3908,6 +3908,42 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
* sinks */
|
||||
do_async_start (playsink);
|
||||
ret = GST_STATE_CHANGE_ASYNC;
|
||||
|
||||
/* block all pads here */
|
||||
GST_PLAY_SINK_LOCK (playsink);
|
||||
if (playsink->video_pad && playsink->video_block_id == 0) {
|
||||
GstPad *opad =
|
||||
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
|
||||
(playsink->video_pad)));
|
||||
playsink->video_block_id =
|
||||
gst_pad_add_probe (opad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
sinkpad_blocked_cb, playsink, NULL);
|
||||
PENDING_FLAG_SET (playsink, GST_PLAY_SINK_TYPE_VIDEO);
|
||||
gst_object_unref (opad);
|
||||
}
|
||||
|
||||
if (playsink->audio_pad && playsink->audio_block_id == 0) {
|
||||
GstPad *opad =
|
||||
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
|
||||
(playsink->audio_pad)));
|
||||
playsink->audio_block_id =
|
||||
gst_pad_add_probe (opad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
sinkpad_blocked_cb, playsink, NULL);
|
||||
PENDING_FLAG_SET (playsink, GST_PLAY_SINK_TYPE_AUDIO);
|
||||
gst_object_unref (opad);
|
||||
}
|
||||
|
||||
if (playsink->text_pad && playsink->text_block_id == 0) {
|
||||
GstPad *opad =
|
||||
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
|
||||
(playsink->text_pad)));
|
||||
playsink->text_block_id =
|
||||
gst_pad_add_probe (opad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
sinkpad_blocked_cb, playsink, NULL);
|
||||
PENDING_FLAG_SET (playsink, GST_PLAY_SINK_TYPE_TEXT);
|
||||
gst_object_unref (opad);
|
||||
}
|
||||
GST_PLAY_SINK_UNLOCK (playsink);
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
/* unblock all pads here */
|
||||
|
|
Loading…
Reference in a new issue