Blinking blackscreen on quality change

VLC for Android and Chrome OS specific usage questions
Nikolay
Blank Cone
Blank Cone
Posts: 10
Joined: 05 Sep 2018 15:46

Blinking blackscreen on quality change

Postby Nikolay » 05 Sep 2018 16:30

Hello,

I'm trying to play HLS video stream with VLC on Android TV. All works great but I faced with annoying black screen, that appears(about 500ms) when stream quality is switched from one to another(vout dispaly module unloads and loads again). It happens when I pass "--vout=android_display" option to LibVLC. With "--vout=gles2" no black screen, video freezes for a while and than continues playing with another quality but with gles2 vout performance is not good, HD video is freezing on complex scenes with many moving objects. So I want to ask is there a possibility to overcome this black screen on Android TV. Link to describing video file in attach.

https://drive.google.com/file/d/1hlHiJp ... sp=sharing

Thanks in advance

Nikolay
Blank Cone
Blank Cone
Posts: 10
Joined: 05 Sep 2018 15:46

Re: Blinking blackscreen on quality change

Postby Nikolay » 06 Sep 2018 16:47

Seems like android surface, associated with vout, is cleared with black color when display module is unloaded. Is there an opportunity not to clear surface on unload, but to keep previous video frame?

Nikolay
Blank Cone
Blank Cone
Posts: 10
Joined: 05 Sep 2018 15:46

Re: Blinking blackscreen on quality change

Postby Nikolay » 07 Sep 2018 15:51

Found place in source code where it happens:
https://drive.google.com/file/d/1QwHiIn ... sp=sharing
It happens when AMediaCodec_stop is called. So it's platform-dependent behaviour. But can be there another solution to avoid blackscreen, for e.g. not to unload display module on stream quality change?

Nikolay
Blank Cone
Blank Cone
Posts: 10
Joined: 05 Sep 2018 15:46

Re: Blinking blackscreen on quality change

Postby Nikolay » 27 Sep 2018 10:22

Problem solved. vlc/modules/video_output/android/display.c:

Code: Select all

static void Close(vlc_object_t *p_this) { .... if (sys->p_window) { /* if (sys->b_displayed) ClearSurface(vd); */ AndroidWindow_Destroy(vd, sys->p_window); } .... }
But surface have to be cleared manually in this case, for ex. in Java part:

Code: Select all

Canvas canvas = mSurfaceHolder.lockCanvas(); canvas.drawColor(Color.BLACK, PorterDuff.Mode.CLEAR); mSurfaceHolder.unlockCanvasAndPost(canvas);

Nikolay
Blank Cone
Blank Cone
Posts: 10
Joined: 05 Sep 2018 15:46

Re: Blinking blackscreen on quality change

Postby Nikolay » 27 Sep 2018 10:40

Unfortunately it works only for mobile, not for Android TV. Because of different behaviour of AMediaCodec::stop: vlc/modules/codec/omxil/mediacodec_ndk.c

Code: Select all

static int Stop(mc_api *api) { .... if (p_sys->p_codec) { if (api->b_started) { syms.AMediaCodec.stop(p_sys->p_codec); api->b_started = false; } .... } .... }
On mobile devices this method doesn't clear surface, but in case of Android TV it does. Can someone explain this different behaviour?


Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: No registered users and 3 guests