How can I limit the memory use by webrtc in iOS broadcast extension.

1,376 views
Skip to first unread message

灰机

unread,
Dec 4, 2018, 11:29:58 PM12/4/18
to discuss-webrtc
When I use the broadcast extension to share the screen. It will crash soon because of memory leak. So how I can control the memory use in webrtc. I use the branch_72 version SDK.

Kári Helgason

unread,
Dec 5, 2018, 3:35:45 AM12/5/18
to discuss-webrtc
Make sure you are using hardware codecs (H264 on iOS), that keeps the memory usage down.

The memory limits of an extension are very tight, and hard to fit things like streaming video in there, however the broadcast extension works in the context of AppRTCMobile, you just have to make sure that your app doesn't add too much memory use on top.

On Wed, Dec 5, 2018 at 5:30 AM 灰机 <sta...@gmail.com> wrote:
When I use the broadcast extension to share the screen. It will crash soon because of memory leak. So how I can control the memory use in webrtc. I use the branch_72 version SDK.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/b3bdd059-e48b-4d2c-9f39-c42b2a792612%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

灰机

unread,
Dec 5, 2018, 5:00:29 AM12/5/18
to discuss-webrtc
I have used the h264 hardware codecs.  And it can run for a long time in iPhone ( iOS 11 ) if I don't do any other operation. But if I press home button quickly. It may crash .  If I switch to iPad ( iOS 11). It seems it will crash very quickly.

So I want to know if I can release memory after encoding every CVPixelBuffer.

在 2018年12月5日星期三 UTC+8下午4:35:45,Kári Helgason写道:

灰机

unread,
Dec 6, 2018, 10:02:54 PM12/6/18
to discuss-webrtc
The memory usage easily exceeds 50MB in iPad. How could I control the memory usage to share the screen in iPad?  

在 2018年12月5日星期三 UTC+8下午12:29:58,灰机写道:
Screen Shot 2018-12-07 at 11.00.19 AM.jpg

Kári Helgason

unread,
Dec 7, 2018, 2:54:31 AM12/7/18
to discuss-webrtc
Does AppRTCMobile screensharing crash on the iPad? If no, then your app can be optimised to work as well. Try also using a lower resolution.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

灰机

unread,
Dec 8, 2018, 1:24:55 AM12/8/18
to discuss-webrtc
I have created AppRTCMobile "all.xcworkspace"  use the command below:

gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode 

I know the source code is in directory "/broadcast_extension". But I didn't find broadcast upload extension target in the AppRTCMobile project. Should I create the broadcast upload extension by myself?

在 2018年12月7日星期五 UTC+8下午3:54:31,Kári Helgason写道:

Kári Helgason

unread,
Dec 10, 2018, 4:02:00 AM12/10/18
to discuss-webrtc
Add `rtc_apprtcmobile_broadcast_extension=true` to your gn invocation.

灰机

unread,
Dec 13, 2018, 3:59:15 AM12/13/18
to discuss-webrtc
Thanks for your advice. I have added the broadcast target to the project. 

But how can I receive the broadcast stream and display it from another client?

Now, I build and run the AppRTCMobile app, and connect to a room e.g. "123456". At the same time, I join the room through another web client from https://appr.tc. The app and the web can watch each other camera video. Now I enable the broadcast extension. But the web client can't see the broadcast.

在 2018年12月10日星期一 UTC+8下午5:02:00,Kári Helgason写道:

灰机

unread,
Dec 14, 2018, 12:35:08 AM12/14/18
to discuss-webrtc
I use an iPad and iPhone enter into the same room. Sometimes when I enable iPad broadcast upload extension will crash soon. I checked the RTP packets via Wireshark, I can't find any additional RTP packets when enabled the extension broadcast upload.


在 2018年12月5日星期三 UTC+8下午12:29:58,灰机写道:
When I use the broadcast extension to share the screen. It will crash soon because of memory leak. So how I can control the memory use in webrtc. I use the branch_72 version SDK.

灰机

unread,
Dec 14, 2018, 5:28:45 AM12/14/18
to discuss-webrtc
This picture is the memory profile in iPad. Broadcast upload uses H264 HW codec(20fps & 1Mbps).  If I press the home button, it may be crash because of exceeding memory limits. So I am wondering if I can decrease the memory usage level? 


在 2018年12月5日星期三 UTC+8下午12:29:58,灰机写道:

Screen Shot 2018-12-14 at 6.21.40 PM.jpg

St.Ryder

unread,
Jun 13, 2020, 3:27:58 AM6/13/20
to discuss-webrtc
I have a similar situation. Any new information on how to limit memory use?

Lucas Antevere

unread,
May 22, 2021, 11:49:54 AM5/22/21
to discuss-webrtc
I had the same problem here, then I saw through the Xcode Memory Graph that the log logic was consuming a lot of memory and it consumption was increasing over time. 

As I wasn't using this at all, I recompiled the framework with the 'rtc_enable_protobuf=false' flag and the memory consumption stoped at ~8,5MB.

Adeel Tahir

unread,
May 25, 2021, 3:33:38 PM5/25/21
to discuss-webrtc
I have added `rtc_apprtcmobile_broadcast_extension=true` to the gn invocation and it is added to the target but when I run it, it doesn't appear in the Control Centre. I guess it isn't installing at all. What am I doing wrong ?
Reply all
Reply to author
Forward
0 new messages