pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.
Apache License 2.0
214 stars 66 forks source link

屏幕画面处于静态时,客户端无法连接 #98

Closed sunxwfirst closed 9 months ago

sunxwfirst commented 1 year ago

使用RtspServerDisplay时,设置useOpengl为false,当屏幕画面处于静态时,则客户端无法连接上。因为屏幕画面静态时,MediaCodec不再产生解码数据。

pedroSG94 commented 1 year ago

Hello,

Try to force render using this method:

displayBase?.glInterface?.setForceRender(true)

You will need to use OpenGl in the constructor because this feature need it.

sunxwfirst commented 1 year ago

在安卓盒子上使用这个库,使用useOpengl为true时,CPU占用会特别高,导致程序卡顿。

pedroSG94 commented 1 year ago

MediaProjection never create a frame if the screen is not updated (it is intentional by google not a bug, i can't do anything) so you need create a way to do it. In my library i did that method that force OpenGl to repeat frames no matter if you have new frames or not.

Other possibility is create a notification with an animation that force the screen to render continually. I have a post related to that here: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/issues/63#issuecomment-341891074

If it isn't working for you. You will need your own way to force screen render, maybe a widget, floating button animated, etc.