mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
basevideo: Revert "Call GstBaseVideoEncoder::start/stop during pad [de]activation."
This reverts commit 4c087bcb07
.
The reverted commit changes the order that set_format() and start()
are called, which is incorrect. The correct order is set_format(),
start(), handle_frame()..., stop()
This commit is contained in:
parent
7496a84ea0
commit
76f489c595
1 changed files with 5 additions and 50 deletions
|
@ -27,8 +27,6 @@
|
||||||
GST_DEBUG_CATEGORY_EXTERN (basevideo_debug);
|
GST_DEBUG_CATEGORY_EXTERN (basevideo_debug);
|
||||||
#define GST_CAT_DEFAULT basevideo_debug
|
#define GST_CAT_DEFAULT basevideo_debug
|
||||||
|
|
||||||
static gboolean gst_base_video_encoder_sink_activate (GstBaseVideoEncoder *
|
|
||||||
base_video_encoder, gboolean active);
|
|
||||||
static void gst_base_video_encoder_finalize (GObject * object);
|
static void gst_base_video_encoder_finalize (GObject * object);
|
||||||
|
|
||||||
static gboolean gst_base_video_encoder_sink_setcaps (GstPad * pad,
|
static gboolean gst_base_video_encoder_sink_setcaps (GstPad * pad,
|
||||||
|
@ -43,8 +41,6 @@ static const GstQueryType *gst_base_video_encoder_get_query_types (GstPad *
|
||||||
pad);
|
pad);
|
||||||
static gboolean gst_base_video_encoder_src_query (GstPad * pad,
|
static gboolean gst_base_video_encoder_src_query (GstPad * pad,
|
||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
static gboolean gst_base_video_encoder_sink_activate_push (GstPad * pad,
|
|
||||||
gboolean active);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_do_init (GType object_type)
|
_do_init (GType object_type)
|
||||||
|
@ -94,8 +90,6 @@ gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder,
|
||||||
|
|
||||||
pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_encoder);
|
pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_encoder);
|
||||||
|
|
||||||
gst_pad_set_activatepush_function (pad,
|
|
||||||
gst_base_video_encoder_sink_activate_push);
|
|
||||||
gst_pad_set_chain_function (pad, gst_base_video_encoder_chain);
|
gst_pad_set_chain_function (pad, gst_base_video_encoder_chain);
|
||||||
gst_pad_set_event_function (pad, gst_base_video_encoder_sink_event);
|
gst_pad_set_event_function (pad, gst_base_video_encoder_sink_event);
|
||||||
gst_pad_set_setcaps_function (pad, gst_base_video_encoder_sink_setcaps);
|
gst_pad_set_setcaps_function (pad, gst_base_video_encoder_sink_setcaps);
|
||||||
|
@ -106,50 +100,6 @@ gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder,
|
||||||
gst_pad_set_query_function (pad, gst_base_video_encoder_src_query);
|
gst_pad_set_query_function (pad, gst_base_video_encoder_src_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_base_video_encoder_sink_activate (GstBaseVideoEncoder * encoder,
|
|
||||||
gboolean active)
|
|
||||||
{
|
|
||||||
GstBaseVideoEncoderClass *klass;
|
|
||||||
gboolean result = FALSE;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (encoder, "activate");
|
|
||||||
|
|
||||||
klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (encoder);
|
|
||||||
|
|
||||||
if (active) {
|
|
||||||
if (klass->start)
|
|
||||||
result = klass->start (encoder);
|
|
||||||
} else {
|
|
||||||
/* We must make sure streaming has finished before resetting things
|
|
||||||
* and calling the ::stop vfunc */
|
|
||||||
GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (encoder));
|
|
||||||
GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (encoder));
|
|
||||||
|
|
||||||
if (klass->stop)
|
|
||||||
result = klass->stop (encoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (encoder, "activate: %d", result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_base_video_encoder_sink_activate_push (GstPad * pad, gboolean active)
|
|
||||||
{
|
|
||||||
gboolean result = TRUE;
|
|
||||||
GstBaseVideoEncoder *base_video_encoder;
|
|
||||||
|
|
||||||
base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
result = gst_base_video_encoder_sink_activate (base_video_encoder, active);
|
|
||||||
|
|
||||||
gst_object_unref (base_video_encoder);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
@ -168,6 +118,8 @@ gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
res = base_video_encoder_class->set_format (base_video_encoder,
|
res = base_video_encoder_class->set_format (base_video_encoder,
|
||||||
&base_video_encoder->state);
|
&base_video_encoder->state);
|
||||||
|
|
||||||
|
base_video_encoder_class->start (base_video_encoder);
|
||||||
|
|
||||||
g_object_unref (base_video_encoder);
|
g_object_unref (base_video_encoder);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -419,6 +371,9 @@ gst_base_video_encoder_change_state (GstElement * element,
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
if (base_video_encoder_class->stop) {
|
||||||
|
base_video_encoder_class->stop (base_video_encoder);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue