Hi Tobias, There seems to be an easier workaround: i.e. to connect the audio to a sink during the early media instead. It can use null audio device or mute it if it doesn't want to play it at first. The patches seem to assume that: - the decoding is not connected during the silence frames, or - when we are sending silence frames, the remote are sending ones as well, which is not always true. Regards, Ming On Mon, Jul 23, 2018 at 11:01 PM, Tobias Schneider <tobias.schneider@xxxxxxxxxxxxxxxxxxxx> wrote: > This is variant 2 to fix that issue by directly calling > pjmedia_port_get_frame in stream.c after packet was sent via RTP to > ensure that there are "snychronous" calls of put- and get-frame. > > --- > pjmedia/src/pjmedia/stream.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c > index adcaa628..1f2d0457 100644 > --- a/pjmedia/src/pjmedia/stream.c > +++ b/pjmedia/src/pjmedia/stream.c > @@ -240,6 +240,12 @@ static const char digitmap[17] = { '0', '1', '2', '3', > /* Zero audio frame samples */ > static pj_int16_t zero_frame[2 * 30 * 16000 / 1000]; > > +/* null buffer to hold result of get_frame after transmit of NULL frame. > + * Make it big enough to hold any kind of media port size connected to conf > + * bridge, e.g. up to 30ms ptime and 16kHz samplerate > + */ > +static pj_int16_t null_buffer[2 * 30 * 16000 / 1000]; > + > /* > * Print error. > */ > @@ -1318,6 +1324,14 @@ static pj_status_t put_frame_imp( pjmedia_port *port, > (const void**)&rtphdr, > &rtphdrlen); > > + /* directly call get_frame of stream to avoid filling of JB during > + * silence period */ > + pjmedia_frame null_frame; > + pj_bzero(&null_frame, sizeof(null_frame)); > + null_frame.buf = null_buffer; > + null_frame.type = PJMEDIA_FRAME_TYPE_AUDIO; > + null_frame.size = stream->enc_samples_per_pkt * 2; > + pjmedia_port_get_frame(&stream->port, &null_frame); > > /* Encode audio frame */ > } else if ((frame->type == PJMEDIA_FRAME_TYPE_AUDIO && > -- > 2.13.7 > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@xxxxxxxxxxxxxxx > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org