[vlc-devel] [PATCH 3/4] mediacodec: fix GetOutput timeout

Martin Storsjö martin at martin.st
Wed Oct 29 19:08:04 CET 2014


On Wed, 29 Oct 2014, Thomas Guillem wrote:

>
> On Wed, Oct 29, 2014, at 18:22, Martin Storsjö wrote:
>> On Wed, 29 Oct 2014, Thomas Guillem wrote:
>> 
>> > ---
>> > modules/codec/omxil/android_mediacodec.c | 2 ++
>> > 1 file changed, 2 insertions(+)
>> >
>> > diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
>> > index 8507ebc..e352266 100644
>> > --- a/modules/codec/omxil/android_mediacodec.c
>> > +++ b/modules/codec/omxil/android_mediacodec.c
>> > @@ -738,6 +738,8 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
>> >             (*env)->ExceptionClear(env);
>> >             return -1;
>> >         }
>> > +        // timeout is only for the first try
>> > +        timeout = 0;
>> >
>> >         if (index >= 0) {
>> >             if (!p_sys->pixel_format) {
>> > -- 
>> > 2.1.0
>> 
>> Umm.. maybe? The commit message is a bit too terse, the change might be 
>> right but I'm missing the explanation on why and in which case it
>> matters.
>
> Ah yes. You can pass a timeout to GetOutput, that will pass it to the
> dequeue function.
> The dequeue can return an event instead of a buffer. If GetOutput handle
> it, it'll call again the dequeue function with the same timeout. In that
> case, we wait 2 x timeout.

Yeah, but I don't think that's too much of an issue - we only set a 
nonzero timeout when we didn't get any input buffer, so we really want to 
block waiting for something "useful". OTOH setting it to zero shouldn't 
hurt more than another round of waiting for input/output buffers...

> I'll redo the commit log & comments if you agree with this commit.
>
> (But finally, I decided to use a timeout of 0 in the next commit)

Well if you choose to never pass any non-zero timeout in the threaded 
setup, I guess it's simpler to just skip this patch?

// Martin


More information about the vlc-devel mailing list