[gst-cvs] gst-plugins-bad: mpegtsparse: use fixed size array rather than dynamically allocating

Zaheer Abbas Merali zaheer at kemper.freedesktop.org
Sun Sep 20 07:32:24 PDT 2009


Module: gst-plugins-bad
Branch: master
Commit: ae75b6f3666512887ae526f16a1ad41bbf2517ac
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=ae75b6f3666512887ae526f16a1ad41bbf2517ac

Author: Zaheer Abbas Merali <zaheerabbas at merali.org>
Date:   Sun Sep 20 15:30:59 2009 +0100

mpegtsparse: use fixed size array rather than dynamically allocating

---

 gst/mpegdemux/mpegtspacketizer.c |    3 +--
 gst/mpegdemux/mpegtspacketizer.h |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c
index 53fe8f2..9de766e 100644
--- a/gst/mpegdemux/mpegtspacketizer.c
+++ b/gst/mpegdemux/mpegtspacketizer.c
@@ -155,7 +155,7 @@ static void
 mpegts_packetizer_init (MpegTSPacketizer * packetizer)
 {
   packetizer->adapter = gst_adapter_new ();
-  packetizer->streams = g_new0 (MpegTSPacketizerStream *, 8192);
+  memset (packetizer->streams, 0, 8192);
   packetizer->know_packet_size = FALSE;
 }
 
@@ -176,7 +176,6 @@ mpegts_packetizer_dispose (GObject * object)
         if (packetizer->streams[i])
           mpegts_packetizer_stream_free (packetizer->streams[i]);
       }
-      g_free (packetizer->streams);
     }
 
     gst_adapter_clear (packetizer->adapter);
diff --git a/gst/mpegdemux/mpegtspacketizer.h b/gst/mpegdemux/mpegtspacketizer.h
index 1f82848..764dc01 100644
--- a/gst/mpegdemux/mpegtspacketizer.h
+++ b/gst/mpegdemux/mpegtspacketizer.h
@@ -67,7 +67,7 @@ struct _MpegTSPacketizer {
 
   GstAdapter *adapter;
   /* streams hashed by pid */
-  MpegTSPacketizerStream **streams;
+  MpegTSPacketizerStream *streams[8192];
   gboolean disposed;
   gboolean know_packet_size;
   guint16 packet_size;





More information about the Gstreamer-commits mailing list