[FFmpeg-cvslog] rtpenc: Avoid brittle switch fallthroughs

Martin Storsjö git at videolan.org
Fri Dec 19 02:48:15 CET 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Dec 18 12:20:11 2014 +0200| [adc214e6797750285a5e62634b8521db521162ad] | committer: Martin Storsjö

rtpenc: Avoid brittle switch fallthroughs

Instead explicitly jump to the default case in the cases where
it is wanted, and avoid fallthrough between different codecs,
which could easily introduce bugs if people editing the code
aren't careful.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adc214e6797750285a5e62634b8521db521162ad
---

 libavformat/rtpenc.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index dafe3a0..e5dc805 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -255,8 +255,11 @@ static int rtp_write_header(AVFormatContext *s1)
             av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
             goto fail;
         }
+        s->num_frames = 0;
+        goto defaultcase;
     case AV_CODEC_ID_AAC:
         s->num_frames = 0;
+        goto defaultcase;
     default:
 defaultcase:
         if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {



More information about the ffmpeg-cvslog mailing list