mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
vp8enc: Fix handling of invisible/alt ref frames
This commit is contained in:
parent
ccbb765743
commit
98048829b0
1 changed files with 42 additions and 35 deletions
|
@ -889,6 +889,13 @@ _to_granulepos (guint64 frame_end_number, guint inv_count, guint keyframe_dist)
|
|||
return granulepos;
|
||||
}
|
||||
|
||||
static void
|
||||
_gst_mini_object_unref0 (GstMiniObject * obj)
|
||||
{
|
||||
if (obj)
|
||||
gst_mini_object_unref (obj);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
||||
GstVideoFrame * frame)
|
||||
|
@ -907,12 +914,11 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
|||
|
||||
state = gst_base_video_encoder_get_state (base_video_encoder);
|
||||
|
||||
buf = frame->src_buffer;
|
||||
frame->src_buffer = NULL;
|
||||
g_assert (hook != NULL);
|
||||
|
||||
if (hook) {
|
||||
for (inv_count = 0, l = hook->invisible; l; inv_count++, l = l->next) {
|
||||
buf = l->data;
|
||||
l->data = NULL;
|
||||
|
||||
if (l == hook->invisible && frame->is_sync_point) {
|
||||
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
@ -933,8 +939,7 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
|||
GST_SECOND * state->fps_d, state->fps_n);
|
||||
|
||||
gst_buffer_set_caps (buf, base_video_encoder->caps);
|
||||
ret =
|
||||
gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf);
|
||||
ret = gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf);
|
||||
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (encoder, "flow error %d", ret);
|
||||
|
@ -942,6 +947,9 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
|||
}
|
||||
}
|
||||
|
||||
buf = frame->src_buffer;
|
||||
frame->src_buffer = NULL;
|
||||
|
||||
if (!hook->invisible && frame->is_sync_point) {
|
||||
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
encoder->keyframe_distance = 0;
|
||||
|
@ -949,7 +957,6 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
|||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
encoder->keyframe_distance++;
|
||||
}
|
||||
}
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buf) = gst_video_state_get_timestamp (state,
|
||||
&base_video_encoder->segment, frame->presentation_frame_number);
|
||||
|
@ -972,7 +979,7 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
|
|||
|
||||
done:
|
||||
if (hook) {
|
||||
g_list_foreach (hook->invisible, (GFunc) gst_mini_object_unref, NULL);
|
||||
g_list_foreach (hook->invisible, (GFunc) _gst_mini_object_unref0, NULL);
|
||||
g_list_free (hook->invisible);
|
||||
g_slice_free (GstVP8EncCoderHook, hook);
|
||||
frame->coder_hook = NULL;
|
||||
|
|
Loading…
Reference in a new issue