This now behaves according to the videoencoder API instead of some other
signalling.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
input_num = *((guint64 *) map.data);
gst_buffer_unmap (frame->input_buffer, &map);
input_num = *((guint64 *) map.data);
gst_buffer_unmap (frame->input_buffer, &map);
- if (!enc_tester->key_frame_sent) {
+ if (!enc_tester->key_frame_sent
+ || GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame)) {
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
enc_tester->key_frame_sent = TRUE;
}
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
enc_tester->key_frame_sent = TRUE;
}
fail_unless (g_list_length (buffers) == 13 && g_list_length (events) == 5);
/* push a force key-unit event */
fail_unless (g_list_length (buffers) == 13 && g_list_length (events) == 5);
/* push a force key-unit event */
- enc_tester->key_frame_sent = FALSE;
- fail_unless (gst_pad_push_event (mysrcpad,
- gst_video_event_new_downstream_force_key_unit (GST_CLOCK_TIME_NONE,
- GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, TRUE, 1)));
+ fail_unless (gst_pad_push_event (mysinkpad,
+ gst_video_event_new_upstream_force_key_unit (GST_CLOCK_TIME_NONE,
+ TRUE, 1)));
/* Create a new buffer which should be a key unit -> no new buffer and no new event */
buffer = create_test_buffer (3);
/* Create a new buffer which should be a key unit -> no new buffer and no new event */
buffer = create_test_buffer (3);
enc_tester->last_frame, 2);
fail_unless (g_list_length (buffers) == 16 && g_list_length (events) == 7);
enc_tester->last_frame, 2);
fail_unless (g_list_length (buffers) == 16 && g_list_length (events) == 7);
- /* output 2 subframes -> 2 new buffer correspong the two last subframes */
+ /* output 2 subframes -> 2 new buffer corresponding the two last subframes */
gst_video_encoder_tester_output_step_by_step (GST_VIDEO_ENCODER (enc),
enc_tester->last_frame, 2);
fail_unless (g_list_length (buffers) == 18 && g_list_length (events) == 7);
gst_video_encoder_tester_output_step_by_step (GST_VIDEO_ENCODER (enc),
enc_tester->last_frame, 2);
fail_unless (g_list_length (buffers) == 18 && g_list_length (events) == 7);
7)->data)) == GST_EVENT_EOS);
/* check that only last subframe owns the GST_VIDEO_BUFFER_FLAG_MARKER flag */
7)->data)) == GST_EVENT_EOS);
/* check that only last subframe owns the GST_VIDEO_BUFFER_FLAG_MARKER flag */
- for (iter = g_list_next (buffers); iter; iter = g_list_next (iter)) {
+ for (iter = buffers, i = 0; iter; iter = g_list_next (iter), i++) {
buffer = (GstBuffer *) (iter->data);
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER)) {
if ((i - header_found) % subframes == (subframes - 1))
buffer = (GstBuffer *) (iter->data);
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER)) {
if ((i - header_found) % subframes == (subframes - 1))
GST_VIDEO_BUFFER_FLAG_MARKER));
header_found++;
}
GST_VIDEO_BUFFER_FLAG_MARKER));
header_found++;
}
+
+ /* Only the 0th (header), 1st, 13th (header) and 14th buffer should be keyframes */
+ if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
+ fail_if (i == 0 || i == 1 || i == 13 || i == 14);
+ } else {
+ fail_unless (i == 0 || i == 1 || i == 13 || i == 14);
+ }
}
g_list_free_full (buffers, (GDestroyNotify) gst_buffer_unref);
}
g_list_free_full (buffers, (GDestroyNotify) gst_buffer_unref);