[FFmpeg-cvslog] ffplay: error out with invalid sample rate or channels.

Michael Niedermayer git at videolan.org
Sat Jun 4 01:16:13 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jun  4 00:16:12 2011 +0200| [33af5335fd8e1b411bb1bdfad93b675033866c2c] | committer: Michael Niedermayer

ffplay: error out with invalid sample rate or channels.

Fixes Ticket119
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffplay.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 5997f65..4139afb 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2158,6 +2158,10 @@ static int stream_component_open(VideoState *is, int stream_index)
 
     /* prepare audio output */
     if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
+        if(avctx->sample_rate <= 0 || avctx->channels <= 0){
+            fprintf(stderr, "Invalid sample rate or channel count\n");
+            return -1;
+        }
         wanted_spec.freq = avctx->sample_rate;
         wanted_spec.format = AUDIO_S16SYS;
         wanted_spec.channels = avctx->channels;



More information about the ffmpeg-cvslog mailing list