Fixes Ticket119
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -2158,6 +2158,10 @@ static int stream_component_open(VideoState *is, int stream_index) |
2158 | 2158 |
|
2159 | 2159 |
/* prepare audio output */ |
2160 | 2160 |
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { |
2161 |
+ if(avctx->sample_rate <= 0 || avctx->channels <= 0){ |
|
2162 |
+ fprintf(stderr, "Invalid sample rate or channel count\n"); |
|
2163 |
+ return -1; |
|
2164 |
+ } |
|
2161 | 2165 |
wanted_spec.freq = avctx->sample_rate; |
2162 | 2166 |
wanted_spec.format = AUDIO_S16SYS; |
2163 | 2167 |
wanted_spec.channels = avctx->channels; |