mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
basevideoencoder: provide proper upstream flow return handling
This commit is contained in:
parent
b7ae60f617
commit
d15b8c7ad3
4 changed files with 17 additions and 15 deletions
|
@ -150,7 +150,7 @@ static gboolean gst_dirac_enc_set_format (GstBaseVideoEncoder *
|
|||
static gboolean gst_dirac_enc_start (GstBaseVideoEncoder * base_video_encoder);
|
||||
static gboolean gst_dirac_enc_stop (GstBaseVideoEncoder * base_video_encoder);
|
||||
static gboolean gst_dirac_enc_finish (GstBaseVideoEncoder * base_video_encoder);
|
||||
static gboolean gst_dirac_enc_handle_frame (GstBaseVideoEncoder *
|
||||
static GstFlowReturn gst_dirac_enc_handle_frame (GstBaseVideoEncoder *
|
||||
base_video_encoder, GstVideoFrame * frame);
|
||||
static GstFlowReturn gst_dirac_enc_shape_output (GstBaseVideoEncoder *
|
||||
base_video_encoder, GstVideoFrame * frame);
|
||||
|
@ -855,12 +855,12 @@ gst_dirac_enc_finish (GstBaseVideoEncoder * base_video_encoder)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||
GstVideoFrame * frame)
|
||||
{
|
||||
GstDiracEnc *dirac_enc = GST_DIRAC_ENC (base_video_encoder);
|
||||
gboolean ret;
|
||||
GstFlowReturn ret;
|
||||
int r;
|
||||
const GstVideoState *state;
|
||||
uint8_t *data;
|
||||
|
@ -963,7 +963,7 @@ gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
|||
}
|
||||
if (r != (int) GST_BUFFER_SIZE (frame->sink_buffer)) {
|
||||
GST_ERROR ("failed to push picture");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
GST_DEBUG ("handle frame");
|
||||
|
@ -976,7 +976,7 @@ gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
|||
|
||||
ret = gst_dirac_enc_process (dirac_enc, FALSE);
|
||||
|
||||
return (ret == GST_FLOW_OK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -149,7 +149,7 @@ static gboolean gst_vp8_enc_stop (GstBaseVideoEncoder * encoder);
|
|||
static gboolean gst_vp8_enc_set_format (GstBaseVideoEncoder *
|
||||
base_video_encoder, GstVideoState * state);
|
||||
static gboolean gst_vp8_enc_finish (GstBaseVideoEncoder * base_video_encoder);
|
||||
static gboolean gst_vp8_enc_handle_frame (GstBaseVideoEncoder *
|
||||
static GstFlowReturn gst_vp8_enc_handle_frame (GstBaseVideoEncoder *
|
||||
base_video_encoder, GstVideoFrame * frame);
|
||||
static GstFlowReturn gst_vp8_enc_shape_output (GstBaseVideoEncoder * encoder,
|
||||
GstVideoFrame * frame);
|
||||
|
@ -672,7 +672,7 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
|
|||
return caps;
|
||||
}
|
||||
|
||||
static void
|
||||
static GstFlowReturn
|
||||
gst_vp8_enc_process (GstVP8Enc * encoder)
|
||||
{
|
||||
vpx_codec_iter_t iter = NULL;
|
||||
|
@ -680,6 +680,7 @@ gst_vp8_enc_process (GstVP8Enc * encoder)
|
|||
GstBaseVideoEncoder *base_video_encoder;
|
||||
GstVP8EncCoderHook *hook;
|
||||
GstVideoFrame *frame;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
|
||||
base_video_encoder = GST_BASE_VIDEO_ENCODER (encoder);
|
||||
|
||||
|
@ -732,11 +733,13 @@ gst_vp8_enc_process (GstVP8Enc * encoder)
|
|||
hook->invisible = g_list_append (hook->invisible, buffer);
|
||||
} else {
|
||||
frame->src_buffer = buffer;
|
||||
gst_base_video_encoder_finish_frame (base_video_encoder, frame);
|
||||
ret = gst_base_video_encoder_finish_frame (base_video_encoder, frame);
|
||||
}
|
||||
|
||||
pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -803,7 +806,7 @@ static const int speed_table[] = {
|
|||
VPX_DL_REALTIME,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||
GstVideoFrame * frame)
|
||||
{
|
||||
|
@ -845,9 +848,7 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_vp8_enc_process (encoder);
|
||||
|
||||
return TRUE;
|
||||
return gst_vp8_enc_process (encoder);
|
||||
}
|
||||
|
||||
static guint64
|
||||
|
|
|
@ -492,6 +492,7 @@ gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf)
|
|||
GstBaseVideoEncoder *base_video_encoder;
|
||||
GstBaseVideoEncoderClass *klass;
|
||||
GstVideoFrame *frame;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
|
||||
base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad));
|
||||
klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder);
|
||||
|
@ -547,12 +548,12 @@ gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf)
|
|||
GST_LOG_OBJECT (base_video_encoder, "passing frame pfn %d to subclass",
|
||||
frame->presentation_frame_number);
|
||||
|
||||
klass->handle_frame (base_video_encoder, frame);
|
||||
ret = klass->handle_frame (base_video_encoder, frame);
|
||||
|
||||
done:
|
||||
g_object_unref (base_video_encoder);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -98,7 +98,7 @@ struct _GstBaseVideoEncoderClass
|
|||
gboolean (*start) (GstBaseVideoEncoder *coder);
|
||||
gboolean (*stop) (GstBaseVideoEncoder *coder);
|
||||
gboolean (*finish) (GstBaseVideoEncoder *coder);
|
||||
gboolean (*handle_frame) (GstBaseVideoEncoder *coder, GstVideoFrame *frame);
|
||||
GstFlowReturn (*handle_frame) (GstBaseVideoEncoder *coder, GstVideoFrame *frame);
|
||||
GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder, GstVideoFrame *frame);
|
||||
gboolean (*event) (GstBaseVideoEncoder *coder, GstEvent *event);
|
||||
GstCaps *(*get_caps) (GstBaseVideoEncoder *coder);
|
||||
|
|
Loading…
Reference in a new issue