[vlc-devel] [PATCH 3/4] video_output: try to create a decoder device even if creating the window failed

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 13 15:57:08 CET 2020


On 2020-01-13 14:56, Thomas Guillem wrote:
> 
> On Mon, Jan 13, 2020, at 13:35, Steve Lhomme wrote:
>> "In some cases (nvdec, mmal, mediacodec ?) the actual size of the video
>> to decode is known only after data have been processed, long after the
>> device is setup to use with this API. There are hacks to try to guess
>> the size early but in the end it's just a hack."
> 
> What to we do when we have a hw decoder that doesn't know its actual size but a window is required ? (vaapi).

For VDPAU it's easy, if there is no window (no size will not create any 
window) it will not create the vdpau decoder device. That's not an issue 
as it's wlays requested from lavc after the sizes are known/set.

For VAAPI if it's mistakenly called without a window, it will create a 
DRM backend for the device. That can be a problem as it's probably not 
the way it's intended to work during playback. But again it's only 
queried from lavc, once the sizes are known/set.

>>
>> This removes the need for these hacks for those using a decoder device
>> that doesn't need a window.
>>
>> On 2020-01-13 13:27, Alexandre Janniaux wrote:
>>> Hi,
>>>
>>> This looks dangerous if it is expected to have an enabled
>>> window at decoder device creation. vout_window handle
>>> values will basically be undefined without any way for the
>>> decoder device to know it. Why do you need this?
>>>
>>> Regards,
>>> --
>>> Alexandre Janniaux
>>> Videolabs
>>>
>>> On Mon, Jan 13, 2020 at 12:07:33PM +0100, Steve Lhomme wrote:
>>>> ---
>>>>    src/video_output/video_output.c | 20 +++++++++-----------
>>>>    1 file changed, 9 insertions(+), 11 deletions(-)
>>>>
>>>> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
>>>> index 5d583dbe0ca..9540707ab2b 100644
>>>> --- a/src/video_output/video_output.c
>>>> +++ b/src/video_output/video_output.c
>>>> @@ -2099,20 +2099,18 @@ vlc_decoder_device *vout_GetDevice(const vout_device_configuration_t *cfg)
>>>>        assert(cfg->fmt != NULL);
>>>>        vout_thread_sys_t *sys = cfg->vout->p;
>>>>
>>>> -    if (!VoutCheckFormat(cfg->fmt))
>>>> -        return NULL;
>>>> -
>>>> -    video_format_t original;
>>>> -    VoutFixFormat(&original, cfg->fmt);
>>>> -
>>>>        vlc_mutex_lock(&sys->window_lock);
>>>> -    int res = EnableWindowLocked(cfg->vout, &original);
>>>> -    if (res == 0 && sys->dec_device == NULL)
>>>> +    if (VoutCheckFormat(cfg->fmt))
>>>> +    {
>>>> +        video_format_t original;
>>>> +        VoutFixFormat(&original, cfg->fmt);
>>>> +
>>>> +        EnableWindowLocked(cfg->vout, &original);
>>>> +        video_format_Clean(&original);
>>>> +    }
>>>> +    if (sys->dec_device == NULL)
>>>>            sys->dec_device = vlc_decoder_device_Create(&cfg->vout->obj, sys->display_cfg.window);
>>>>        dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;
>>>>        vlc_mutex_unlock(&sys->window_lock);
>>>> -    video_format_Clean(&original);
>>>> -    if (res != 0)
>>>> -        return NULL;
>>>>        return dec_device;
>>>>    }
>>>> --
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list