Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1266 closed task (fixed)

Asynchronous media transport creation

Reported by: bennylp Owned by: ming
Priority: major Milestone: release-2.0-alpha2
Component: pjsua-lib Version: 2.0-dev-branch
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

In 2.0, media transport creation is now made on as-needed basis, i.e. when calls need them. Currently the creation is blocking, so call initialization would wait (blocking) until media is created and initialized.

This ticket makes the creation asynchronous. The proposed solution is as follows:

  1. modify media transport creation to asynchronous (e.g. for STUN resolution)
  2. add new callback, e.g. on_call_media_transport_state(call_id, state_struct) to report media transport status. We'll use this to report transport creation status, as well as other events. The events reported by existing on_ice_transport_error() callback may as well go to this callback too (and remove on_ice_transport_error() altogether? I'd say yes.)
  3. for outgoing calls, delay the INVITE transmission until media transport is ready. Be aware that app may hangup the call at any time, including when transport is being created, hence need to handle this case.
  4. for incoming calls, report the INVITE to on_incoming_call() immediately. As long as app doesn't reject the call in this callback, proceed with creating the transport (which will finish asynchronously later). If app answers the call while the transport is not ready, there are several cases:
    1. if worker thread is enabled *and* current thread is not worker thread, block the execution waiting until transport is created.
    2. for Symbian, do event polling
    3. for other cases, return PJMEDIA_TP_EINSTATE (new errror: invalid transport state).

Also as in outgoing call case, app may hangup the call at any time.

More description is in #539 (duplicate of this ticket)

Change History (10)

comment:1 Changed 8 years ago by bennylp

  • Milestone changed from release-2.0-alpha to release-2.0-beta
  • Priority changed from normal to major

comment:2 Changed 8 years ago by bennylp

  • Description modified (diff)
  • Milestone changed from release-2.0-beta to release-2.0-alpha2
  • Owner changed from bennylp to ming
  • Status changed from new to assigned
  • Summary changed from Make media transport creation asynchronous to Asynchronous media transport creation

comment:3 Changed 8 years ago by ming

(In [3763]) Re #1266: Asynchronous media transport creation

  • Add feature that allows ICE media transport to be created asynchronously.
  • Add new callback, e.g. on_call_media_transport_state(call_id, state_struct) to report media transport status.
  • Handle outgoing calls while creating media transport asynchronously.

comment:4 Changed 8 years ago by ming

(In [3764]) Re #1266: Fixed build error in non-Windows platform.

comment:5 Changed 8 years ago by ming

(In [3767]) Re #1266: Fixed crash when accepting incoming call.

comment:6 Changed 8 years ago by ming

(In [3775]) Re #1266: Fixed failed automated tests for ICE

comment:7 Changed 8 years ago by ming

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3777]) Closed #1266:
Handle incoming calls when media transport is created asynchronously.

comment:8 Changed 8 years ago by ming

(In [3780]) Re #1266: Modified pjsua_media_channel_deinit() to resume deinit in the callback (instead of returning PJ_EBUSY) and make sure the right transport is used before calling dlg_respond()

comment:9 Changed 8 years ago by ming

(In [3796]) Re #1266:

  • Make sure that all media transports are already created and completed to fix the assertion when making call using ICE.
  • Change the callback pjsua_med_tp_state_cb to return pj_status_t (instead of void)

comment:10 Changed 8 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.