TLS - Changing video stream direction corrupt the video stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Our goal is to pause the video when the app goes to background (user taps the Home button), and resume it when the user gets back to the app.
On UDP everything work just fine, but we are having a problem when using pjsua2 with TLS configuration on Android devices, while trying to changed the direction of the media stream.


Explanation:
During a video call with two participants, if participant A was the first one to pause the video he can pause and resume it many times and the video call will pause and resume as expected.
But if participant B will try to pause the video call (after participant A already paused and resumed the video call for at least once) it will not work and the following error will appear:

pjsua_media.c  ......pjmedia_transport_media_start() failed for call_id 0 media 0: Unsupported SRTP crypto-suite (PJMEDIA_SRTP_ENOTSUPCRYPTO)

After analyzing the SDP on every INVITE, Re-INVITE and 200OK the crypto attribute of both Video&Audio does not change.
It looks like suddenly the transport_srtp fails to find the matching crypto-suite.

This is the part in the pjsua2 code that return that error:

/* Check whether the crypto-suite requested is supported */
if (cr_tx_idx == -1 || cr_rx_idx == -1 || au_tx_idx == -1 || au_rx_idx == -1)
{
     status = PJMEDIA_SRTP_ENOTSUPCRYPTO;
     goto on_return;
}

It's in the file pjproject-2.6\pjmedia\src\pjmedia\transport_srtp.c lines number 605-611

Those are the values that we've found when the error occurred:
cr_tx_idx: 3, cr_rx_idx: -1, au_tx_idx: 3, au_rx_idx: -1.


Please consider the following scenario:

========= User A and User are in an ongoing video calll ============
User A User B
* User A leaves the application

———— Re-Invite (dir=recvonly) ————>
<——— 200 OK (dir=sendonly) ————— 

* User A gets back to the application

———— Re-Invite (dir=sendrecv) ————>
<——— 200 OK (dir=sendrecv)  —————

* This scenario can be repeated successfully as many time as we want

User B leaves the application * 

<———— Re-Invite (dir=recvonly) ————
——— 200 OK (dir=sendonly) —————>
Error in users B's media

* It doesn't matter who's the first to pause and resume the video call, after one of the participants did it the other one can’t, and the media will corrupt.



Pausing the video call is being made by changing the video stream direction:
CallVidSetStreamParam callVidSetStreamParam = new CallVidSetStreamParam();
callVidSetStreamParam.setDir(pjmedia_dir.PJMEDIA_DIR_DECODING);
sipCall.vidSetStream(pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_DIR, callVidSetStreamParam);
Resuming the video call is being made by changing the video stream direction:
CallVidSetStreamParam callVidSetStreamParam = new CallVidSetStreamParam();
callVidSetStreamParam.setDir(pjmedia_dir.PJMEDIA_DIR_ENCODING_DECODING);
sipCall.vidSetStream(pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_DIR, callVidSetStreamParam);

Best Regards,
Oren

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux