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

Track recordings #180

Merged
merged 2 commits into from
Jan 13, 2025
Merged

Track recordings #180

merged 2 commits into from
Jan 13, 2025

Conversation

sgfn
Copy link
Member

@sgfn sgfn commented Dec 18, 2024

No description provided.

@sgfn sgfn requested a review from mickel8 December 18, 2024 14:58
Comment on lines 65 to 72
# XXX need?
try do
GenServer.call(recorder, {:add_tracks, tracks})
catch
_exit_or_error, _e ->
Logger.error("Recorder is down, not adding tracks")
:error
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up for discussion whether this try block should go here

I don't think this is the correct place for it, I'd put it in Broadcaster logic instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same problem some time ago - link 🙄

IMO, we can remove try catch for now. I don't know how someone could handle the error as it is related to this specific track, not the process of recording as a whole.

Recorder is also assumed to be alive all the time so if it is not, then something bad happened and it might be better for the caller to just crash.

And we can always go back to try catch if we find it useful in the future.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 98 lines in your changes missing coverage. Please review.

Project coverage is 84.64%. Comparing base (2ef1582) to head (2d8b67e).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
lib/ex_webrtc/recorder/converter.ex 0.00% 54 Missing ⚠️
lib/ex_webrtc/recorder.ex 0.00% 44 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #180      +/-   ##
==========================================
- Coverage   87.81%   84.64%   -3.17%     
==========================================
  Files          47       49       +2     
  Lines        2371     2469      +98     
==========================================
+ Hits         2082     2090       +8     
- Misses        289      379      +90     
Files with missing lines Coverage Δ
lib/ex_webrtc/media/opus.ex 41.66% <ø> (ø)
lib/ex_webrtc/recorder.ex 0.00% <0.00%> (ø)
lib/ex_webrtc/recorder/converter.ex 0.00% <0.00%> (ø)

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

Copy link
Member

@mickel8 mickel8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice and concise code!

There are two blocking comments - about using time for dir names, and taking base dir path as an argument in the converter

lib/ex_webrtc/recorder.ex Outdated Show resolved Hide resolved
lib/ex_webrtc/recorder.ex Outdated Show resolved Hide resolved
Comment on lines 65 to 72
# XXX need?
try do
GenServer.call(recorder, {:add_tracks, tracks})
catch
_exit_or_error, _e ->
Logger.error("Recorder is down, not adding tracks")
:error
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same problem some time ago - link 🙄

IMO, we can remove try catch for now. I don't know how someone could handle the error as it is related to this specific track, not the process of recording as a whole.

Recorder is also assumed to be alive all the time so if it is not, then something bad happened and it might be better for the caller to just crash.

And we can always go back to try catch if we find it useful in the future.

lib/ex_webrtc/recorder/converter.ex Outdated Show resolved Hide resolved
lib/ex_webrtc/recorder/converter.ex Outdated Show resolved Hide resolved
{:ok, store} ->
store

{:error, :late_packet} ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, this should only happen when a recording starts with out-of-order packets, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe that's correct

Comment on lines +47 to +55
report_path =
report_path
|> Path.expand()
|> then(
&if(File.dir?(&1),
do: Path.join(&1, "report.json"),
else: &1
)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should take a path to the base dir and process all subdirectories. Not necessarily in this PR but in general. Optionally, we can allow to pass an option to process a single dir.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I'd leave it for when we need to use the Converter somewhere (e.g in our demo)

@sgfn sgfn requested a review from mickel8 January 10, 2025 14:55
@sgfn sgfn merged commit e0ff731 into master Jan 13, 2025
3 checks passed
@sgfn sgfn deleted the sgfn/rtp-rec branch January 13, 2025 10:32
mickel8 pushed a commit that referenced this pull request Jan 15, 2025
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.

2 participants