summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2008-09-27 11:50:17 +0000
committerNanang Izzuddin <nanang@teluu.com>2008-09-27 11:50:17 +0000
commitb047166d80fd7fe70452eab2dbd6b34d0a81175d (patch)
tree528b91b29401662f11a350e22045ccf2a3dc34fc /pjmedia
parentfd557a69a1d827dcf04a596f0d4bb222101e3e21 (diff)
Fixed possible assertion by codec when stereo/multichannel codec is used and stream is about to send keep-NAT-alive packet (thanks Bill Gardner for the patch).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2328 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/stream.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c
index 736362c4..081224ec 100644
--- a/pjmedia/src/pjmedia/stream.c
+++ b/pjmedia/src/pjmedia/stream.c
@@ -179,7 +179,7 @@ static const char digitmap[16] = { '0', '1', '2', '3',
'A', 'B', 'C', 'D'};
/* Zero audio frame samples */
-static pj_int16_t zero_frame[30 * 16000 / 1000];
+static pj_int16_t zero_frame[2 * 30 * 16000 / 1000];
/*
* Print error.
@@ -755,7 +755,8 @@ static pj_status_t put_frame_imp( pjmedia_port *port,
frame->buf == NULL &&
(stream->dir & PJMEDIA_DIR_ENCODING) &&
stream->codec_param.info.frm_ptime *
- stream->codec_param.info.clock_rate/1000 <
+ stream->codec_param.info.channel_cnt *
+ stream->codec_param.info.clock_rate/1000 <
PJ_ARRAY_SIZE(zero_frame))
{
pjmedia_frame silence_frame;
@@ -763,7 +764,8 @@ static pj_status_t put_frame_imp( pjmedia_port *port,
pj_bzero(&silence_frame, sizeof(silence_frame));
silence_frame.buf = zero_frame;
silence_frame.size = stream->codec_param.info.frm_ptime * 2 *
- stream->codec_param.info.clock_rate / 1000;
+ stream->codec_param.info.channel_cnt *
+ stream->codec_param.info.clock_rate / 1000;
silence_frame.type = PJMEDIA_FRAME_TYPE_AUDIO;
silence_frame.timestamp.u32.lo = pj_ntohl(stream->enc->rtp.out_hdr.ts);