- Timestamp:
- Feb 16, 2009 4:29:05 PM (16 years ago)
- Location:
- pjproject/branches/projects/aps-direct
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/codec.h
r2436 r2456 276 276 pj_uint8_t pcm_bits_per_sample; /**< Bits/sample in the PCM side */ 277 277 pj_uint8_t pt; /**< Payload type. */ 278 pjmedia_fo urccformat; /**< Source format, it's format of278 pjmedia_format format; /**< Source format, it's format of 279 279 encoder input and decoder 280 280 output. */ -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/conference.h
r2434 r2456 57 57 unsigned slot; /**< Slot number. */ 58 58 pj_str_t name; /**< Port name. */ 59 pjmedia_fo urcc format; /**< Format (FourCC identifier)*/59 pjmedia_format format; /**< Format. */ 60 60 pjmedia_port_op tx_setting; /**< Transmit settings. */ 61 61 pjmedia_port_op rx_setting; /**< Receive settings. */ -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/port.h
r2452 r2456 213 213 pj_bool_t need_info; /**< Need info on connect? */ 214 214 unsigned pt; /**< Payload type (can be dynamic). */ 215 pjmedia_fo urcc format; /**< Format (FourCC identifier)*/215 pjmedia_format format; /**< Format. */ 216 216 pj_str_t encoding_name; /**< Encoding name. */ 217 217 unsigned clock_rate; /**< Sampling rate. */ … … 359 359 * @param n Number of first subframes to be popped out. 360 360 * 361 * @return PJ_SUCCESS , or PJ_ENOTFOUND if frame is empty.361 * @return PJ_SUCCESS when successful. 362 362 */ 363 363 PJ_INLINE(pj_status_t) -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/sound.h
r2438 r2456 99 99 typedef struct pjmedia_snd_setting 100 100 { 101 pjmedia_fo urcc format; /**< Format (FourCC ID).*/101 pjmedia_format format; /**< Format. */ 102 102 pj_uint32_t bitrate; /**< Bitrate (bps). */ 103 103 pj_uint32_t mode; /**< Mode, e.g: iLBC format has -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/symbian_sound_aps.h
r2438 r2456 32 32 33 33 /** 34 * Declaration of APS sound setting.35 */36 typedef struct pjmedia_snd_aps_setting37 {38 pjmedia_fourcc format; /**< Format (FourCC ID). */39 pj_uint32_t bitrate; /**< Bitrate (bps). */40 pj_uint32_t mode; /**< Mode, currently only used41 for specifying iLBC mode,42 20ms or 30ms frame size. */43 pj_bool_t plc; /**< PLC enabled/disabled. */44 pj_bool_t vad; /**< VAD enabled/disabled. */45 pj_bool_t cng; /**< CNG enabled/disabled. */46 pj_bool_t loudspk; /**< Audio routed to loudspeaker.*/47 48 } pjmedia_snd_aps_setting;49 50 51 /**52 34 * Activate/deactivate loudspeaker, when loudspeaker is inactive, audio 53 35 * will be routed to earpiece. -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/types.h
r2445 r2456 180 180 181 181 /** 182 * Declaration of FourCC type.183 */ 184 typedef union pjmedia_fo urcc{182 * Declaration of format. 183 */ 184 typedef union pjmedia_format { 185 185 pj_uint32_t u32; 186 186 char c[4]; 187 } pjmedia_fo urcc;188 189 190 /** 191 * FourCC packing macro.192 */ 193 #define PJMEDIA_FO URCC_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 )194 195 /** 196 * Fo urCCidentifier definitions.197 */ 198 #define PJMEDIA_FO URCC_L16 PJMEDIA_FOURCC_PACK(' ', 'L', '1', '6')199 #define PJMEDIA_FO URCC_PCMA PJMEDIA_FOURCC_PACK('A', 'L', 'A', 'W')200 #define PJMEDIA_FO URCC_PCMU PJMEDIA_FOURCC_PACK('u', 'L', 'A', 'W')201 #define PJMEDIA_FO URCC_AMR PJMEDIA_FOURCC_PACK(' ', 'A', 'M', 'R')202 #define PJMEDIA_FO URCC_G729 PJMEDIA_FOURCC_PACK('G', '7', '2', '9')203 #define PJMEDIA_FO URCC_ILBC PJMEDIA_FOURCC_PACK('I', 'L', 'B', 'C')187 } pjmedia_format; 188 189 190 /** 191 * Macro for packing format. 192 */ 193 #define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) 194 195 /** 196 * Format identifier definitions. 197 */ 198 #define PJMEDIA_FORMAT_L16 0 199 #define PJMEDIA_FORMAT_PCMA PJMEDIA_FORMAT_PACK('A', 'L', 'A', 'W') 200 #define PJMEDIA_FORMAT_PCMU PJMEDIA_FORMAT_PACK('u', 'L', 'A', 'W') 201 #define PJMEDIA_FORMAT_AMR PJMEDIA_FORMAT_PACK(' ', 'A', 'M', 'R') 202 #define PJMEDIA_FORMAT_G729 PJMEDIA_FORMAT_PACK('G', '7', '2', '9') 203 #define PJMEDIA_FORMAT_ILBC PJMEDIA_FORMAT_PACK('I', 'L', 'B', 'C') 204 204 205 205 -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-codec/passthrough.c
r2452 r2456 156 156 const char *name; /* Codec name. */ 157 157 pj_uint8_t pt; /* Payload type. */ 158 pjmedia_fo urccformat; /* Source format. */158 pjmedia_format format; /* Source format. */ 159 159 unsigned clock_rate; /* Codec's clock rate. */ 160 160 unsigned channel_count; /* Codec's channel count. */ … … 173 173 { 174 174 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 175 {1, "AMR", PJMEDIA_RTP_PT_AMR, {PJMEDIA_FO URCC_AMR},175 {1, "AMR", PJMEDIA_RTP_PT_AMR, {PJMEDIA_FORMAT_AMR}, 176 176 8000, 1, 160, 177 177 7400, 12200, 2, 1, 1, … … 182 182 183 183 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 184 {1, "G729", PJMEDIA_RTP_PT_G729, {PJMEDIA_FO URCC_G729},184 {1, "G729", PJMEDIA_RTP_PT_G729, {PJMEDIA_FORMAT_G729}, 185 185 8000, 1, 80, 186 186 8000, 8000, 2, 1, 1 … … 189 189 190 190 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 191 {1, "iLBC", PJMEDIA_RTP_PT_ILBC, {PJMEDIA_FO URCC_ILBC},191 {1, "iLBC", PJMEDIA_RTP_PT_ILBC, {PJMEDIA_FORMAT_ILBC}, 192 192 8000, 1, 240, 193 193 13333, 15200, 1, 1, 1, … … 198 198 199 199 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 200 {1, "PCMU", PJMEDIA_RTP_PT_PCMU, {PJMEDIA_FO URCC_PCMU},200 {1, "PCMU", PJMEDIA_RTP_PT_PCMU, {PJMEDIA_FORMAT_PCMU}, 201 201 8000, 1, 80, 202 202 64000, 64000, 2, 1, 1 … … 205 205 206 206 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 207 {1, "PCMA", PJMEDIA_RTP_PT_PCMA, {PJMEDIA_FO URCC_PCMA},207 {1, "PCMA", PJMEDIA_RTP_PT_PCMA, {PJMEDIA_FORMAT_PCMA}, 208 208 8000, 1, 80, 209 209 64000, 64000, 2, 1, 1 -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c
r2455 r2456 588 588 dst_port = conf->ports[sink_slot]; 589 589 590 /* Source and sink format must match. */ 591 if (src_port->info->format.u32 != dst_port->info->format.u32) { 592 pj_mutex_unlock(conf->mutex); 593 return PJMEDIA_ENOTCOMPATIBLE; 594 } 595 590 596 /* Source and sink ptime must be equal or a multiplication factor. */ 591 597 if ((src_port->info->samples_per_frame % … … 598 604 } 599 605 600 /* Check if source and sink has compatible format */601 if (src_slot != 0 && sink_slot != 0 &&602 src_port->port->info.format.u32 != dst_port->port->info.format.u32)603 {604 pj_mutex_unlock(conf->mutex);605 return PJMEDIA_ENOTCOMPATIBLE;606 }607 608 606 /* Check if sink is listening to other ports */ 609 607 if (dst_port->transmitter_cnt > 0) { … … 954 952 955 953 /* Level adjustment is applicable only for ports that work with raw PCM. */ 956 PJ_ASSERT_RETURN(conf_port->info->format.u32 == 0 || 957 conf_port->info->format.u32 == PJMEDIA_FOURCC_L16, 954 PJ_ASSERT_RETURN(conf_port->info->format.u32 == PJMEDIA_FORMAT_L16, 958 955 PJ_EIGNORED); 959 956 … … 989 986 990 987 /* Level adjustment is applicable only for ports that work with raw PCM. */ 991 PJ_ASSERT_RETURN(conf_port->info->format.u32 == 0 || 992 conf_port->info->format.u32 == PJMEDIA_FOURCC_L16, 988 PJ_ASSERT_RETURN(conf_port->info->format.u32 == PJMEDIA_FORMAT_L16, 993 989 PJ_EIGNORED); 994 990 … … 1114 1110 1115 1111 /* Check port format. */ 1116 if (cport_dst->port && (cport_dst->port->info.format.u32==0 ||1117 cport_dst->port->info.format.u32 == PJMEDIA_FO URCC_L16))1112 if (cport_dst->port && 1113 cport_dst->port->info.format.u32 == PJMEDIA_FORMAT_L16) 1118 1114 { 1119 1115 /* When there is already some samples in listener's TX buffer, … … 1266 1262 } 1267 1263 } else if (f->type == PJMEDIA_FRAME_TYPE_EXTENDED) { 1268 /* For extended frame, TXlevel is unknown, so we just set1264 /* For extended frame, level is unknown, so we just set 1269 1265 * it to NORMAL_LEVEL. 1270 1266 */ … … 1474 1470 } 1475 1471 } else if (f->type == PJMEDIA_FRAME_TYPE_EXTENDED) { 1476 /* For extended frame, TXlevel is unknown, so we just set1472 /* For extended frame, level is unknown, so we just set 1477 1473 * it to NORMAL_LEVEL. 1478 1474 */ -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/sound_port.c
r2454 r2456 291 291 292 292 switch (snd_port->setting.format.u32) { 293 case PJMEDIA_FO URCC_PCMA:293 case PJMEDIA_FORMAT_PCMA: 294 294 decoder = &pjmedia_alaw_decode; 295 295 break; 296 case PJMEDIA_FO URCC_PCMU:296 case PJMEDIA_FORMAT_PCMU: 297 297 decoder = &pjmedia_ulaw_decode; 298 298 break; … … 393 393 394 394 switch (snd_port->setting.format.u32) { 395 case PJMEDIA_FO URCC_PCMA:395 case PJMEDIA_FORMAT_PCMA: 396 396 encoder = &pjmedia_alaw_encode; 397 397 break; 398 case PJMEDIA_FO URCC_PCMU:398 case PJMEDIA_FORMAT_PCMU: 399 399 encoder = &pjmedia_ulaw_encode; 400 400 break; … … 435 435 PJ_EBUG); 436 436 437 if (snd_port->setting.format.u32 == 0 || 438 snd_port->setting.format.u32 == PJMEDIA_FOURCC_L16) 439 { 437 if (snd_port->setting.format.u32 == PJMEDIA_FORMAT_L16) { 440 438 snd_rec_cb = &rec_cb; 441 439 snd_play_cb = &play_cb; … … 701 699 702 700 #if PJMEDIA_SOUND_USE_DELAYBUF 703 if (snd_port->setting.format.u32 == 0 || 704 snd_port->setting.format.u32 == PJMEDIA_FOURCC_L16) 705 { 701 if (snd_port->setting.format.u32 == PJMEDIA_FORMAT_L16) { 706 702 pj_status_t status; 707 703 unsigned ptime; … … 720 716 #if !defined(PJMEDIA_SND_SUPPORT_OPEN2) || PJMEDIA_SND_SUPPORT_OPEN2==0 721 717 /* For devices that doesn't support open2(), enable simulation */ 722 if (snd_port->setting.format.u32 != 0 && 723 snd_port->setting.format.u32 != PJMEDIA_FOURCC_L16) 724 { 718 if (snd_port->setting.format.u32 != PJMEDIA_FORMAT_L16) { 725 719 snd_port->frm_buf_size = sizeof(pjmedia_frame_ext) + 726 720 (samples_per_frame << 1) + -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/stream.c
r2445 r2456 868 868 } else if (frame->type == PJMEDIA_FRAME_TYPE_AUDIO && 869 869 frame->buf == NULL && 870 (stream->port.info.format.u32 == 0 || 871 stream->port.info.format.u32 == PJMEDIA_FOURCC_L16) && 870 stream->port.info.format.u32 == PJMEDIA_FORMAT_L16 && 872 871 (stream->dir & PJMEDIA_DIR_ENCODING) && 873 872 stream->codec_param.info.frm_ptime * … … 1609 1608 stream->port.info.format = info->param->info.format; 1610 1609 stream->port.port_data.pdata = stream; 1611 if (stream->port.info.format.u32 == 0 || 1612 stream->port.info.format.u32 == PJMEDIA_FOURCC_L16) 1613 { 1610 if (stream->port.info.format.u32 == PJMEDIA_FORMAT_L16) { 1614 1611 stream->port.put_frame = &put_frame; 1615 1612 stream->port.get_frame = &get_frame; -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp
r2449 r2456 509 509 iSession.Stop(); 510 510 state_ = STATE_READY; 511 TRACE_((THIS_FILE, "S treamingstopped"));511 TRACE_((THIS_FILE, "Sound device stopped")); 512 512 } 513 513 } … … 550 550 if (parentStrm_->dir != PJMEDIA_DIR_CAPTURE) { 551 551 iSession.Write(); 552 TRACE_((THIS_FILE, "Player st reaming started"));552 TRACE_((THIS_FILE, "Player started")); 553 553 } 554 554 … … 556 556 if (parentStrm_->dir != PJMEDIA_DIR_PLAYBACK) { 557 557 iSession.Read(); 558 TRACE_((THIS_FILE, "Recorder st reaming started"));558 TRACE_((THIS_FILE, "Recorder started")); 559 559 } 560 560 … … 569 569 void CPjAudioEngine::InputStreamInitialized(const TInt aStatus) 570 570 { 571 TRACE_((THIS_FILE, " InputStreamInitialized%d", aStatus));571 TRACE_((THIS_FILE, "Recorder initialized, err=%d", aStatus)); 572 572 573 573 state_ = STATE_READY; … … 579 579 void CPjAudioEngine::OutputStreamInitialized(const TInt aStatus) 580 580 { 581 TRACE_((THIS_FILE, " OutputStreamInitialized%d", aStatus));581 TRACE_((THIS_FILE, "Player initialized, err=%d", aStatus)); 582 582 583 583 if (aStatus == KErrNone) { … … 605 605 if (state_ == STATE_READY || state_ == STATE_STREAMING) { 606 606 iSession.ActivateLoudspeaker(active); 607 TRACE_((THIS_FILE, "Loudspeaker on/off: %d", active));607 TRACE_((THIS_FILE, "Loudspeaker turned %s", (active? "on":"off"))); 608 608 return KErrNone; 609 609 } … … 709 709 710 710 switch(strm->setting.format.u32) { 711 case PJMEDIA_FO URCC_AMR:711 case PJMEDIA_FORMAT_AMR: 712 712 { 713 713 const pj_uint8_t *p = (const pj_uint8_t*)buf.iBuffer.Ptr() + 1; … … 724 724 break; 725 725 726 case PJMEDIA_FO URCC_G729:726 case PJMEDIA_FORMAT_G729: 727 727 { 728 728 /* Check if we got a normal or SID frame. */ … … 753 753 break; 754 754 755 case PJMEDIA_FO URCC_ILBC:755 case PJMEDIA_FORMAT_ILBC: 756 756 { 757 757 unsigned samples_got; … … 779 779 break; 780 780 781 case PJMEDIA_FO URCC_PCMU:782 case PJMEDIA_FO URCC_PCMA:781 case PJMEDIA_FORMAT_PCMU: 782 case PJMEDIA_FORMAT_PCMA: 783 783 { 784 784 unsigned samples_processed = 0; … … 837 837 838 838 switch(strm->setting.format.u32) { 839 case PJMEDIA_FO URCC_AMR:839 case PJMEDIA_FORMAT_AMR: 840 840 { 841 841 if (frame->samples_cnt == 0) { … … 884 884 break; 885 885 886 case PJMEDIA_FO URCC_G729:886 case PJMEDIA_FORMAT_G729: 887 887 { 888 888 if (frame->samples_cnt == 0) { … … 933 933 break; 934 934 935 case PJMEDIA_FO URCC_ILBC:935 case PJMEDIA_FORMAT_ILBC: 936 936 { 937 937 if (frame->samples_cnt == 0) { … … 973 973 break; 974 974 975 case PJMEDIA_FO URCC_PCMU:976 case PJMEDIA_FO URCC_PCMA:975 case PJMEDIA_FORMAT_PCMU: 976 case PJMEDIA_FORMAT_PCMA: 977 977 { 978 978 unsigned samples_ready = 0; … … 1006 1006 } else { 1007 1007 pj_uint8_t silc; 1008 silc = (strm->setting.format.u32==PJMEDIA_FO URCC_PCMU)?1008 silc = (strm->setting.format.u32==PJMEDIA_FORMAT_PCMU)? 1009 1009 pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 1010 1010 buf.iBuffer.AppendFill(silc, samples_cnt); … … 1017 1017 pj_uint8_t silc; 1018 1018 1019 silc = (strm->setting.format.u32==PJMEDIA_FO URCC_PCMU)?1019 silc = (strm->setting.format.u32==PJMEDIA_FORMAT_PCMU)? 1020 1020 pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 1021 1021 buf.iBuffer.AppendFill(silc, samples_req - samples_ready); … … 1105 1105 strm->setting = *setting; 1106 1106 1107 if (strm->setting.format.u32 == 0)1108 strm->setting.format.u32 = PJMEDIA_FOURCC_L16;1109 1110 1107 /* Set audio engine fourcc. */ 1111 if (strm->setting.format.u32 == PJMEDIA_FO URCC_PCMU ||1112 strm->setting.format.u32 == PJMEDIA_FO URCC_PCMA ||1113 strm->setting.format.u32 == PJMEDIA_FO URCC_L16)1108 if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 1109 strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 1110 strm->setting.format.u32 == PJMEDIA_FORMAT_L16) 1114 1111 { 1115 1112 aps_setting.fourcc = TFourCC(KMCPFourCCIdG711); … … 1119 1116 1120 1117 /* Set audio engine mode. */ 1121 if (strm->setting.format.u32 == PJMEDIA_FO URCC_AMR)1118 if (strm->setting.format.u32 == PJMEDIA_FORMAT_AMR) 1122 1119 { 1123 1120 aps_setting.mode = (TAPSCodecMode)strm->setting.bitrate; 1124 1121 } 1125 else if (strm->setting.format.u32 == PJMEDIA_FO URCC_PCMU ||1126 strm->setting.format.u32 == PJMEDIA_FO URCC_L16||1127 (strm->setting.format.u32 == PJMEDIA_FO URCC_ILBC &&1122 else if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 1123 strm->setting.format.u32 == PJMEDIA_FORMAT_L16 || 1124 (strm->setting.format.u32 == PJMEDIA_FORMAT_ILBC && 1128 1125 strm->setting.mode == 30)) 1129 1126 { 1130 1127 aps_setting.mode = EULawOr30ms; 1131 1128 } 1132 else if (strm->setting.format.u32 == PJMEDIA_FO URCC_PCMA ||1133 (strm->setting.format.u32 == PJMEDIA_FO URCC_ILBC &&1129 else if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 1130 (strm->setting.format.u32 == PJMEDIA_FORMAT_ILBC && 1134 1131 strm->setting.mode == 20)) 1135 1132 { … … 1138 1135 1139 1136 /* Disable VAD on L16 and G711. */ 1140 if (strm->setting.format.u32 == PJMEDIA_FO URCC_PCMU ||1141 strm->setting.format.u32 == PJMEDIA_FO URCC_PCMA ||1142 strm->setting.format.u32 == PJMEDIA_FO URCC_L16)1137 if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 1138 strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 1139 strm->setting.format.u32 == PJMEDIA_FORMAT_L16) 1143 1140 { 1144 1141 aps_setting.vad = EFalse; … … 1153 1150 1154 1151 /* Set audio engine callbacks. */ 1155 if (strm->setting.format.u32 == PJMEDIA_FO URCC_L16) {1152 if (strm->setting.format.u32 == PJMEDIA_FORMAT_L16) { 1156 1153 aps_play_cb = &PlayCbPcm; 1157 1154 aps_rec_cb = &RecCbPcm; … … 1183 1180 strm->rec_buf_len = 0; 1184 1181 1185 if (strm->setting.format.u32 == PJMEDIA_FO URCC_G729) {1182 if (strm->setting.format.u32 == PJMEDIA_FORMAT_G729) { 1186 1183 TBitStream *g729_bitstream = new TBitStream; 1187 1184 … … 1215 1212 1216 1213 pj_bzero(&setting, sizeof(setting)); 1217 setting.format.u32 = PJMEDIA_FO URCC_L16;1214 setting.format.u32 = PJMEDIA_FORMAT_L16; 1218 1215 1219 1216 return sound_open(PJMEDIA_DIR_CAPTURE, clock_rate, channel_count, … … 1237 1234 1238 1235 pj_bzero(&setting, sizeof(setting)); 1239 setting.format.u32 = PJMEDIA_FO URCC_L16;1236 setting.format.u32 = PJMEDIA_FORMAT_L16; 1240 1237 1241 1238 return sound_open(PJMEDIA_DIR_PLAYBACK, clock_rate, channel_count, … … 1262 1259 1263 1260 pj_bzero(&setting, sizeof(setting)); 1264 setting.format.u32 = PJMEDIA_FO URCC_L16;1261 setting.format.u32 = PJMEDIA_FORMAT_L16; 1265 1262 1266 1263 return sound_open(PJMEDIA_DIR_CAPTURE_PLAYBACK, clock_rate, channel_count, … … 1350 1347 stream->engine = NULL; 1351 1348 1352 if (stream->setting.format.u32 == PJMEDIA_FO URCC_G729) {1349 if (stream->setting.format.u32 == PJMEDIA_FORMAT_G729) { 1353 1350 TBitStream *g729_bitstream = (TBitStream*)stream->strm_data; 1354 1351 stream->strm_data = NULL; -
pjproject/branches/projects/aps-direct/pjsip-apps/src/symbian_ua/ua.cpp
r2450 r2456 93 93 94 94 static pj_pool_t *app_pool; 95 static pjmedia_snd_port * snd_port;95 static pjmedia_snd_port *g_snd_port; 96 96 97 97 … … 134 134 if (call_id == g_call_id) 135 135 g_call_id = PJSUA_INVALID_ID; 136 if (snd_port) {137 pjmedia_snd_port_destroy(snd_port);138 snd_port = NULL;139 }140 136 } else if (ci.state != PJSIP_INV_STATE_INCOMING) { 141 137 if (g_call_id == PJSUA_INVALID_ID) … … 270 266 unsigned samples_per_frame; 271 267 pj_status_t status; 268 269 PJ_UNUSED_ARG(call_id); 270 PJ_UNUSED_ARG(p_port); 272 271 273 272 status = pjmedia_session_get_info(sess, &sess_info); … … 289 288 setting.vad = strm_info->param->setting.vad; 290 289 setting.plc = strm_info->param->setting.plc; 291 if (setting.format.u32 == PJMEDIA_FO URCC_ILBC) {290 if (setting.format.u32 == PJMEDIA_FORMAT_ILBC) { 292 291 unsigned i; 293 292 pjmedia_codec_fmtp *fmtp = &strm_info->param->setting.dec_fmtp; … … 315 314 /* Reset conference attributes. */ 316 315 conf->info.samples_per_frame = samples_per_frame; 317 conf->info.clock_rate = 8000;318 conf->info.channel_count = 1;316 conf->info.clock_rate = strm_info->param->info.clock_rate; 317 conf->info.channel_count = strm_info->param->info.channel_cnt; 319 318 conf->info.bits_per_sample = 16; 319 conf->info.format = strm_info->param->info.format; 320 320 321 321 /* Reopen sound device. */ … … 324 324 0, 325 325 0, 326 8000,327 1,326 strm_info->param->info.clock_rate, 327 strm_info->param->info.channel_cnt, 328 328 samples_per_frame, 329 329 16, 330 330 &setting, 331 & snd_port);331 &g_snd_port); 332 332 if (status != PJ_SUCCESS) { 333 333 PJ_LOG(1,(THIS_FILE, "on_stream_created() failed to reopen sound " … … 336 336 } 337 337 338 status = pjmedia_snd_port_connect( snd_port, conf);338 status = pjmedia_snd_port_connect(g_snd_port, conf); 339 339 if (status != PJ_SUCCESS) { 340 340 PJ_LOG(1,(THIS_FILE, "on_stream_created() failed to connect sound " 341 341 "device to conference, status=%d", status)); 342 342 return; 343 } 344 } 345 346 static void on_stream_destroyed(pjsua_call_id call_id, 347 pjmedia_session *sess, 348 unsigned stream_idx) 349 { 350 PJ_UNUSED_ARG(call_id); 351 PJ_UNUSED_ARG(sess); 352 PJ_UNUSED_ARG(stream_idx); 353 354 if (g_snd_port) { 355 pjmedia_snd_port_destroy(g_snd_port); 356 g_snd_port = NULL; 343 357 } 344 358 } … … 407 421 cfg.cb.on_nat_detect = &on_nat_detect; 408 422 cfg.cb.on_stream_created = &on_stream_created; 423 cfg.cb.on_stream_destroyed = &on_stream_destroyed; 409 424 410 425 if (SIP_PROXY) { … … 429 444 log_cfg.console_level = LOG_LEVEL; 430 445 log_cfg.cb = &log_writer; 431 //log_cfg.log_filename = pj_str("C:\\data\\symbian_ua.log");446 log_cfg.log_filename = pj_str("C:\\data\\symbian_ua.log"); 432 447 433 448 pjsua_media_config_default(&med_cfg); … … 621 636 # if PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_SYMB_APS_SOUND 622 637 case 't': 623 if ( snd_port) {638 if (g_snd_port) { 624 639 static pj_bool_t act_loudspk = PJ_TRUE; 625 640 pjmedia_snd_stream *strm; 626 641 627 strm = pjmedia_snd_port_get_snd_stream( snd_port);642 strm = pjmedia_snd_port_get_snd_stream(g_snd_port); 628 643 pjmedia_snd_aps_activate_loudspeaker(strm, act_loudspk); 629 644 act_loudspk = !act_loudspk; … … 998 1013 #endif 999 1014 1000 if ( snd_port) {1001 pjmedia_snd_port_destroy( snd_port);1002 snd_port = NULL;1015 if (g_snd_port) { 1016 pjmedia_snd_port_destroy(g_snd_port); 1017 g_snd_port = NULL; 1003 1018 } 1004 1019
Note: See TracChangeset
for help on using the changeset viewer.