Commit 0e62a060 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

qtmux: Fix some memory leaks related to timecode tracks

parent 4335c4c1
......@@ -565,6 +565,14 @@ sample_entry_tmcd_new (void)
return tmcd;
}
static void
sample_entry_tmcd_free (SampleTableEntryTMCD * tmcd)
{
atom_sample_entry_free (&tmcd->se);
g_free (tmcd->name.name);
g_free (tmcd);
}
static void
sample_entry_mp4v_init (SampleTableEntryMP4V * mp4v, AtomsContext * context)
{
......@@ -674,6 +682,9 @@ atom_stsd_remove_entries (AtomSTSD * stsd)
case SUBTITLE:
sample_entry_tx3g_free ((SampleTableEntryTX3G *) se);
break;
case TIMECODE:
sample_entry_tmcd_free ((SampleTableEntryTMCD *) se);
break;
default:
/* best possible cleanup */
atom_sample_entry_free (se);
......@@ -3777,6 +3788,7 @@ atom_trak_add_timecode_entry (AtomTRAK * trak, AtomsContext * context,
trak->mdia.hdlr.component_type = FOURCC_mhlr;
trak->mdia.hdlr.handler_type = FOURCC_tmcd;
g_free (trak->mdia.hdlr.name);
trak->mdia.hdlr.name = g_strdup ("Time Code Media Handler");
trak->mdia.mdhd.time_info.timescale = tc->config.fps_n / tc->config.fps_d;
......
......@@ -518,7 +518,6 @@ gst_qt_mux_pad_reset (GstQTPad * qtpad)
qtpad->total_duration = 0;
qtpad->total_bytes = 0;
qtpad->sparse = FALSE;
qtpad->tc_trak = NULL;
qtpad->buf_head = 0;
qtpad->buf_tail = 0;
......@@ -532,6 +531,7 @@ gst_qt_mux_pad_reset (GstQTPad * qtpad)
/* reference owned elsewhere */
qtpad->trak = NULL;
qtpad->tc_trak = NULL;
if (qtpad->traf) {
atom_traf_free (qtpad->traf);
......@@ -624,6 +624,9 @@ gst_qt_mux_reset (GstQTMux * qtmux, gboolean alloc)
qtmux->reserved_duration_remaining = GST_CLOCK_TIME_NONE;
qtmux->first_pts = GST_CLOCK_TIME_NONE;
qtmux->tc_pos = -1;
if (qtmux->first_tc)
gst_video_time_code_free (qtmux->first_tc);
qtmux->first_tc = NULL;
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment