Ant-Media-Server icon indicating copy to clipboard operation
Ant-Media-Server copied to clipboard

WebRTC playback freezes when HLS streaming is enabled

Open mekya opened this issue 2 years ago • 6 comments

Short description

WebRTC playback freezes when HLS streaming is enabled . When I disable HLS streaming, WebRTC plays smoothly. I've mounted Azure blob storage to record to HLS streams

Steps to reproduce

  1. Install Ant Media Server on a local instance at home
  2. Connect Azure Blob storage to streams folder
  3. Enable HLS
  4. Publish video to the server
  5. Play stream with WebRTC

Expected behavior

There should not be any freeze in WebRTC playback.

Actual behavior

Time to time it freezes. If I disable HLS streaming, it plays smoothly

mekya avatar May 20 '22 12:05 mekya

Hi @mekya

There is a problem I ran into and I have an assumption.

Problem: If we add Azure Blob storage without the -o allow_other parameter while mounting, files cannot be written under the streams directory because of permissions. And this rarely spikes the CPU and creates a frame drop.

The command to be used while mounting is as follows.

blobfuse /usr/local/antmedia/webapps/WebRTCAppEE/streams/ --tmp-path=/tmp/blobfusetmp  --config-file=/root/fuse_connection.cfg -o attr_timeout=240 -o entry_timeout=240 -o allow_other -o negative_timeout=120 --file-cache-timeout-in-seconds=240

Hypothesis: A 720p video transfers average 3Mbps/upload (asynchronous) data to transfer HLS chunks to blob storage. It may even be a bandwidth related issue. After all, a structure is used in NFS logic and there is a possibility of bottleneck.

Suggestion If blob storage is mounted to the stream directory for MP4 recording, files can be transferred by using user-defined script instead.

muratugureminoglu avatar May 30 '22 09:05 muratugureminoglu

Hi @muratugureminoglu , @yashtandon113 ,@mekya,

We have actually reproduced this issue with a local hard drive. We were experiencing the same issue with a hosted VM - where our streams became very unstable - and after investigation we noticed that the issue was caused by drive speed - as soon as we swapped over to a SSD the issue was resolved.

I had a conversation with @mekya when we initially had issues and he said that the recording process needs to run in an asynchronous way so that it does not interfere with the quality of the live stream....

@mekya - do you think this might be implemented in a future release?

Thanks!

francoisdutoit avatar Jun 29 '22 05:06 francoisdutoit

Hi @francoisdutoit ,

It's great to hear from you:) Thank you for letting us know. Yes, exactly it may be something in a future release. But I cannot give an ETA for now.

Thank you

Regards, A. Oguz

mekya avatar Jun 29 '22 07:06 mekya

Thanks @mekya

Maybe you can update the Server requirements documentation for now to mention that a high speed drive / SSD is required?

francoisdutoit avatar Jun 29 '22 07:06 francoisdutoit

Yes, definitely. Thank you @francoisdutoit

mekya avatar Jul 04 '22 17:07 mekya

Added here as information: https://resources.antmedia.io/docs/installation

Thanks.

muratugureminoglu avatar Jul 18 '22 18:07 muratugureminoglu