pixiv / webrtc

This is a fork of WebRTC made by pixiv Inc.
https://github.com/pixiv/webrtc/blob/branch-heads/pixiv-m78/README.pixiv.md
BSD 3-Clause "New" or "Revised" License
112 stars 35 forks source link

Sharing failure due to memory exceeding 50m #25

Open huoda1237 opened 2 years ago

huoda1237 commented 2 years ago

Send audio and video at the same time. After a period of time, the memory will exceed 50m, and then sharing will stop. If I only send video but not audio, there will be no problem. How can I solve this problem?

akihikodaki commented 2 years ago

So you use it with a broadcast extension? It can easily go beyond 50MB even you only send video, depending on the content. Basically you need to implement precise controls of memory usage by restricting video bitrate. (Audio costs some memory but not that much. It ate the last chunk of memory in your case, but it is likely that the video costed the most of memory, leaving a tiny room for audio.) I don't remember the details of the bitrate control so maybe you may ask on WebRTC forum or somewhere. IIRC, it requires to modify SDP, which is quite a hacky.

huoda1237 commented 2 years ago

ok,thank you

DevMile commented 2 years ago

@huoda1237 Hi, I solved this issue with this line of code: videoSource!.adaptOutputFormat(toWidth: 600, height: 800, fps: 15) You can try to modify values per your need.

yiran1234gcz commented 1 year ago

同时发送音频和视频。一段时间后,内存会超过50m,然后就停止共享了。如果我只发视频不发音频,就没有问题。我怎么解决这个问题?

请问你是怎么在子进程推送音频的呢?

huoda1237 commented 1 year ago

你可以设置一个上限,超过上限还没发送的直接丢弃不再发送

---Original--- From: @.> Date: Fri, May 5, 2023 15:54 PM To: @.>; Cc: @.**@.>; Subject: Re: [pixiv/webrtc] Sharing failure due to memory exceeding 50m (Issue#25)

同时发送音频和视频。一段时间后,内存会超过50m,然后就停止共享了。如果我只发视频不发音频,就没有问题。我怎么解决这个问题?

请问你是怎么在子进程推送音频的呢?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>