feat(sdp): mirror media direction in answer#68
Open
vlxdisluv wants to merge 2 commits into
Open
Conversation
Answer now reflects the offer's direction per RFC 3264 (sendonly↔recvonly, inactive/sendrecv unchanged) instead of always emitting sendrecv. AnswerMedia takes the direction as a parameter.
dennwc
reviewed
Jun 26, 2026
|
|
||
| // AnswerMedia creates a new SDP media description for an answer. | ||
| func AnswerMedia(rtpListenerPort int, audio *AudioConfig, crypt *srtp.Profile) *sdp.MediaDescription { | ||
| func AnswerMedia(rtpListenerPort int, audio *AudioConfig, crypt *srtp.Profile, dir sdp.Direction) *sdp.MediaDescription { |
Collaborator
There was a problem hiding this comment.
Maybe also allow passing empty direction and default to sendrecv?
Contributor
Author
There was a problem hiding this comment.
Since Direction is iota+1, the zero value already represents "unset", so I'll take it by value and default 0 → sendrecv.
Collaborator
There was a problem hiding this comment.
We could pass the direction here as well for consistency. Also, allow passing empty one and default to sendrecv.
Contributor
Author
There was a problem hiding this comment.
Agreed, missed this one. Adding dir to OfferMediaWith too with the same 0 → sendrecv default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate the answer's direction by mirroring the offer per RFC 3264 §6.1
(sendonly↔recvonly, sendrecv/inactive unchanged) instead of always emitting
sendrecv. AnswerMedia now takes the direction as a parameter.
Added a table-driven test in offer_test.go covering all four directions
through Offer.Answer.
Follow-up to #67. Related to issue