-
Notifications
You must be signed in to change notification settings - Fork 14
First iteration of RTSP endpoint functionality #251
First iteration of RTSP endpoint functionality #251
Conversation
9573eed
to
7ea7752
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coud you please rebase branches at first so that there are only your changes?
88714ef
to
02faf14
Compare
ec5c27c
to
d815eb3
Compare
02faf14
to
1214f75
Compare
Rebased. Sorry for the inconvenience |
Codecov Report
@@ Coverage Diff @@
## sgfn/RTC-145-rtsp-endpoint #251 +/- ##
=============================================================
Coverage ? 60.13%
=============================================================
Files ? 41
Lines ? 1994
Branches ? 0
=============================================================
Hits ? 1199
Misses ? 795
Partials ? 0 Continue to review full report in Codecov by Sentry.
|
Fixes:
|
@mickel8 is currently unavailable; everything outlined by him in the review has been fixed
{:ok, keep_alive} = | ||
Task.start(fn -> | ||
rtsp_keep_alive(rtsp_session) | ||
end) | ||
|
||
Process.monitor(keep_alive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I don't think this should be a task. I don't think it has any serious implications, but just looks weird and is very much against what is said about Tasks in the documentation https://hexdocs.pm/elixir/1.12/Task.html
- Does it even need to be another process? I think you could use
Process.send_after
here instead of spawning another process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a leftover from the original ConnectionManager used in rtsp_to_hls demo -- I didn't touch the parts that worked, but ofc can take a shot at refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see why this was done as a separate process. It's problematic because it executes RTSP.get_parameter
, which is a call -- so, worst case scenario (connection loss), ConnectionManager is blocked for 5 seconds, after which it crashes
14:28:27.593 [error] GenServer #PID<0.2841.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2842.0>, {:execute, %Membrane.RTSP.Request{method: "GET_PARAMETER", path: nil, headers: [], body: ""}}, 5000)
** (EXIT) time out
(elixir 1.14.2) lib/gen_server.ex:1038: GenServer.call/3
[...]
The way I see it, if we don't use a separate process, we either have to change the implementation of membrane_rtsp
, rescue or let it crash. If we rescue and handle, ConnectionManager will still block for 5 secs, which right now isn't a big issue, but could become one in the future. If we let it crash, we'll be unable to directly inform Engine's parent about the reason -- no way to send :disconnected
message. Of course, further changes could be made to handle ConnectionManager crashing... etc etc.
I'm not a big fan of either of these solutions, tbh. I would propose instead to either leave the task as-is, or create another GenServer module which will be responsible solely for the keep-alives, and thus free to crash at will. Is that an option you'd be alright with?
|
||
Process.monitor(keep_alive) | ||
{keep_alive, _ref} = | ||
Process.spawn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's perfectly okay, but I think you would expect to see spawn_monitor/1
here instead of Process.spawn/2
* Copy ConnectionManager over from RTSP to HLS demo * First iteration of RTSP endpoint * lint * attempt fix tests * Fixes after review * More fixes * Fix call to get_required_deps when endpoint module not defined * Fix crash on unrecognised RTP mapping * Bump membrane_rtsp to 0.3.1 * RTSP.PortAllocator first iteration * Remove PortAllocator, add reconnects, tests, fix things * Fixes after review * Fix plugin version in docs * Make FakeRTSPserver more sophisticated * lint * minor fix
* Copy ConnectionManager over from RTSP to HLS demo * First iteration of RTSP endpoint * lint * attempt fix tests * Fixes after review * More fixes * Fix call to get_required_deps when endpoint module not defined * Fix crash on unrecognised RTP mapping * Bump membrane_rtsp to 0.3.1 * RTSP.PortAllocator first iteration * Remove PortAllocator, add reconnects, tests, fix things * Fixes after review * Fix plugin version in docs * Make FakeRTSPserver more sophisticated * lint * minor fix
* Add basic RTSP endpoint API * Fixes after review * Lint fix * RTSP endpoint (#251) * Copy ConnectionManager over from RTSP to HLS demo * First iteration of RTSP endpoint * lint * attempt fix tests * Fixes after review * More fixes * Fix call to get_required_deps when endpoint module not defined * Fix crash on unrecognised RTP mapping * Bump membrane_rtsp to 0.3.1 * RTSP.PortAllocator first iteration * Remove PortAllocator, add reconnects, tests, fix things * Fixes after review * Fix plugin version in docs * Make FakeRTSPserver more sophisticated * lint * minor fix * Fix nondeterministic tests * Fixes after review * more fixes * rtsp control path fix * second rtp stream fix
No description provided.