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

RTP input #50

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

RTP input #50

wants to merge 28 commits into from

Conversation

Noarkhh
Copy link
Contributor

@Noarkhh Noarkhh commented Nov 28, 2024

No description provided.

@Noarkhh Noarkhh changed the title Rtp input RTP input Nov 28, 2024
@Noarkhh Noarkhh requested a review from mat-hek November 28, 2024 17:25
@Noarkhh Noarkhh marked this pull request as draft December 3, 2024 11:10
@Noarkhh Noarkhh force-pushed the rtp-input branch 2 times, most recently from a417940 to 94f4cc9 Compare December 5, 2024 17:08
@Noarkhh Noarkhh marked this pull request as ready for review December 5, 2024 19:33
Copy link
Member

@mat-hek mat-hek left a comment

Choose a reason for hiding this comment

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

let's add some tests too ;)

Comment on lines 94 to 98
if state.track_builders == nil do
%{state | track_builders: %{media_type => spec}}
else
Bunch.Struct.put_in(state, [:track_builders, media_type], spec)
end
Copy link
Member

Choose a reason for hiding this comment

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

Endpoints shouldn't modify the boombox state, otherwise we get a spaghetti. If you need to keep some state, add rtp_state field to the boombox state and use that.

"""
@type rtp_encoding_specific_params ::
{:AAC, [bitrate_mode: RTP.AAC.Utils.mode(), audio_specific_config: binary()]}
| {:H264, [ppss: [binary()], spss: [binary()]]}
Copy link
Member

Choose a reason for hiding this comment

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

  • it would be nice if we could pass binaries encoded in HEX/base64 via cmdline, I think FFmpeg allows it too
  • How about H265 and Opus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could have some default mapping between cli and elixir apis when it comes to binaries, like base64 <-> binary?

Copy link
Member

Choose a reason for hiding this comment

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

yup, good idea, it can be a separate task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add Opus, but we don't have a rtp_h265_plugin

Copy link
Member

Choose a reason for hiding this comment

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

mix.exs Outdated
Comment on lines 62 to 65
{:membrane_rtp_plugin,
github: "membraneframework/membrane_rtp_plugin", branch: "rtp-demuxer", override: true},
{:membrane_rtp_format,
github: "membraneframework/membrane_rtp_format", branch: "resolve-function", override: true},
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we also add codec-specific plugins?

Copy link
Member

@mat-hek mat-hek left a comment

Choose a reason for hiding this comment

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

  • tests still missing ;)
  • update readme
  • add examples

@Noarkhh
Copy link
Contributor Author

Noarkhh commented Dec 13, 2024

Whoops didn't mean to ask for a rereview just yet, sry

@Noarkhh
Copy link
Contributor Author

Noarkhh commented Dec 19, 2024

A test will be added in #51

@Noarkhh Noarkhh requested a review from mat-hek December 19, 2024 10:46
Comment on lines 61 to 62
:H265 ->
{Membrane.RTP.H265.Depayloader, Membrane.H265.Parser}
Copy link
Member

Choose a reason for hiding this comment

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

h265 also has spss and ppss

end)

if opts[:track_configs] == [] do
raise "No media configured"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
raise "No media configured"
raise "No RTP media configured"

t =
Task.async(fn ->
Boombox.run(
input: {:rtp, port: rtp_port, track_configs: [audio: [encoding: :OPUS], video: [encoding: :H264]]},
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about making it more flat, meaning

Suggested change
input: {:rtp, port: rtp_port, track_configs: [audio: [encoding: :OPUS], video: [encoding: :H264]]},
input: {:rtp, port: rtp_port, audio_encoding: :OPUS, video_encoding: :H264},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it would work for this specific case, but not if we want to pass clock rate or payload type

Copy link
Member

Choose a reason for hiding this comment

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

audio_clock_rate, video_payload_type etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe something like

input: {:rtp, port: rtp_port, audio_config: [encoding: :OPUS], video_config: [encoding: :H264]}

would be a good middleground

Copy link
Member

Choose a reason for hiding this comment

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

Not sure how it would look like in the CLI interface

Copy link
Contributor Author

@Noarkhh Noarkhh Dec 19, 2024

Choose a reason for hiding this comment

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

and how would the least nested option look?

-i --rtp --port 1234 --audio_encoding OPUS --video_encoding H264

?

Copy link
Member

Choose a reason for hiding this comment

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

yup

Copy link
Contributor Author

@Noarkhh Noarkhh Dec 19, 2024

Choose a reason for hiding this comment

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

yeah, I don't think any nesting is feasible in CLI when using only -- args, but in Elixir API I think it adds clarity. I guess these are possible approaches that occur to me:

  • the "flat" version - nicer CLI, not so nice Elixir API
  • the single nest version - nicer Elixir API, would require us to rethink the CLI
  • both - have both versions be available, allow for both audio_clock_rate: 48_000 and audio_config: [clock_rate: 48_000]. This creates a bit of ambiguity, but could be reasonable.

what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I'd go for the flat version and I'm definitely against having both versions at once :P If we go for a nested version, I guess we should rethink the whole API, for example https://github.com/membraneframework/boombox/blob/master/lib/boombox.ex#L12

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