Closed MayamaTakeshi closed 1 month ago
The assertion failure happens from HERE:
static pj_status_t get_frame( pjmedia_port *port, pjmedia_frame *frame)
{
pjmedia_stream *stream = (pjmedia_stream*) port->port_data.pdata;
pjmedia_channel *channel = stream->dec;
unsigned samples_count, samples_per_frame, samples_required;
pj_int16_t *p_out_samp;
pj_status_t status;
/* Return no frame is channel is paused */
if (channel->paused) {
frame->type = PJMEDIA_FRAME_TYPE_NONE;
return PJ_SUCCESS;
}
if (stream->soft_start_cnt) {
if (stream->soft_start_cnt == PJMEDIA_STREAM_SOFT_START) {
PJ_LOG(4,(stream->port.info.name.ptr,
"Resetting jitter buffer in stream playback start"));
pj_mutex_lock( stream->jb_mutex );
pjmedia_jbuf_reset(stream->jb);
pj_mutex_unlock( stream->jb_mutex );
}
--stream->soft_start_cnt;
frame->type = PJMEDIA_FRAME_TYPE_NONE;
return PJ_SUCCESS;
}
/* Repeat get frame from the jitter buffer and decode the frame
* until we have enough frames according to codec's ptime.
*/
/* Lock jitter buffer mutex first */
pj_mutex_lock( stream->jb_mutex ); // HERE (pjmedia/src/pjmedia/stream.c:554)
So it is likely, the stream object might have been discarded at that point and the working thread is still using it.
However, this is not specific to PCMA (samples/g729.js can also cause this). This is just the easiest way to reproduce this issue (as the script is short and doesn't wait for lengthy operations like dtmf detection).
Commit: 73030106bea75db7c208edce73bed10fd95a542d