Page 1 of 1

Blinking blackscreen on quality change

Posted: 05 Sep 2018 16:30
by Nikolay
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

Re: Blinking blackscreen on quality change

Posted: 06 Sep 2018 16:47
by Nikolay
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?

Re: Blinking blackscreen on quality change

Posted: 07 Sep 2018 15:51
by Nikolay
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?

Re: Blinking blackscreen on quality change

Posted: 27 Sep 2018 10:22
by Nikolay
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);

Re: Blinking blackscreen on quality change

Posted: 27 Sep 2018 10:40
by Nikolay
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?