[PATCH][pjsua-lib] Destroy port passed to pjsua_callback::on_stream_created()

BC
b17 c0de
Tue, Oct 17, 2017 5:34 PM

Hi pj_friends,
Please review / merge this patch which makes pjsua-lib call
pjmedia_port_destroy() on the port passed to pjsua in the
on_stream_created() callback.

When the port is given to pjsua, pjsua is effectively taking ownership of
the port. pjsua controls when the port is added/removed from the
conference, and knows when it is safe to destroy the port. As a user of the
library it is much easier to be able to rely on the port's on_destroy()
being called in this case.

I put the pjmedia_port_destroy() call before the call to the
on_stream_destroyed() callback to be more backwards compatible. For
example, if the user is currently ignoring on_destroy() and relying on the
on_stream_destroyed() callback to destroy the port, then that still works.

Regards,
Kal

Hi pj_friends, Please review / merge this patch which makes pjsua-lib call pjmedia_port_destroy() on the port passed to pjsua in the on_stream_created() callback. When the port is given to pjsua, pjsua is effectively taking ownership of the port. pjsua controls when the port is added/removed from the conference, and knows when it is safe to destroy the port. As a user of the library it is much easier to be able to rely on the port's on_destroy() being called in this case. I put the pjmedia_port_destroy() call before the call to the on_stream_destroyed() callback to be more backwards compatible. For example, if the user is currently ignoring on_destroy() and relying on the on_stream_destroyed() callback to destroy the port, then that still works. Regards, Kal