Skip to content

Commit

Permalink
audio dec: set timestamp from first packet
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Oct 16, 2023
1 parent a544c26 commit 4722eaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ static void *audio_receiver_thread(void *arg)
struct audio_decoder *dec_state = (struct audio_decoder *) cp->decoder_state;
if (dec_state && dec_state->enabled) {
dec_state->pbuf_data.buffer.data_len = 0;
dec_state->pbuf_data.buffer.timestamp = -1;
// We iterate in loop since there can be more than one frmae present in
// the playout buffer and it would be discarded by following pbuf_remove()
// call.
Expand Down
4 changes: 3 additions & 1 deletion src/rtp/audio_decoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,9 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
}
}
s->buffer.data_len = new_data_len;
s->buffer.timestamp = decompressed.get_timestamp();
if (s->buffer.timestamp == -1) {
s->buffer.timestamp = decompressed.get_timestamp();
}

decoder->decoded.append(decompressed);

Expand Down

0 comments on commit 4722eaa

Please sign in to comment.