client-sdk-android icon indicating copy to clipboard operation
client-sdk-android copied to clipboard

sometimes no participant video displayed for the new joining participant

Open tidoemanuele opened this issue 3 years ago • 10 comments

publication source: on certain devices the CAMERA track is returned as UNKNOWN Step to reproduce:

  • connect two devices (tested with huawei p40 lite and lenovo tab M10 HD) in the same room with camera ON and log the value of publication.source before the condition:
if (publication.source == Track.Source.CAMERA) {
      setupVideoIfNeeded(track, viewBinding)
} 

the latest device that join the call has no video participant track in the recyclerView

tidoemanuele avatar Feb 15 '22 14:02 tidoemanuele

which version of livekit-server are you running?

davidzhao avatar Feb 16 '22 01:02 davidzhao

I'm running the master branch for the livekit-server and the livekit-android 0.8.1.

If I run the client-sdk-android main branch I get a websocket failure: null java.io.EOFException when the second device join the room (the error appear on the second device and the first one freeze): Logcat: ┬─── │ GC Root: Input or output parameters in native code │ ├─ android.os.MessageQueue instance │ Leaking: NO (MessageQueue#mQuitting is false) │ HandlerThread: "rendererEglRenderer" │ ↓ MessageQueue[1] │ ~~~ ├─ android.os.Message instance │ Leaking: UNKNOWN │ Retaining 229,6 kB in 4489 objects │ Message.what = 0 │ Message.when = 20895880 (2225 ms after heap dump) │ Message.obj = null │ Message.callback = instance @335350640 of org.webrtc.EglRenderer$1 │ Message.target = instance @335350656 of org.webrtc. │ EglRenderer$HandlerWithExceptionCallback │ ↓ Message.callback │ ~~~~~~~~ ├─ org.webrtc.EglRenderer$1 instance │ Leaking: UNKNOWN │ Retaining 12 B in 1 objects │ Anonymous class implementing java.lang.Runnable │ ↓ EglRenderer$1.this$0 │ ~~~~~~ ├─ org.webrtc.SurfaceEglRenderer instance │ Leaking: UNKNOWN │ Retaining 229,4 kB in 4485 objects │ ↓ SurfaceEglRenderer.rendererEvents │ ~~~~~~~~~~~~~~ ├─ io.livekit.android.renderer.TextureViewRenderer instance │ Leaking: YES (View.mContext references a destroyed activity) │ Retaining 228,9 kB in 4460 objects │ View is part of a window view hierarchy │ View.mAttachInfo is null (view detached) │ View.mID = R.id.renderer │ View.mWindowAttachCount = 1 │ mContext instance of io.livekit.android.sample.CallActivity with │ mDestroyed = true │ ↓ View.mContext ╰→ io.livekit.android.sample.CallActivity instance ​ Leaking: YES (ObjectWatcher was watching this because io.livekit.android. ​ sample.CallActivity received Activity#onDestroy() callback and ​ Activity#mDestroyed is true) ​ Retaining 67,7 kB in 1445 objects ​ key = 4d2b6e4d-e8cc-4073-a2d3-e781886cead0 ​ watchDurationMillis = 201300 ​ retainedDurationMillis = 196300 ​ mApplication instance of io.livekit.android.sample.SampleApplication ​ mBase instance of androidx.appcompat.view.ContextThemeWrapper

METADATA

Build.VERSION.SDK_INT: 29 Build.MANUFACTURER: HUAWEI LeakCanary version: 2.8.1 App process name: io.livekit.android Stats: LruCache[maxSize=3000,hits=38016,misses=84505,hitRate=31%] RandomAccess[bytes=12742741,reads=84505,travel=43384899877,range=29738936,size=3 5166151] Analysis duration: 4173 ms

tidoemanuele avatar Feb 16 '22 09:02 tidoemanuele

@tidoemanuele to be clear, the TrackPublication.source is returned as Track.Source.UNKNOWN? Or does the publication not appear at all?

davidliu avatar Feb 18 '22 13:02 davidliu

is returned as Track.Source.UNKNOWN. As a workaround I fixed the problem like this: if (publication.source == Track.Source.CAMERA || publication.source == Track.Source.UNKNOWN)

tidoemanuele avatar Feb 18 '22 13:02 tidoemanuele

Are the other fields in the TrackPublication populated (e.g. dimensions, sid, name)?

davidliu avatar Feb 18 '22 13:02 davidliu

visually was everything ok inside the recyclerView items, just the video was missed. To reproduce the behavior you need to run the livekit-android 0.8.1 with two android devices. Regarding thea java.io.EOFException that I mentioned above was related with the fact that I was using the same token on both devices

tidoemanuele avatar Feb 18 '22 14:02 tidoemanuele

In the device logs, can you look for the track pubilcation? They should show up like this:

response: update {
      participants {
        sid: "PA_H8CPUWvaxhp7"
        identity: "comp"
        state: ACTIVE
        tracks {
          sid: "TR_phveRfkkaN4r"
          type: VIDEO
          width: 1280
          height: 720
          simulcast: true
          source: CAMERA
          layers {
            width: 320
            height: 180
            bitrate: 120000
            ssrc: 1275246982
          }
          layers {
            quality: MEDIUM
            width: 640
            height: 360
            bitrate: 300000
            ssrc: 1164993877
          }
          layers {
            quality: HIGH
            width: 1280
            height: 720
            bitrate: 2000000
            ssrc: 3493639813
          }
          mime_type: "video/VP8"
          mid: "0"
        }
        joined_at: 1645772619
        10: 11
      }
    }

davidliu avatar Feb 25 '22 07:02 davidliu

User reported back with some logs:

livekit server: commit c9cfb0d362d56e83c72064e5313f102bd2548de0

Track publish request:

sending request: add_track {
      cid: "1cfbde35-67b8-4af3-91b4-3bc16fbeb874"
      type: VIDEO
      width: 800
      height: 600
      source: CAMERA
      layers {
        quality: MEDIUM
        width: 800
        height: 600
        bitrate: 2000000
      }
      layers {
        width: 240
        height: 180
        bitrate: 100000
      }
    }

Received update:

SignalClient: response: update {
      participants {
        sid: "PA_WaagWKuXSggG"
        identity: "***"
        state: ACTIVE
        tracks {
          sid: "TR_S9yzGyepbP7G"
          type: VIDEO
          width: 800
          height: 600
          simulcast: true
        }
        tracks {
          sid: "TR_aHejtTLU29Jr"
        }
        joined_at: 1646148643
      }
    }

davidliu avatar Mar 02 '22 11:03 davidliu

Describe the bug Alaways Got websocket failure: null . SignalClient: websocket failure: null java.io.EOFException at okio.RealBufferedSource.require(RealBufferedSource.kt:199) at okio.RealBufferedSource.readByte(RealBufferedSource.kt:209) at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Device Info:

  • Device: [MI10I]
  • OS: [ Android 12]
  • LiveKit SDK version: [0.9.1]

Additional context Add any other context about the problem here. SignalClient: response: # livekit.LivekitRtc$SignalResponse@6eb04c77 join { ice_servers { urls: "stun:stun.l.google.com:19302" urls: "stun:stun1.l.google.com:19302" } participant { identity: "kamaltyagi" joined_at: 1662556431 sid: "PA_A6YfVumZJTGz" } room { creation_time: 1662556215 empty_timeout: 300 enabled_codecs { mime: "audio/opus" } enabled_codecs { mime: "video/VP8" } enabled_codecs { mime: "video/H264" } name: "kamaltyagi & kamaltyagi Room" sid: "RM_SXGQtA4WVDV3" turn_password: "IA0cuek3mzjwuEvmGaq97T4sFfqq1LmqXXze27TeUqeH" } server_version: "0.14.2" subscriber_primary: true } Room: Connected to server, server version: 0.14.2, client version: 0.9.1 Room: engine did disconnect: server leave Please help out me from this issue

kamaltyagi02 avatar Sep 07 '22 14:09 kamaltyagi02

@kamaltyagi02 your issue is unrelated to this one. Please open a separate issue.

davidliu avatar Sep 07 '22 16:09 davidliu

Has this issue been solved? What is the solution?

yanmihaiyi avatar Dec 14 '22 08:12 yanmihaiyi

not able to reproduce the issue anymore with the same devices. This was an error related to the livekit-android 0.8.1 version and the demo implementation. The camera in the demo with the latest sdk version is working fine

tidoemanuele avatar Dec 14 '22 13:12 tidoemanuele