camerabin examples: memory leak in camerabin examples code

should unref caps after set to profile. profile will ref it.

https://bugzilla.gnome.org/show_bug.cgi?id=744219
This commit is contained in:
Song Bing 2015-02-10 15:55:50 +08:00 committed by Thiago Santos
parent 2d0e6d96c6
commit 629b350806

View file

@ -56,16 +56,21 @@ static GstEncodingProfile *
create_ogg_profile (void) create_ogg_profile (void)
{ {
GstEncodingContainerProfile *container; GstEncodingContainerProfile *container;
GstCaps *caps = NULL;
container = gst_encoding_container_profile_new ("ogg", NULL, caps = gst_caps_new_empty_simple ("application/ogg");
gst_caps_new_empty_simple ("application/ogg"), NULL); container = gst_encoding_container_profile_new ("ogg", NULL, caps, NULL);
gst_caps_unref (caps);
caps = gst_caps_new_empty_simple ("video/x-theora");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_video_profile_new (gst_caps_new_empty_simple gst_encoding_video_profile_new (caps, NULL, NULL, 1));
("video/x-theora"), NULL, NULL, 1)); gst_caps_unref (caps);
caps = gst_caps_new_empty_simple ("audio/x-vorbis");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_audio_profile_new (gst_caps_new_empty_simple gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
("audio/x-vorbis"), NULL, NULL, 1)); gst_caps_unref (caps);
return (GstEncodingProfile *) container; return (GstEncodingProfile *) container;
} }
@ -74,16 +79,21 @@ static GstEncodingProfile *
create_webm_profile (void) create_webm_profile (void)
{ {
GstEncodingContainerProfile *container; GstEncodingContainerProfile *container;
GstCaps *caps = NULL;
container = gst_encoding_container_profile_new ("webm", NULL, caps = gst_caps_new_empty_simple ("video/webm");
gst_caps_new_empty_simple ("video/webm"), NULL); container = gst_encoding_container_profile_new ("webm", NULL, caps, NULL);
gst_caps_unref (caps);
caps = gst_caps_new_empty_simple ("video/x-vp8");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_video_profile_new (gst_caps_new_empty_simple ("video/x-vp8"), gst_encoding_video_profile_new (caps, NULL, NULL, 1));
NULL, NULL, 1)); gst_caps_unref (caps);
caps = gst_caps_new_empty_simple ("audio/x-vorbis");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_audio_profile_new (gst_caps_new_empty_simple gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
("audio/x-vorbis"), NULL, NULL, 1)); gst_caps_unref (caps);
return (GstEncodingProfile *) container; return (GstEncodingProfile *) container;
} }
@ -92,17 +102,22 @@ static GstEncodingProfile *
create_mp4_profile (void) create_mp4_profile (void)
{ {
GstEncodingContainerProfile *container; GstEncodingContainerProfile *container;
GstCaps *caps = NULL;
container = gst_encoding_container_profile_new ("mp4", NULL, caps = gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, "iso",
gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, "iso", NULL);
NULL), NULL); container = gst_encoding_container_profile_new ("mp4", NULL, caps, NULL);
gst_caps_unref (caps);
caps = gst_caps_new_empty_simple ("video/x-h264");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_video_profile_new (gst_caps_new_empty_simple gst_encoding_video_profile_new (caps, NULL, NULL, 1));
("video/x-h264"), NULL, NULL, 1)); gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/mpeg", "version", G_TYPE_INT, 4, NULL);
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *) gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_audio_profile_new (gst_caps_new_simple ("audio/mpeg", gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
"version", G_TYPE_INT, 4, NULL), NULL, NULL, 1)); gst_caps_unref (caps);
return (GstEncodingProfile *) container; return (GstEncodingProfile *) container;
} }