basevideoencoder: Fix handling of force-keyunit events

This commit is contained in:
Sebastian Dröge 2011-12-08 10:18:36 +01:00
parent 766f5bd161
commit 9ea6e7d2f2

View file

@ -991,8 +991,8 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder,
for (l = base_video_encoder->force_key_unit; l; l = l->next) { for (l = base_video_encoder->force_key_unit; l; l = l->next) {
ForcedKeyUnitEvent *tmp = l->data; ForcedKeyUnitEvent *tmp = l->data;
/* Skip pending keyunits */ /* Skip non-pending keyunits */
if (tmp->pending) if (!tmp->pending)
continue; continue;
/* Simple case, keyunit ASAP */ /* Simple case, keyunit ASAP */
@ -1007,13 +1007,14 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder,
break; break;
} }
} }
if (fevt) {
base_video_encoder->force_key_unit = base_video_encoder->force_key_unit =
g_list_remove (base_video_encoder->force_key_unit, fevt); g_list_remove (base_video_encoder->force_key_unit, fevt);
}
GST_OBJECT_UNLOCK (base_video_encoder); GST_OBJECT_UNLOCK (base_video_encoder);
/* Should really be here */ if (fevt) {
g_assert (fevt);
stream_time = stream_time =
gst_segment_to_stream_time (&GST_BASE_VIDEO_CODEC gst_segment_to_stream_time (&GST_BASE_VIDEO_CODEC
(base_video_encoder)->segment, GST_FORMAT_TIME, (base_video_encoder)->segment, GST_FORMAT_TIME,
@ -1023,7 +1024,8 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder,
(frame->presentation_timestamp, stream_time, running_time, (frame->presentation_timestamp, stream_time, running_time,
fevt->all_headers, fevt->count); fevt->all_headers, fevt->count);
gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ev); gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder),
ev);
if (fevt->all_headers) { if (fevt->all_headers) {
if (base_video_encoder->headers) { if (base_video_encoder->headers) {
@ -1038,6 +1040,7 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder,
GST_TIME_ARGS (running_time), fevt->all_headers, fevt->count); GST_TIME_ARGS (running_time), fevt->all_headers, fevt->count);
forced_key_unit_event_free (fevt); forced_key_unit_event_free (fevt);
} }
}
if (frame->is_sync_point) { if (frame->is_sync_point) {
base_video_encoder->distance_from_sync = 0; base_video_encoder->distance_from_sync = 0;