mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
matroskamux: don't leak ebml writer caps when re-using matroskamux
https://bugzilla.gnome.org/show_bug.cgi?id=640542
This commit is contained in:
parent
9f34b89245
commit
0add79cbf1
2 changed files with 57 additions and 0 deletions
|
@ -133,6 +133,12 @@ gst_ebml_write_reset (GstEbmlWrite * ebml)
|
|||
gst_byte_writer_free (ebml->cache);
|
||||
ebml->cache = NULL;
|
||||
}
|
||||
|
||||
if (ebml->caps) {
|
||||
gst_caps_unref (ebml->caps);
|
||||
ebml->caps = NULL;
|
||||
}
|
||||
|
||||
ebml->last_write_result = GST_FLOW_OK;
|
||||
ebml->timestamp = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
|
|
@ -387,6 +387,56 @@ GST_START_TEST (test_block_group)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_reset)
|
||||
{
|
||||
GstElement *matroskamux;
|
||||
GstBuffer *inbuffer;
|
||||
GstBuffer *outbuffer;
|
||||
int num_buffers;
|
||||
int i;
|
||||
|
||||
matroskamux = setup_matroskamux (&srcac3template);
|
||||
fail_unless (gst_element_set_state (matroskamux,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||
"could not set to playing");
|
||||
|
||||
inbuffer = gst_buffer_new_and_alloc (1);
|
||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
||||
num_buffers = g_list_length (buffers);
|
||||
fail_unless (num_buffers >= 1,
|
||||
"expected at least 1 buffer, but got only %d", num_buffers);
|
||||
|
||||
fail_unless (gst_element_set_state (matroskamux,
|
||||
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
||||
|
||||
fail_unless (gst_element_set_state (matroskamux,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||
"could not set to playing");
|
||||
|
||||
inbuffer = gst_buffer_new_and_alloc (1);
|
||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
||||
num_buffers = g_list_length (buffers);
|
||||
fail_unless (num_buffers >= 2,
|
||||
"expected at least 2 buffers, but got only %d", num_buffers);
|
||||
|
||||
for (i = 0; i < num_buffers; ++i) {
|
||||
outbuffer = GST_BUFFER (buffers->data);
|
||||
fail_if (outbuffer == NULL);
|
||||
buffers = g_list_remove (buffers, outbuffer);
|
||||
|
||||
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
|
||||
gst_buffer_unref (outbuffer);
|
||||
}
|
||||
|
||||
cleanup_matroskamux (matroskamux);
|
||||
g_list_free (buffers);
|
||||
buffers = NULL;
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
matroskamux_suite (void)
|
||||
{
|
||||
|
@ -397,6 +447,7 @@ matroskamux_suite (void)
|
|||
tcase_add_test (tc_chain, test_ebml_header);
|
||||
tcase_add_test (tc_chain, test_vorbis_header);
|
||||
tcase_add_test (tc_chain, test_block_group);
|
||||
tcase_add_test (tc_chain, test_reset);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue