[FFmpeg-devel] [PATCH 3/3] lavd/openal: return EAGAIN if no samples are available

Nicolas George george at nsup.org
Fri Sep 30 13:06:42 EEST 2016


Le nonidi 9 vendémiaire, an CCXXV, Marton Balint a écrit :
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavdevice/openal-dec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavdevice/openal-dec.c b/libavdevice/openal-dec.c
> index 0647952..8773944 100644
> --- a/libavdevice/openal-dec.c
> +++ b/libavdevice/openal-dec.c
> @@ -191,6 +191,9 @@ static int read_packet(AVFormatContext* ctx, AVPacket *pkt)
>      alcGetIntegerv(ad->device, ALC_CAPTURE_SAMPLES, (ALCsizei) sizeof(ALCint), &nb_samples);
>      if (error = al_get_error(ad->device, &error_msg)) goto fail;
>  
> +    if (nb_samples == 0)
> +        return AVERROR(EAGAIN);
> +

EAGAIN is only acceptable in non-blocking mode. You may be able to use REDO
(I do not remember the exact name), but beware you are not creating a
busy-wait loop.

Regards,

-- 
  Nicolas George


More information about the ffmpeg-devel mailing list