[FFmpeg-devel] [PATCH] lavf: AVFMT_HAS_NONBLOCK flag for (de)muxers

Luca Abeni lucabe72
Fri Nov 27 15:51:52 CET 2009


Ivo wrote:
[...]
>>>      while((res = snd_pcm_writei(s->h, buf, size / s->frame_size)) < 0)
>>> { -        if (res == -EAGAIN) {
>>> +        if (res == -EAGAIN && s1->flags & AVFMT_FLAG_NONBLOCK) {
>>>
>>>              return AVERROR(EAGAIN);
>>>          }
>> Are you sure about this hunk? I would not expect alsa to return -EAGAIN
>> if the non-blocking flag has not been set previously...
> 
> I checked the Alsa API docs and -EGAIN isn't a valid return value in any 
> case:
> 
> [snd_pcm_writei()] Returns: a positive number of frames actually written 
> otherwise a negative error code 
> 
> [negative] Return values: -EBADFD, -EPIPE, -ESTRPIPE

This funny... Ok; since it is ALSA, everything is possible ;-)
Which kind of error is returned if a non-blocking write fails because the
output buffer is full?

>> Also, I think you said that the OSS driver is not honouring the NONBLOCK
>> flag... (or am I misremembering?). If this is the case, I suspect that
>> simply adding AVFMT_HAS_NONBLOCK to the oss_demuxer flags is not enough.
>> Or am I missing something?
> 
> I have checked the code and the OSS demuxer returns an empty packet 
> (pkt->size=0; pkt->pts=av_gettime();) if it's in non-blocking mode. In 
> blocking mode, it actually does the same if the select() times out.
> 
> The OSS muxer always blocks, hence I did not add the flag there.

Ah, sorry... I misunderstood some previous email.


			Thanks,
				Luca



More information about the ffmpeg-devel mailing list