Hello Ming, for me it is okay to have a workaround like connecting audio stream to null audio device, even though the code change for this is much bigger than some fixes in PJMedia. I also doubt that it is desired behaviour of PJMedia, that the jitterbuffer gets filled to maximum capacity if user does not connect any sink to a running audio stream, but thats your decision of course. Anyway, as my patches might not cover all corner cases, it is safer for now to use the above mentioned workaround. Regards, Tobias On 24.07.2018 10:12, Ming wrote: > 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 -- Dipl.-Ing. (FH) Tobias Schneider, M. Sc. voice INTER connect GmbH Ammonstraße 35, 01067 Dresden, Germany phone: +49 351 407526-64 <https://telefonanlage.vic.site/modules/dial.php?Predial=0&Extension=364&Number=035140752664> fax: +49 351 407526-55 <https://telefonanlage.vic.site/modules/dial.php?Predial=0&Extension=364&Number=035140752655> eMail: tobias.schneider@xxxxxxxxxxxxxxxxxxxx visit: www.voiceinterconnect.de Geschäftsführung: Eingetragen im Handelsregister: Dr.-Ing. Diane Hirschfeld, Amtsgericht Dresden HRB 19466 Ludwig Linkenheil ... smart signal processing for electronic devices _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org