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

Support various video codecs in source #11

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

Conversation

FelonEkonom
Copy link
Member

Continuation #9 but in source

@FelonEkonom FelonEkonom marked this pull request as ready for review October 25, 2024 14:36
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.

Please add some tests receiving negotiated_video_codec and new_track notifications and checking if they're correct

By default only `:vp8`.
"""
],
suggested_video_codec: [
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
suggested_video_codec: [
preferred_video_codec: [

spec: :vp8 | :h264 | [:vp8 | :h264],
default: :vp8,
description: """
Specyfies, which video codecs can be accepted by source during the SDP
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
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

Comment on lines 65 to 66
Usage of this option makes sense only if option `:allowed_video_codecs`
is set to `[:vp8, :h264]` or `[:h264, :vp8]`.
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
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.

Comment on lines 204 to 227
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}}
Copy link
Member

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

@FelonEkonom FelonEkonom force-pushed the support-various-video-codecs-in-source branch from 77d97ff to 90e7f31 Compare November 6, 2024 12:58
@FelonEkonom FelonEkonom self-assigned this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants