Resample port get frame may cause buffer overflow when downport returns non-audio frame
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1955 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
23110bf308
commit
3fd3af9a31
|
@ -185,9 +185,11 @@ static pj_status_t resample_get_frame(pjmedia_port *this_port,
|
|||
if (tmp_frame.type != PJMEDIA_FRAME_TYPE_AUDIO) {
|
||||
frame->type = tmp_frame.type;
|
||||
frame->timestamp = tmp_frame.timestamp;
|
||||
frame->size = tmp_frame.size;
|
||||
/* Copy whatever returned as long as the buffer size is enough */
|
||||
frame->size = tmp_frame.size < rport->base.info.bytes_per_frame ?
|
||||
tmp_frame.size : rport->base.info.bytes_per_frame;
|
||||
if (tmp_frame.size)
|
||||
pj_memcpy(frame->buf, tmp_frame.buf, tmp_frame.size);
|
||||
pjmedia_copy_samples(frame->buf, tmp_frame.buf, frame->size >> 1);
|
||||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue