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

Respect the direction set in a template stream #618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx,
*/
stream = srtp_get_stream(ctx, hdr->ssrc);
if (stream == NULL) {
if (ctx->stream_template != NULL) {
if ((ctx->stream_template != NULL) && (ctx->stream_template->direction != dir_srtp_receiver)) {
srtp_stream_ctx_t *new_stream;

/* allocate and initialize a new stream */
Expand Down Expand Up @@ -2465,6 +2465,10 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx,
stream = srtp_get_stream(ctx, hdr->ssrc);
if (stream == NULL) {
if (ctx->stream_template != NULL) {
if (ctx->stream_template->direction == dir_srtp_sender) {
return srtp_err_status_no_ctx;
}

stream = ctx->stream_template;
debug_print(mod_srtp, "using provisional stream (SSRC: 0x%08x)",
ntohl(hdr->ssrc));
Expand Down