From b8ebf3c64233c7794bf5ba5d2088e2caeebfe70c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 2 Feb 2003 20:06:39 +0000 Subject: [PATCH] Fix refcounting on streaminfo caps. Original commit message from CVS: Fix refcounting on streaminfo caps. --- gst/mpegstream/gstmpegparse.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gst/mpegstream/gstmpegparse.c b/gst/mpegstream/gstmpegparse.c index f5cdb0b056..fb9ed2d639 100644 --- a/gst/mpegstream/gstmpegparse.c +++ b/gst/mpegstream/gstmpegparse.c @@ -229,6 +229,7 @@ gst_mpeg_parse_update_streaminfo (GstMPEGParse *mpeg_parse) GstProps *props; GstPropsEntry *entry; gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize); + GstCaps *caps; props = gst_props_empty_new (); @@ -238,13 +239,11 @@ gst_mpeg_parse_update_streaminfo (GstMPEGParse *mpeg_parse) entry = gst_props_entry_new ("bitrate", GST_PROPS_INT (mpeg_parse->mux_rate * 400)); gst_props_add_entry (props, (GstPropsEntry *) entry); - if (mpeg_parse->streaminfo) - gst_caps_unref (mpeg_parse->streaminfo); - - mpeg_parse->streaminfo = gst_caps_new ("mpeg_streaminfo", - "application/x-gst-streaminfo", - props); + caps = gst_caps_new ("mpeg_streaminfo", + "application/x-gst-streaminfo", + props); + gst_caps_replace_sink (&mpeg_parse->streaminfo, caps); g_object_notify (G_OBJECT (mpeg_parse), "streaminfo"); } @@ -413,6 +412,8 @@ gst_mpeg_parse_loop (GstElement *element) GstClockTime time; data = gst_mpeg_packetize_read (mpeg_parse->packetize); + if (!data) + return; id = GST_MPEG_PACKETIZE_ID (mpeg_parse->packetize); mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize); @@ -802,6 +803,7 @@ gst_mpeg_parse_change_state (GstElement *element) gst_mpeg_packetize_destroy (mpeg_parse->packetize); mpeg_parse->packetize = NULL; } + gst_caps_replace (&mpeg_parse->streaminfo, NULL); break; default: break;