opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
211 stars 169 forks source link

Android devices too much heating issue #389

Closed nikul014 closed 1 year ago

nikul014 commented 3 years ago

Multiparty video calls up to 4 subscribers are giving heating issues after 10-15 minutes. Same result in pixel 4a and One Plus 8T. It was serious issue in all the android devices as the application heats the devices and shutdowns the application.

heating heat

@igorwojda

adrienrx commented 3 years ago

Are you using a SurfaceView or a TextureView to render your preview ?

UrielFrankel commented 2 years ago

I changed the default config to solve this: OpenTokConfig.setPreferH264Codec(OpenTokConfig.PreferH264.ENABLE)

rituapplocum commented 2 years ago

@nikul014 How did you render subscriber name in multipart

vmeditab commented 1 year ago

Facing same issue... After 15-20 minutes joining the session, phone is getting heat.

Using below dependency,

com.opentok.android:opentok-android-sdk:2.23.1 Using below code,

Publisher.Builder(this)
            .name(getProviderJSONString())
            .resolution(Publisher.CameraCaptureResolution.MEDIUM)
            .frameRate(Publisher.CameraCaptureFrameRate.FPS_1)
            .build()
igorwojda commented 1 year ago

One for @adrienrx

adrienrx commented 1 year ago

I had that issue last year when I wanted to use TextureView in my app. Rolling it back to GLSurfaceView fixed the heating problem. You probably did the swap to TextureView for the better handling of that component of android constraint. If you are struggling with the Z order, this is the line you need ((GLSurfaceView) (publisher.getView())).setZOrderOnTop(true);

adrienrx commented 1 year ago

Note that if you are using Relayed session, the impact on your phone is higher than if you rely on routed session. Especially with 4 participants.

vmeditab commented 1 year ago

Already used below code with GlSurfaceView...

if (mPublisher?.view is GLSurfaceView) { (mPublisher?.view as GLSurfaceView).setZOrderOnTop(true) }

adrienrx commented 1 year ago

And you're not using useTextureViews is the SessionOptions right ?

vmeditab commented 1 year ago

I have a below code,

mSession = Session.Builder(this, mSTRotAPIKey, mSTRotSessionId) .sessionOptions(object : Session.SessionOptions() { override fun useTextureViews(): Boolean { return true } }) .connectionEventsSuppressed(true) .build() mSession?.setSessionListener(this) mSession?.setSignalListener(this)

@adrienrx

adrienrx commented 1 year ago

Yeah so you want to have the useTextureViews set to false to have the SDK provide GLSurfaceView

vmeditab commented 1 year ago

And what about isHwDecodingSupported and isCamera2Capable?

Will it be by default false or I have to change these methods as well?

adrienrx commented 1 year ago

I have tried to play with these in the past, my experience is, just don't play with those and leave these settings to their default value :rofl:

vmeditab commented 1 year ago

Okay one more thing I want to ask that why we can't use TextureView and why device will be get hitted if we use this?

Just ask for the knowledge..

adrienrx commented 1 year ago

I literally have no idea, it could be the way the vonage renderer is built, or the way the textureview implementation is done. But the result is that the phone gets very hot and results in angry users. So I use GLSurfaceView.

vmeditab commented 1 year ago

By using GlSurfaceView, the icons of end call and others will be covered. I can see only the view of front camera.

adrienrx commented 1 year ago

Yup, that's your new challenge now. GLSurfaceView isn't respecting the Z-Index of Android. I did struggle a bit to adapt my UI to it.

image

UrielFrankel commented 1 year ago

By using GlSurfaceView, the icons of end call and others will be covered. I can see only the view of front camera.

FWIW You can overcome it with setZOrderMediaOverlay(true).