[FFmpeg-devel] [PATCH] libavformat/mpegts.c minor crash and warning avoidance

Glenn A. Serre gaserre
Tue May 22 07:04:59 CEST 2007


Good evening,

This patch would be to avoid a compiler warning and avoid a crash that 
happened when I experimented with having mpegts add streams from all the 
PMTs in the transport stream, rather than just from the first one found.

Please note that I can't actually check this in (or at least I shouldn't 
  be able to).  Also, please note that the revision number below is 
against our repository, not the official ffmpeg one.

Index: libavformat/mpegts.c
===================================================================
--- libavformat/mpegts.c	(revision 19)
+++ libavformat/mpegts.c	(working copy)
@@ -397,7 +397,7 @@
      int program_info_length, pcr_pid, pid, stream_type;
      int desc_list_len, desc_len, desc_tag;
      int comp_page = 0, anc_page = 0; /* initialize to kill warnings */
-    char language[4];
+    char language[4] = {0}; /* initialize to kill warnings */

  #ifdef DEBUG_SI
      av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len);
@@ -877,7 +877,7 @@
              }
              if (len > 0) {
                  AVPacket *pkt = ts->pkt;
-                if (pes->st && av_new_packet(pkt, len) == 0) {
+                if (pkt && pes->st && av_new_packet(pkt, len) == 0) {
                      memcpy(pkt->data, p, len);
                      pkt->stream_index = pes->st->index;
                      pkt->pts = pes->pts;

Thanks,
--Glenn S.




More information about the ffmpeg-devel mailing list