Changeset 5786
- Timestamp:
- Apr 24, 2018 5:27:57 AM (7 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/config.h
r5752 r5786 413 413 414 414 /** 415 * DTMF/telephone-event duration, in timestamp. 415 * DTMF/telephone-event duration, in timestamp. To specify the duration in 416 * milliseconds, use the setting PJMEDIA_DTMF_DURATION_MSEC instead. 416 417 */ 417 418 #ifndef PJMEDIA_DTMF_DURATION 418 419 # define PJMEDIA_DTMF_DURATION 1600 /* in timestamp */ 420 #endif 421 422 423 /** 424 * DTMF/telephone-event duration, in milliseconds. If the value is greater 425 * than zero, than this setting will be used instead of PJMEDIA_DTMF_DURATION. 426 * 427 * Note that for a clockrate of 8 KHz, a dtmf duration of 1600 timestamp 428 * units (the default value of PJMEDIA_DTMF_DURATION) is equivalent to 200 ms. 429 */ 430 #ifndef PJMEDIA_DTMF_DURATION_MSEC 431 # define PJMEDIA_DTMF_DURATION_MSEC 0 419 432 #endif 420 433 -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r5785 r5786 174 174 175 175 /* RFC 2833 DTMF transmission queue: */ 176 unsigned dtmf_duration; /**< DTMF duration(in timestamp)*/ 176 177 int tx_event_pt; /**< Outgoing pt for dtmf. */ 177 178 int tx_dtmf_count; /**< # of digits in tx dtmf buf.*/ … … 956 957 957 958 digit->duration += stream->rtp_tx_ts_len_per_pkt; 958 if (digit->duration >= PJMEDIA_DTMF_DURATION)959 digit->duration = PJMEDIA_DTMF_DURATION;959 if (digit->duration >= stream->dtmf_duration) 960 digit->duration = stream->dtmf_duration; 960 961 961 962 event->event = (pj_uint8_t)digit->event; … … 964 965 965 966 if (forced_last) { 966 digit->duration = PJMEDIA_DTMF_DURATION;967 } 968 969 if (digit->duration >= PJMEDIA_DTMF_DURATION) {967 digit->duration = stream->dtmf_duration; 968 } 969 970 if (digit->duration >= stream->dtmf_duration) { 970 971 971 972 event->e_vol |= 0x80; … … 1304 1305 * RTP packets. 1305 1306 */ 1306 inc_timestamp = PJMEDIA_DTMF_DURATION+1307 inc_timestamp = stream->dtmf_duration + 1307 1308 ((DTMF_EBIT_RETRANSMIT_CNT-1) * 1308 1309 stream->rtp_tx_ts_len_per_pkt) … … 2361 2362 stream->plc_cnt = stream->max_plc_cnt; 2362 2363 2364 #if defined(PJMEDIA_DTMF_DURATION_MSEC) && (PJMEDIA_DTMF_DURATION_MSEC > 0) 2365 stream->dtmf_duration = PJMEDIA_DTMF_DURATION_MSEC * 2366 afd->clock_rate / 1000; 2367 #else 2368 stream->dtmf_duration = PJMEDIA_DTMF_DURATION; 2369 #endif 2370 2363 2371 #if defined(PJMEDIA_HANDLE_G722_MPEG_BUG) && (PJMEDIA_HANDLE_G722_MPEG_BUG!=0) 2364 2372 stream->rtp_rx_check_cnt = 50; … … 2376 2384 /* RTP clock rate = 1/2 real clock rate */ 2377 2385 stream->rtp_tx_ts_len_per_pkt >>= 1; 2386 #if defined(PJMEDIA_DTMF_DURATION_MSEC) && (PJMEDIA_DTMF_DURATION_MSEC > 0) 2387 stream->dtmf_duration >>= 1; 2388 #endif 2378 2389 } else if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 2379 2390 unsigned opus_ts_modifier = 48000 / afd->clock_rate; … … 2383 2394 stream->rtp_rx_ts_len_per_frame *= opus_ts_modifier; 2384 2395 stream->detect_ptime_change = PJ_TRUE; 2396 #if defined(PJMEDIA_DTMF_DURATION_MSEC) && (PJMEDIA_DTMF_DURATION_MSEC > 0) 2397 stream->dtmf_duration *= opus_ts_modifier; 2398 #endif 2385 2399 } 2386 2400 #endif
Note: See TracChangeset
for help on using the changeset viewer.