Skip to content

Commit 1b61386

Browse files
committed
audio decoder: support zero-len data
to be used by passive acap and the audio mixer for passive audio participants
1 parent 88e511f commit 1b61386

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,6 +3333,7 @@ fi
33333333

33343334
if test "$build_default" != no || test "$req_files" = all; then
33353335
ULTRAGRID_OBJS="$ULTRAGRID_OBJS
3336+
src/audio/capture/passive.o
33363337
src/audio/playback/dump.o
33373338
src/audio/playback/mixer.o
33383339
src/audio/filter/delay.o

src/audio/audio.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ static struct rtp *initialize_audio_network(struct audio_network_parameters *par
573573

574574
struct audio_decoder {
575575
bool enabled;
576+
bool decoded; ///< last frame was decoded
576577
struct pbuf_audio_data pbuf_data;
577578
};
578579

@@ -776,6 +777,7 @@ static void *audio_receiver_thread(void *arg)
776777

777778
struct audio_decoder *dec_state = (struct audio_decoder *) cp->decoder_state;
778779
if (dec_state && dec_state->enabled) {
780+
dec_state->decoded = false;
779781
dec_state->pbuf_data.buffer.data_len = 0;
780782
dec_state->pbuf_data.buffer.timestamp = -1;
781783
// We iterate in loop since there can be more than one frmae present in
@@ -785,6 +787,7 @@ static void *audio_receiver_thread(void *arg)
785787

786788
current_pbuf = &dec_state->pbuf_data;
787789
decoded = true;
790+
dec_state->decoded = true;
788791
}
789792
}
790793

@@ -845,7 +848,7 @@ static void *audio_receiver_thread(void *arg)
845848
cp = pdb_iter_init(s->audio_participants, &it);
846849
while (cp != NULL) {
847850
struct audio_decoder *dec_state = (struct audio_decoder *) cp->decoder_state;
848-
if (dec_state && dec_state->enabled && dec_state->pbuf_data.buffer.data_len > 0) {
851+
if (dec_state && dec_state->enabled && dec_state->decoded) {
849852
struct audio_frame *f = &dec_state->pbuf_data.buffer;
850853
f->network_source = &dec_state->pbuf_data.source;
851854
audio_playback_put_frame(s->audio_playback_device, f);

0 commit comments

Comments
 (0)