Hi, As I remember, streamutil work in recv-only or send-only mode. If you enable play-file and record-file together, it will select one. regards, Gang On Tue, Jul 22, 2008 at 12:30 AM, Klaus Darilion < klaus.mailinglists at pernau.at> wrote: > new option: --local-ip > This IP address will be used during pjmedia_transport_udp_create2(). > default value use 0.0.0.0 > > I tested it with --local-ip=224.0.0.1. The strange thing was, that it > worked with recv-only, but when streamutil is started in send-recv mode, I > can not hear the audio. I also have added PJMEDIA_UDP_NO_SRC_ADDR_CHECKING > but without success. > > regards > klaus > > > > --- pjproject-0.9.0-orig/pjsip-apps/src/samples/streamutil.c 2008-06-21 > 00:44:47.000000000 +0200 > +++ pjproject-0.9.0/pjsip-apps/src/samples/streamutil.c 2008-07-21 > 17:52:45.483364880 +0200 > @@ -55,6 +55,7 @@ > "\n" > " Options:\n" > " --codec=CODEC Set the codec name. \n" > + " --local-ip=IP Set local IP address (default=0.0.0.0) > \n" > " --local-port=PORT Set local RTP port (default=4000) \n" > " --remote=IP:PORT Set the remote peer. If this option is set, \n" > " the program will transmit RTP audio to the \n" > @@ -139,6 +140,7 @@ > pjmedia_endpt *med_endpt, > const pjmedia_codec_info *codec_info, > pjmedia_dir dir, > + const pj_str_t *local_ip, > pj_uint16_t local_port, > const pj_sockaddr_in *rem_addr, > #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) > @@ -185,8 +187,8 @@ > } > > /* Create media transport */ > - status = pjmedia_transport_udp_create(med_endpt, NULL, local_port, > - 0, &transport); > + status = pjmedia_transport_udp_create2(med_endpt, NULL, local_ip, > + local_port, 0, &transport); > if (status != PJ_SUCCESS) > return status; > > @@ -274,6 +276,8 @@ > const pjmedia_codec_info *codec_info; > pjmedia_dir dir = PJMEDIA_DIR_DECODING; > pj_sockaddr_in remote_addr; > + struct pj_in_addr local_ip_addr; > + pj_str_t local_ip = {"0.0.0.0",7}; > pj_uint16_t local_port = 4000; > char *codec_id = NULL; > char *rec_file = NULL; > @@ -281,6 +285,7 @@ > > enum { > OPT_CODEC = 'c', > + OPT_LOCAL_IP = 'a', > OPT_LOCAL_PORT = 'p', > OPT_REMOTE = 'r', > OPT_PLAY_FILE = 'w', > @@ -298,6 +303,7 @@ > > struct pj_getopt_option long_options[] = { > { "codec", 1, 0, OPT_CODEC }, > + { "local-ip", 1, 0, OPT_LOCAL_IP }, > { "local-port", 1, 0, OPT_LOCAL_PORT }, > { "remote", 1, 0, OPT_REMOTE }, > { "play-file", 1, 0, OPT_PLAY_FILE }, > @@ -325,6 +331,23 @@ > status = pj_init(); > PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); > > + /* Must create a pool factory before we can allocate any memory. */ > + pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); > + > + /* > + * Initialize media endpoint. > + * This will implicitly initialize PJMEDIA too. > + */ > + status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt); > + PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); > + > + /* Create memory pool for application purpose */ > + pool = pj_pool_create( &cp.factory, /* pool factory > */ > + "app", /* pool name. */ > + 4000, /* init size */ > + 4000, /* increment size */ > + NULL /* callback on error */ > + ); > > /* Parse arguments */ > pj_optind = 0; > @@ -335,6 +358,14 @@ > codec_id = pj_optarg; > break; > > + case OPT_LOCAL_IP: > + pj_strdup2(pool, &local_ip, pj_optarg); > + if (pj_inet_aton(&local_ip, &local_ip_addr) == 0) { > + printf("Error: invalid local IP address %s\n", pj_optarg); > + return 1; > + } > + break; > + > case OPT_LOCAL_PORT: > local_port = (pj_uint16_t) atoi(pj_optarg); > if (local_port < 1) { > @@ -433,25 +464,6 @@ > } > #endif > > - /* Must create a pool factory before we can allocate any memory. */ > - pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); > - > - /* > - * Initialize media endpoint. > - * This will implicitly initialize PJMEDIA too. > - */ > - status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt); > - PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); > - > - /* Create memory pool for application purpose */ > - pool = pj_pool_create( &cp.factory, /* pool factory > */ > - "app", /* pool name. */ > - 4000, /* init size */ > - 4000, /* increment size */ > - NULL /* callback on error */ > - ); > - > - > /* Register all supported codecs */ > status = init_codecs(med_endpt); > PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); > @@ -476,8 +488,8 @@ > } > > /* Create stream based on program arguments */ > - status = create_stream(pool, med_endpt, codec_info, dir, local_port, > - &remote_addr, > + status = create_stream(pool, med_endpt, codec_info, dir, &local_ip, > + local_port, &remote_addr, > #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) > use_srtp, &srtp_crypto_suite, > &srtp_tx_key, &srtp_rx_key, > @@ -674,7 +686,6 @@ > /* Shutdown PJLIB */ > pj_shutdown(); > > - > return (status == PJ_SUCCESS) ? 0 : 1; > } > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080722/8bd11a8e/attachment-0001.html