mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Fix major leaks in qtwrapper audio decoders.
Free the decoder component and audiobufferlist when caps change, or when disposing element.
This commit is contained in:
parent
2e401cc71d
commit
dfa2c64bb8
1 changed files with 36 additions and 2 deletions
|
@ -303,7 +303,7 @@ write_len (guint8 * buf, int val)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
aac_parse_codec_data (GstBuffer * codec_data, guint * channels)
|
aac_parse_codec_data (GstBuffer * codec_data, gint * channels)
|
||||||
{
|
{
|
||||||
guint8 *data = GST_BUFFER_DATA (codec_data);
|
guint8 *data = GST_BUFFER_DATA (codec_data);
|
||||||
int codec_channels;
|
int codec_channels;
|
||||||
|
@ -389,6 +389,19 @@ make_aac_magic_cookie (GstBuffer * codec_data, gsize * len)
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
close_decoder (QTWrapperAudioDecoder *qtwrapper)
|
||||||
|
{
|
||||||
|
if (qtwrapper->adec) {
|
||||||
|
CloseComponent (qtwrapper->adec);
|
||||||
|
qtwrapper->adec = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qtwrapper->bufferlist) {
|
||||||
|
DestroyAudioBufferList (qtwrapper->bufferlist);
|
||||||
|
qtwrapper->bufferlist = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
|
open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
|
||||||
|
@ -410,6 +423,9 @@ open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
|
||||||
GstBuffer *codec_data = NULL;
|
GstBuffer *codec_data = NULL;
|
||||||
gboolean have_esds = FALSE;
|
gboolean have_esds = FALSE;
|
||||||
|
|
||||||
|
/* Clean up any existing decoder */
|
||||||
|
close_decoder (qtwrapper);
|
||||||
|
|
||||||
tmp = gst_caps_to_string (caps);
|
tmp = gst_caps_to_string (caps);
|
||||||
GST_LOG_OBJECT (qtwrapper, "caps: %s", tmp);
|
GST_LOG_OBJECT (qtwrapper, "caps: %s", tmp);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
@ -486,6 +502,7 @@ open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
|
||||||
if (status) {
|
if (status) {
|
||||||
GST_WARNING_OBJECT (qtwrapper,
|
GST_WARNING_OBJECT (qtwrapper,
|
||||||
"Error instantiating SCAudio component: %ld", status);
|
"Error instantiating SCAudio component: %ld", status);
|
||||||
|
qtwrapper->adec = NULL;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,6 +578,8 @@ open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
|
||||||
status);
|
status);
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (magiccookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,10 +976,25 @@ qtwrapper_audio_decoder_base_init (QTWrapperAudioDecoderClass * klass)
|
||||||
klass->componentSubType = desc.componentSubType;
|
klass->componentSubType = desc.componentSubType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void qtwrapper_audio_decoder_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
QTWrapperAudioDecoder *qtwrapper = (QTWrapperAudioDecoder *)object;
|
||||||
|
QTWrapperAudioDecoderClass *oclass = (QTWrapperAudioDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
|
||||||
|
GObjectClass *parent_class = g_type_class_peek_parent (oclass);
|
||||||
|
|
||||||
|
close_decoder (qtwrapper);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qtwrapper_audio_decoder_class_init (QTWrapperAudioDecoderClass * klass)
|
qtwrapper_audio_decoder_class_init (QTWrapperAudioDecoderClass * klass)
|
||||||
{
|
{
|
||||||
/* FIXME : don't we need some vmethod implementations here ?? */
|
GObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
|
object_class->dispose = qtwrapper_audio_decoder_dispose;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
Loading…
Reference in a new issue