Another fix for ticket #447: WAV player cuts last data from the WAV file
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1685 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
9b65ba5007
commit
39e232add0
|
@ -515,13 +515,6 @@ static pj_status_t file_get_frame(pjmedia_port *this_port,
|
||||||
|
|
||||||
pj_assert(fport->base.info.signature == SIGNATURE);
|
pj_assert(fport->base.info.signature == SIGNATURE);
|
||||||
|
|
||||||
/* Check EOF */
|
|
||||||
if (fport->eof) {
|
|
||||||
frame->type = PJMEDIA_FRAME_TYPE_NONE;
|
|
||||||
frame->size = 0;
|
|
||||||
return PJ_EEOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
//frame_size = fport->base.info.bytes_per_frame;
|
//frame_size = fport->base.info.bytes_per_frame;
|
||||||
//pj_assert(frame->size == frame_size);
|
//pj_assert(frame->size == frame_size);
|
||||||
frame_size = frame->size;
|
frame_size = frame->size;
|
||||||
|
@ -560,9 +553,16 @@ static pj_status_t file_get_frame(pjmedia_port *this_port,
|
||||||
/* Second stage: fill up buffer, and read from the start of buffer. */
|
/* Second stage: fill up buffer, and read from the start of buffer. */
|
||||||
status = fill_buffer(fport);
|
status = fill_buffer(fport);
|
||||||
if (status != PJ_SUCCESS) {
|
if (status != PJ_SUCCESS) {
|
||||||
|
/* If we don't get anything, return NONE frame. Otherwise
|
||||||
|
* return AUDIO frame since we have partial audio.
|
||||||
|
*/
|
||||||
|
if (endread == 0) {
|
||||||
|
frame->type = PJMEDIA_FRAME_TYPE_NONE;
|
||||||
|
} else {
|
||||||
pj_bzero(((char*)frame->buf)+endread, frame_size-endread);
|
pj_bzero(((char*)frame->buf)+endread, frame_size-endread);
|
||||||
|
}
|
||||||
fport->readpos = fport->buf + fport->bufsize;
|
fport->readpos = fport->buf + fport->bufsize;
|
||||||
return status;
|
return PJ_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
pj_memcpy(((char*)frame->buf)+endread, fport->buf, frame_size-endread);
|
pj_memcpy(((char*)frame->buf)+endread, fport->buf, frame_size-endread);
|
||||||
|
|
Loading…
Reference in New Issue