[FFmpeg-devel] [PATCH 2/3] mpegts: only emit new packets if data buffer exists

Marton Balint cus at passwd.hu
Fri May 2 13:41:34 CEST 2014


I don't think this can acutally happen in the current code, but better safe
than sorry.

Fixes Coverity CID 732217.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/mpegts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 20bed02..001f93b 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1125,8 +1125,6 @@ skip:
                 }
                 memcpy(pes->buffer->data + pes->data_index, p, buf_size);
                 pes->data_index += buf_size;
-            }
-            buf_size = 0;
             /* emit complete packets with known packet size
              * decreases demuxer delay for infrequent packets like subtitles from
              * a couple of seconds to milliseconds for properly muxed files.
@@ -1137,6 +1135,8 @@ skip:
                 ts->stop_parse = 1;
                 new_pes_packet(pes, ts->pkt);
             }
+            }
+            buf_size = 0;
             break;
         case MPEGTS_SKIP:
             buf_size = 0;
-- 
1.8.4.5



More information about the ffmpeg-devel mailing list