mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
x264enc: React properly to flushing/resetting the encoder
https://bugzilla.gnome.org/show_bug.cgi?id=656007
This commit is contained in:
parent
a8a32d1317
commit
a4a89275f8
1 changed files with 10 additions and 18 deletions
|
@ -429,7 +429,6 @@ static void gst_x264_enc_flush_frames (GstX264Enc * encoder, gboolean send);
|
||||||
static GstFlowReturn gst_x264_enc_encode_frame (GstX264Enc * encoder,
|
static GstFlowReturn gst_x264_enc_encode_frame (GstX264Enc * encoder,
|
||||||
x264_picture_t * pic_in, GstVideoCodecFrame * input_frame, int *i_nal,
|
x264_picture_t * pic_in, GstVideoCodecFrame * input_frame, int *i_nal,
|
||||||
gboolean send);
|
gboolean send);
|
||||||
static gboolean gst_x264_enc_stop (GstVideoEncoder * encoder);
|
|
||||||
static gboolean gst_x264_enc_set_format (GstVideoEncoder * video_enc,
|
static gboolean gst_x264_enc_set_format (GstVideoEncoder * video_enc,
|
||||||
GstVideoCodecState * state);
|
GstVideoCodecState * state);
|
||||||
static gboolean gst_x264_enc_propose_allocation (GstVideoEncoder * encoder,
|
static gboolean gst_x264_enc_propose_allocation (GstVideoEncoder * encoder,
|
||||||
|
@ -594,7 +593,6 @@ gst_x264_enc_class_init (GstX264EncClass * klass)
|
||||||
gobject_class->get_property = gst_x264_enc_get_property;
|
gobject_class->get_property = gst_x264_enc_get_property;
|
||||||
gobject_class->finalize = gst_x264_enc_finalize;
|
gobject_class->finalize = gst_x264_enc_finalize;
|
||||||
|
|
||||||
gstencoder_class->stop = GST_DEBUG_FUNCPTR (gst_x264_enc_stop);
|
|
||||||
gstencoder_class->set_format = GST_DEBUG_FUNCPTR (gst_x264_enc_set_format);
|
gstencoder_class->set_format = GST_DEBUG_FUNCPTR (gst_x264_enc_set_format);
|
||||||
gstencoder_class->handle_frame =
|
gstencoder_class->handle_frame =
|
||||||
GST_DEBUG_FUNCPTR (gst_x264_enc_handle_frame);
|
GST_DEBUG_FUNCPTR (gst_x264_enc_handle_frame);
|
||||||
|
@ -927,8 +925,6 @@ gst_x264_enc_init (GstX264Enc * encoder)
|
||||||
encoder->x264param.pf_log = gst_x264_enc_log_callback;
|
encoder->x264param.pf_log = gst_x264_enc_log_callback;
|
||||||
encoder->x264param.p_log_private = encoder;
|
encoder->x264param.p_log_private = encoder;
|
||||||
encoder->x264param.i_log_level = X264_LOG_DEBUG;
|
encoder->x264param.i_log_level = X264_LOG_DEBUG;
|
||||||
|
|
||||||
gst_x264_enc_reset (GST_VIDEO_ENCODER (encoder), FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -997,15 +993,17 @@ gst_x264_enc_reset (GstVideoEncoder * encoder, gboolean hard)
|
||||||
{
|
{
|
||||||
GstX264Enc *x264enc = GST_X264_ENC (encoder);
|
GstX264Enc *x264enc = GST_X264_ENC (encoder);
|
||||||
|
|
||||||
if (hard) {
|
gst_x264_enc_flush_frames (x264enc, FALSE);
|
||||||
gst_x264_enc_flush_frames (x264enc, FALSE);
|
gst_x264_enc_close_encoder (x264enc);
|
||||||
gst_x264_enc_close_encoder (x264enc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x264enc->input_state)
|
if (hard) {
|
||||||
gst_video_codec_state_unref (x264enc->input_state);
|
if (x264enc->input_state)
|
||||||
x264enc->input_state = NULL;
|
gst_video_codec_state_unref (x264enc->input_state);
|
||||||
x264enc->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
|
x264enc->input_state = NULL;
|
||||||
|
x264enc->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
|
||||||
|
} else {
|
||||||
|
gst_x264_enc_init_encoder (x264enc);
|
||||||
|
}
|
||||||
|
|
||||||
gst_x264_enc_dequeue_all_frames (x264enc);
|
gst_x264_enc_dequeue_all_frames (x264enc);
|
||||||
|
|
||||||
|
@ -1937,12 +1935,6 @@ gst_x264_enc_flush_frames (GstX264Enc * encoder, gboolean send)
|
||||||
&& x264_encoder_delayed_frames (encoder->x264enc) > 0);
|
&& x264_encoder_delayed_frames (encoder->x264enc) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_x264_enc_stop (GstVideoEncoder * encoder)
|
|
||||||
{
|
|
||||||
return gst_x264_enc_reset (encoder, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_x264_enc_reconfig (GstX264Enc * encoder)
|
gst_x264_enc_reconfig (GstX264Enc * encoder)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue