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

[1.x][Audiobridge] Couple minor issues in "enable_mjrs" request handling #3171

Closed
RSATom opened this issue Feb 22, 2023 · 5 comments
Closed
Labels
multistream Related to Janus 1.x

Comments

@RSATom
Copy link
Contributor

RSATom commented Feb 22, 2023

First issue is very minor:

gboolean room_prev_mjrs_active = mjrs_active;
if(mjrs_active && mjrsdir) {
/* Update the path where to save the MJR files */
char *old_mjrs_dir = audiobridge->mjrs_dir;
char *new_mjrs_dir = g_strdup(json_string_value(mjrsdir));
audiobridge->mjrs_dir = new_mjrs_dir;
g_free(old_mjrs_dir);
}
if(room_prev_mjrs_active != audiobridge->mjrs) {
/* Room recording state has changed */
audiobridge->mjrs = room_prev_mjrs_active;

it looks like room_prev_mjrs_active can be removed safely and replaced directly with mjrs_active.

Second issue is almost in the same place:

if(mjrs_active && mjrsdir) {
/* Update the path where to save the MJR files */
char *old_mjrs_dir = audiobridge->mjrs_dir;
char *new_mjrs_dir = g_strdup(json_string_value(mjrsdir));
audiobridge->mjrs_dir = new_mjrs_dir;
g_free(old_mjrs_dir);
}

i.e. If incoming enable_mjrs request contains only mjrs_dir but not mjrs - dir will not be updated. And if next enable_mjrs will not contain msrs_dir but only mjrs = true, recording will start to wrong dir.

@RSATom RSATom added the multistream Related to Janus 1.x label Feb 22, 2023
@RSATom
Copy link
Contributor Author

RSATom commented Feb 22, 2023

And btw I didn't find enable_mjrs request in docs 🤔

@lminiero
Copy link
Member

And btw I didn't find enable_mjrs request in docs thinking

You should look harder, then, it is there 😝

https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_audiobridge.c#L269-L285

I'll have a look at the code with respect to your other notes. IIRC, at the time that variable was meant to detect whether there had been a change, but we may have changed the logic since the first PR.

@RSATom
Copy link
Contributor Author

RSATom commented Feb 24, 2023

You should look harder, then, it is there 😝

Oops, my fault, I think I was looking to videoroom docs 🤦‍♂️ Sorry.

@lminiero
Copy link
Member

lminiero commented Mar 6, 2023

I'll have a look at the code with respect to your other notes. IIRC, at the time that variable was meant to detect whether there had been a change, but we may have changed the logic since the first PR.

Looks like this dates back to #2674, which we used as a basis for the enable_mjrs request: as such, it's likely the same problem happens when enabling recordings in general too (and I guess in the VideoRoom as well, which also has enable_recording as part of its API). I think the main problem is that those variables with prev in the name are improperly called, and can lead to confusion: about the dir change, not sure if we should always allow it (getting rid of that extra check) or if we should only allow it either if mjr recording was active before, or if we're activating it now (which would mean extending the extra check).

lminiero added a commit that referenced this issue Mar 6, 2023

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
…(see #3171)
@lminiero
Copy link
Member

lminiero commented Mar 6, 2023

Fixed enable_mjrs in both master and 0.x, since it just updates a string. No need for now to do the same for enable_recording, since in that case that actually results in a creation of folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multistream Related to Janus 1.x
Projects
None yet
Development

No branches or pull requests

2 participants