# WebRTC Media stream with MLCamera

**URL:** <https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292>\
**Category:** Unity Development\
**Created:** [March 3, 2025, 11:21pm UTC](https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292 "2025-03-03T23:21:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![inz.ece](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@inz.ece](https://forum.magicleap.cloud/u/inz.ece)\
**Post date:** [March 3, 2025, 11:21pm UTC](https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292/1 "2025-03-03T23:21:47Z")

</div>

Hi,

Currently I can send 5-7 frames from the magic leap 2 then froze with the error

org.webrtc.Logging: HardwareVideoEncoder: Dropped frame, encoder queue full

Any suggestion on how to prevent error like this?

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [March 4, 2025, 5:24pm UTC](https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292/2 "2025-03-04T17:24:38Z")

</div>

Hi @inz.ece,

This issue typically occurs when the Video Encoder is overloaded with tasks or is lagging behind.

Firstly, make sure that you are using the latest version of WebRTC.

Next, I would try to adjust the encoder settings to perhaps reduce the workload. You can try several things like changing the bitrate, resolution, or frame rate.

If these do not fix your issue, I would try to check other parts of your app to see if they are taking up a lot of resources that may be holding up your video encoder.

Best of luck and let me know if I can provide further assistance.

---

<div class="post-metadata">

**Author:** ![inz.ece](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@inz.ece](https://forum.magicleap.cloud/u/inz.ece)\
**Post date:** [March 6, 2025, 12:58am UTC](https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292/3 "2025-03-06T00:58:05Z")

</div>

Hi I found this github issue similar problem: [[REQUEST]: Android x86\_64 support · Issue #802 · Unity-Technologies/com.unity.webrtc · GitHub](https://github.com/Unity-Technologies/com.unity.webrtc/issues/802#issuecomment-1746468469)

I think it’s happening because Magic Leap 2 and H264 encoding doesn’t go along? I even tried H265 and instantly encoder queue full.

@etucker, I wonder if there’s anything else I can do in the Unity and Magic Leap 2 side, since my receiving end doesn’t have a VP8depacketizer.

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [March 8, 2025, 3:47pm UTC](https://forum.magicleap.cloud/t/webrtc-media-stream-with-mlcamera/5292/4 "2025-03-08T15:47:26Z")

</div>

I’m not sure about the issue with the H264 encoder being an issue. You can test the following example that uses Unity WebRTC and Magic Leap 2:

> **[GitHub - magicleap/MagicLeap2UnityWebRTCExample: Unity Project that demonstrates how to implement...](https://github.com/magicleap/MagicLeap2UnityWebRTCExample)**
>
> Unity Project that demonstrates how to implement WebRTC functionality in Unity to stream a Render Texture between a Magic Leap 2 device and a PC. This simplified example serves as a starting point for developers who are migrating from the legacy MLWebRTC APIs.
