-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support various video codecs in source #11
base: master
Are you sure you want to change the base?
Conversation
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.
Please add some tests receiving negotiated_video_codec and new_track notifications and checking if they're correct
lib/membrane_webrtc/source.ex
Outdated
By default only `:vp8`. | ||
""" | ||
], | ||
suggested_video_codec: [ |
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.
suggested_video_codec: [ | |
preferred_video_codec: [ |
lib/membrane_webrtc/source.ex
Outdated
spec: :vp8 | :h264 | [:vp8 | :h264], | ||
default: :vp8, | ||
description: """ | ||
Specyfies, which video codecs can be accepted by source during the SDP |
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.
Specyfies, which video codecs can be accepted by source during the SDP | |
Specifies, which video codecs can be accepted by the source during the SDP |
lib/membrane_webrtc/source.ex
Outdated
Usage of this option makes sense only if option `:allowed_video_codecs` | ||
is set to `[:vp8, :h264]` or `[:h264, :vp8]`. |
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.
Usage of this option makes sense only if option `:allowed_video_codecs` | |
is set to `[:vp8, :h264]` or `[:h264, :vp8]`. | |
Usage of this option makes sense only if there are at least 2 codecs | |
specified in the `:allowed_video_codecs` option. |
video_codecs_in_sdp = ExWebRTCUtils.get_video_codecs_from_sdp(sdp) | ||
|
||
negotiated_video_codecs = | ||
state.allowed_video_codecs | ||
|> Enum.filter(&(&1 in video_codecs_in_sdp)) | ||
|> case do | ||
[] -> [] | ||
[codec] -> [codec] | ||
_both -> [state.suggested_video_codec] | ||
end | ||
|
||
video_params = ExWebRTCUtils.codec_params(negotiated_video_codecs) | ||
|
||
{:ok, pc} = | ||
PeerConnection.start( | ||
ice_servers: state.ice_servers, | ||
video_codecs: video_params, | ||
audio_codecs: state.audio_params | ||
) | ||
|
||
Process.monitor(pc) | ||
|
||
notify_parent = [notify_parent: {:negotiated_video_codecs, negotiated_video_codecs}] | ||
{notify_parent, %{state | pc: pc, video_params: video_params}} |
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 function is now quite long, let's extract this to a private one
…eo-codecs-in-source
77d97ff
to
90e7f31
Compare
Continuation #9 but in source