Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MediaRelay] Add support for unbuffered to MediaRelay #498

Merged
merged 1 commit into from
Jan 24, 2022

Conversation

Laityned
Copy link
Contributor

@Laityned Laityned commented Mar 7, 2021

Support for unbuffered RelayStreamTrack, to ensure no delay between the original track and relayed track

@codecov
Copy link

codecov bot commented Mar 7, 2021

Codecov Report

Merging #498 (2bc25c6) into main (01ff209) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #498   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           31        31           
  Lines         5669      5681   +12     
=========================================
+ Hits          5669      5681   +12     
Impacted Files Coverage Δ
src/aiortc/contrib/media.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01ff209...2bc25c6. Read the comment docs.

@Laityned Laityned force-pushed the unbuffered_relay branch 4 times, most recently from 8fb4b5a to a5a599a Compare March 7, 2021 21:25
@jlaine
Copy link
Collaborator

jlaine commented Mar 8, 2021

This looks very cool, I'll take it for a spin. Could we add an explanation of the buffered argument to the doc string?

@Laityned
Copy link
Contributor Author

Laityned commented Mar 8, 2021

Added param to docstring

@Laityned Laityned changed the title Add support for unbuffered to MediaRelay [MediaRelay] Add support for unbuffered to MediaRelay Mar 11, 2021
@johnboiles
Copy link
Contributor

I tried this out with the webcam.py example but wasn't able to see a difference in video latency. Are you seeing noticeable latency introduced by the buffering in MediaRelay?

@Laityned
Copy link
Contributor Author

On a single videostream, it is not noticable. However when using a larger number of clients, you will reach a point where your asyncio event loop is slower than framerate of the camera.

Since the camera is in a seperate thread it keeps filling the buffer, while the clients suffer from a drop in framerate due to the performance issues of the asyncio event loop.

The buffer will keep increasing and could lead to a out of memory. Also since the buffer is filling at a faster rate than the frames are transmitted an increased latency will occur between the client and webcam server.

@johnboiles
Copy link
Contributor

Got it. I experimented with it a bit more and with multiple clients connected on a Pi, it would definitely start dropping frames. This means if an I-frame gets dropped, the video gets all messed up for a bit. But probably better than OOM-ing!

@jlaine jlaine merged commit 9383bf0 into aiortc:main Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants