ffplay: fix order of operations for sdl audio open.
Fixes Ticket149 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
3419d9b891
commit
3715e67591
4
ffplay.c
4
ffplay.c
@ -2184,6 +2184,8 @@ static int stream_component_open(VideoState *is, int stream_index)
|
|||||||
if(codec->capabilities & CODEC_CAP_DR1)
|
if(codec->capabilities & CODEC_CAP_DR1)
|
||||||
avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||||
|
|
||||||
|
wanted_spec.freq = avctx->sample_rate;
|
||||||
|
wanted_spec.channels = avctx->channels;
|
||||||
if (!codec ||
|
if (!codec ||
|
||||||
avcodec_open2(avctx, codec, &opts) < 0)
|
avcodec_open2(avctx, codec, &opts) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2198,9 +2200,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
|||||||
fprintf(stderr, "Invalid sample rate or channel count\n");
|
fprintf(stderr, "Invalid sample rate or channel count\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
wanted_spec.freq = avctx->sample_rate;
|
|
||||||
wanted_spec.format = AUDIO_S16SYS;
|
wanted_spec.format = AUDIO_S16SYS;
|
||||||
wanted_spec.channels = avctx->channels;
|
|
||||||
wanted_spec.silence = 0;
|
wanted_spec.silence = 0;
|
||||||
wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
|
wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
|
||||||
wanted_spec.callback = sdl_audio_callback;
|
wanted_spec.callback = sdl_audio_callback;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user