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

subProtocol has no assignment #2753

Closed
chenwenti opened this issue Aug 9, 2021 · 3 comments
Closed

subProtocol has no assignment #2753

chenwenti opened this issue Aug 9, 2021 · 3 comments

Comments

@chenwenti
Copy link

When I use DC channel to send data and want the subprotocol to be HTTP, but the subprotocol is null。I found in the function janus_ice_incoming_data There is no assignment to protocol in data。

void janus_ice_incoming_data(janus_ice_handle *handle, char *label, char *protocol, gboolean textdata, char *buffer, int length) {
	if(handle == NULL || buffer == NULL || length <= 0)
		return;
	janus_plugin_data data = { .label = label, .binary = !textdata, .buffer = buffer, .length = length };
	janus_plugin *plugin = (janus_plugin *)handle->app;
	if(plugin && plugin->incoming_data && handle->app_handle &&
			!g_atomic_int_get(&handle->app_handle->stopped) &&
			!g_atomic_int_get(&handle->destroyed))
		plugin->incoming_data(handle->app_handle, &data);
}

I changed the code and it can run normally.

janus_plugin_data data = { .label = label, .binary = !textdata, .buffer = buffer, .length = length, .protocol = protocol };

@atoppi
Copy link
Member

atoppi commented Aug 23, 2021

It should not be an issue adding the subproto to DC messages.
Anyway please share the changes in a Pull Request and we will review it.

@atoppi atoppi assigned atoppi and unassigned atoppi Aug 23, 2021
@lminiero
Copy link
Member

lminiero commented Sep 1, 2021

Mh, when I added support for subprotocols I think I checked this and it seemed to be working at the time. I'll check if it's actually broken, and in case push a fix. Thanks for the heads up!

@lminiero
Copy link
Member

lminiero commented Sep 2, 2021

I figured out why I thought this was working. When testing with the EchoTest by sending a datachannel message with a new label:

echotest.data({text: "ciao", label: "pippo", protocol: "http"})

the event on the incoming data message sent back by the plugin would have the protocol correctly set, so I thought this was working. Actually, the protocol field in this case was set by the browser, as the browser created the channel with that label/protocol, and so tagged the protocol accordingly on the incoming message. Modifying the plugin to display the protocol in incoming_data did confirm it wasn't being received, as you said. Creating labels with a custom protocol from a plugin does work, instead, so the problem is indeed only on incoming messages. I'll push a fix shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants