simpleua.c .. wav file don't have sounds,

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

 



Hi

I am using pjproject 1.8.

And using simpleua.c from PJSIP_TOP_DIR/pjsip-apps/src/samples. In this
program I tried to add recording WAV file. For this, I have changed in
call_on_media_update() function from simpleua.c file.. but when program get
exist and try to listen that WAV file, I didn't hear any voice from WAV
file.

Here, is code of call_on_media_update() function from simpleua.c file....

static void call_on_media_update( pjsip_inv_session *inv,pj_status_t status)
{
pjmedia_session_info sess_info;
const pjmedia_sdp_session *local_sdp;
const pjmedia_sdp_session *remote_sdp;

  if (status != PJ_SUCCESS) {
app_perror(THIS_FILE, "SDP negotiation has failed", status);
return;
}

status = pjmedia_sdp_neg_get_active_local(inv->neg, &local_sdp);
status = pjmedia_sdp_neg_get_active_remote(inv->neg, &remote_sdp);
  status = pjmedia_session_info_from_sdp(inv->dlg->pool, g_med_endpt,1,
&sess_info, local_sdp, remote_sdp);
if (status != PJ_SUCCESS) {
app_perror( THIS_FILE, "Unable to create media session", status);
return;
}

  status = pjmedia_session_create( g_med_endpt, &sess_info,&g_med_transport,
NULL, &g_med_session );
if (status != PJ_SUCCESS) {
app_perror( THIS_FILE, "Unable to create media session", status);
return;
}
pjmedia_session_get_port(g_med_session, 0, &media_port);

/* Create a sound Player device and connect the media port to the
* sound device.
*/
/*
  status = pjmedia_snd_port_create_player(inv->pool, //  pool
  -1, // sound dev id
  48000, // clock rate
  media_port->info.channel_count, // channel count
  media_port->info.samples_per_frame,// samples per frame
  media_port->info.bits_per_sample, // bits per sample
  0, // options
&g_snd_player);

if (status != PJ_SUCCESS) {
app_perror( THIS_FILE, "Unable to create sound player", status);
PJ_LOG(3,(THIS_FILE, "%d %d %d %d",
  media_port->info.clock_rate, // clock rate
  media_port->info.channel_count, // channel count
  media_port->info.samples_per_frame, // samples per frame
  media_port->info.bits_per_sample // bits per sample
));
return;
}

status = pjmedia_snd_port_connect(g_snd_player, media_port);
*/

/* Create WAVE file writer port. */
  status = pjmedia_wav_writer_port_create( inv->pool,
"recording.wav",CLOCK_RATE,2,SAMPLES_PER_FRAME,BITS_PER_SAMPLE,
  0, 0,&media_port);
if (status != PJ_SUCCESS) {
app_perror(THIS_FILE, "Unable to open WAV file for writing", status);
return;
  }

/* Create a sound recorder device and connect the media port to the
* sound device.
*/

  status = pjmedia_snd_port_create_rec(inv->pool, /* pool */
-1, /* sound dev id */
48000, /* clock rate */
2, /* channel count */
media_port->info.samples_per_frame, /* samples per frame*/
media_port->info.bits_per_sample, /* bits per sample */
0, /* options */
&g_snd_rec);
if (status != PJ_SUCCESS) {
app_perror( THIS_FILE, "Unable to create sound recorder", status);
return;
}

status = pjmedia_snd_port_connect(g_snd_rec, media_port);

/* Done with media. */
}

Here, I attached ".c" file for your further reference.

-- 
Regards,

Chandrakant Solanki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101101/92aecf91/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: application/octet-stream
Size: 22600 bytes
Desc: not available
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101101/92aecf91/attachment-0001.c>


[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