abort report: pjsua "vid call rx on 1"

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

 



Hello,

if video stream is deactivated in pjsua (pjsip-app/src/pjsua/*)), then
asking for remote endpoint to transmit video results in program abort due to

    PJ_ASSERT_RETURN(stream && info, PJ_EINVAL);

in pjmedia_vid_stream_get_info() in "vid_stream.c".  It looks like this
bug is reliably reproducible, here is the complete log:

========8<========8<========8<========8<========

pjsua
m
sip:192.168.2.101
dq


20:39:09.166 pjsua_app_comm !
  [CONFIRMED] To: sip:192.168.2.101;tag=qyVA8ksdONnu9Z3b-qrNNJcfmEIOK5X0
    Call time: 00h:00m:03s, 1st res in 2371 ms, conn in 2372ms
    #0 audio speex @16kHz, sendrecv, peer=192.168.2.101:4012
       SRTP status: Not active Crypto-suite:
       RX pt=98, last update:00h:00m:03.123s ago
          total 77pkt 4.8KB (7.9KB +IP hdr) @avg=11.6Kbps/19.1Kbps
          pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%)
                (msec)    min     avg     max     last    dev
          loss period:   0.000   0.000   0.000   0.000   0.000
          jitter     :   0.062   1.878   2.625   2.312   0.667
       TX pt=98, ptime=20, last update:00h:00m:03.129s ago
          total 40pkt 2.2KB (3.8KB +IP hdr) @avg=5.4Kbps/9.2Kbps
          pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
                (msec)    min     avg     max     last    dev
          loss period:   0.000   0.000   0.000   0.000   0.000
          jitter     :   0.000   0.000   0.000   0.000   0.000
       RTT msec      :   0.000   0.000   0.000   0.000   0.000
    #1 video deactivated


vid call rx on 1


Assertion failed: (stream && info), function
pjmedia_vid_stream_get_info, file ../src/pjmedia/vid_stream.c, line 1828.

Program received signal SIGABRT, Aborted.
0x00007fff82768d7a in mach_msg_trap ()

========8<========8<========8<========8<========

A possible fix is proposed in attachment (though for "legacy" interface
only).  This patch also deals with the situation of not automatically
activating video for

    vid call tx on 1

if its "deactivated" as in the above case.

    Eeri Kask

-------------- next part --------------
--- pjsip-apps/src/pjsua/pjsua_app_legacy.c.orig	2014-05-01 14:40:04.000000000 +0200
+++ pjsip-apps/src/pjsua/pjsua_app_legacy.c	2014-05-05 15:43:19.000000000 +0200
@@ -354,31 +354,55 @@
 	pjsua_call_vid_strm_op_param_default(&param);
 
 	if (argc == 5 && strcmp(argv[2], "rx")==0) {
-	    pjsua_stream_info si;
+	    pjsua_call_info ci;
 	    pj_bool_t on = (strcmp(argv[3], "on") == 0);
 
-	    param.med_idx = atoi(argv[4]);
-	    if (pjsua_call_get_stream_info(current_call, param.med_idx, &si) ||
-		si.type != PJMEDIA_TYPE_VIDEO)
-	    {
+	    param.med_idx = (argc > 4 ? atoi(argv[4]) : -1);
+	    pjsua_call_get_info(current_call, &ci);
+	    if (0 <= param.med_idx && param.med_idx < ci.media_cnt
+		    && ci.media[param.med_idx].type == PJMEDIA_TYPE_VIDEO) {
+		if (ci.media[param.med_idx].status == PJSUA_CALL_MEDIA_NONE
+			|| ci.media[param.med_idx].dir == PJMEDIA_DIR_NONE) {
+		    if (on)
+			param.dir = PJMEDIA_DIR_DECODING;
+		    else
+			return;
+		} else {
+		    if (on)
+			param.dir = (ci.media[param.med_idx].dir | PJMEDIA_DIR_DECODING);
+		    else
+			param.dir = (ci.media[param.med_idx].dir & PJMEDIA_DIR_ENCODING);
+		}
+	    } else {
 		PJ_PERROR(1,(THIS_FILE, PJ_EINVAL, "Invalid stream"));
 		return;
 	    }
-
-	    if (on) param.dir = (si.info.vid.dir | PJMEDIA_DIR_DECODING);
-	    else param.dir = (si.info.vid.dir & PJMEDIA_DIR_ENCODING);
-
 	    status = pjsua_call_set_vid_strm(current_call,
 	                                     PJSUA_CALL_VID_STRM_CHANGE_DIR,
 	                                     &param);
 	}
 	else if (argc == 5 && strcmp(argv[2], "tx")==0) {
+	    pjsua_call_info ci;
 	    pj_bool_t on = (strcmp(argv[3], "on") == 0);
-	    pjsua_call_vid_strm_op op = on? PJSUA_CALL_VID_STRM_START_TRANSMIT :
-					    PJSUA_CALL_VID_STRM_STOP_TRANSMIT;
-
-	    param.med_idx = atoi(argv[4]);
+	    pjsua_call_vid_strm_op op = PJSUA_CALL_VID_STRM_CHANGE_DIR;
 
+	    param.med_idx = (argc > 4 ? atoi(argv[4]) : -1);
+	    pjsua_call_get_info(current_call, &ci);
+	    if (0 <= param.med_idx && param.med_idx < ci.media_cnt
+		    && ci.media[param.med_idx].type == PJMEDIA_TYPE_VIDEO) {
+		if (ci.media[param.med_idx].status == PJSUA_CALL_MEDIA_NONE
+			|| ci.media[param.med_idx].dir == PJMEDIA_DIR_NONE) {
+		    if (on)
+			param.dir = PJMEDIA_DIR_ENCODING;
+		    else
+			return;
+		} else {
+		    op = (on ? PJSUA_CALL_VID_STRM_START_TRANSMIT : PJSUA_CALL_VID_STRM_STOP_TRANSMIT);
+		}
+	    } else {
+		PJ_PERROR(1,(THIS_FILE, PJ_EINVAL, "Invalid stream"));
+		return;
+	    }
 	    status = pjsua_call_set_vid_strm(current_call, op, &param);
 	}
 	else if (argc == 3 && strcmp(argv[2], "add")==0) {


[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