textoverlay: ensure text buffer has writable metadata when modifying

This commit is contained in:
Mark Nauwelaerts 2017-07-01 17:45:19 +02:00
parent bd940e7126
commit 20705f01fc
2 changed files with 5 additions and 3 deletions

View file

@ -2702,6 +2702,8 @@ gst_base_text_overlay_text_chain (GstPad * pad, GstObject * parent,
} }
if (in_seg) { if (in_seg) {
/* about to change metadata */
buffer = gst_buffer_make_writable (buffer);
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
GST_BUFFER_TIMESTAMP (buffer) = clip_start; GST_BUFFER_TIMESTAMP (buffer) = clip_start;
if (GST_BUFFER_DURATION_IS_VALID (buffer)) if (GST_BUFFER_DURATION_IS_VALID (buffer))

View file

@ -894,7 +894,7 @@ GST_START_TEST (test_video_waits_for_text)
fail_unless_equals_int (g_list_length (buffers), 1); fail_unless_equals_int (g_list_length (buffers), 1);
/* text should still be stuck in textoverlay */ /* text should still be stuck in textoverlay */
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2); ASSERT_MINI_OBJECT_REFCOUNT (gst_buffer_peek_memory (tbuf, 0), "tbuf-mem", 2);
/* there should be no text rendered */ /* there should be no text rendered */
outbuffer = GST_BUFFER_CAST (buffers->data); outbuffer = GST_BUFFER_CAST (buffers->data);
@ -917,7 +917,7 @@ GST_START_TEST (test_video_waits_for_text)
fail_unless_equals_int (g_list_length (buffers), 2); fail_unless_equals_int (g_list_length (buffers), 2);
/* text should still be stuck in textoverlay */ /* text should still be stuck in textoverlay */
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2); ASSERT_MINI_OBJECT_REFCOUNT (gst_buffer_peek_memory (tbuf, 0), "tbuf-mem", 2);
/* there should be text rendered */ /* there should be text rendered */
outbuffer = GST_BUFFER_CAST (buffers->next->data); outbuffer = GST_BUFFER_CAST (buffers->next->data);
@ -945,7 +945,7 @@ GST_START_TEST (test_video_waits_for_text)
fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK); fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
/* but the text should no longer be stuck in textoverlay */ /* but the text should no longer be stuck in textoverlay */
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 1); ASSERT_MINI_OBJECT_REFCOUNT (gst_buffer_peek_memory (tbuf, 0), "tbuf-mem", 1);
/* video buffer should have gone through after newsegment event */ /* video buffer should have gone through after newsegment event */
fail_unless_equals_int (g_list_length (buffers), 3); fail_unless_equals_int (g_list_length (buffers), 3);