receiving: pass received frame TS for futher sync

This commit is contained in:
Martin Pulec
2023-06-28 16:14:45 +02:00
parent 17f50eede2
commit 1784f2cedd
3 changed files with 6 additions and 2 deletions

View File

@@ -292,6 +292,7 @@ audio_frame2 audio_codec_decompress(struct audio_codec_state *s, audio_frame2 *f
if (out) {
if (!out_frame_initialized) {
ret.init(frame->get_channel_count(), AC_PCM, out->bps, out->sample_rate);
ret.set_timestamp(frame->get_timestamp());
out_frame_initialized = true;
} else {
assert(out->bps == ret.get_bps()

View File

@@ -84,12 +84,10 @@
using std::chrono::duration_cast;
using std::chrono::seconds;
using std::chrono::steady_clock;
using rang::fg;
using rang::style;
using std::fixed;
using std::hex;
using std::map;
using std::move;
using std::ostringstream;
using std::pair;
using std::setprecision;
@@ -650,6 +648,7 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
get_audio_codec_to_tag(decoder->saved_audio_tag),
decoder->saved_desc.bps,
decoder->saved_desc.sample_rate);
received_frame.set_timestamp(cdata->data->ts);
vector<pair<vector<char>, map<int, int>>> fec_data;
uint32_t fec_params = 0;
@@ -841,6 +840,7 @@ 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();
decoder->decoded.append(decompressed);

View File

@@ -441,6 +441,7 @@ static void *fec_thread(void *args) {
data->nofec_frame = vf_alloc(data->recv_frame->tile_count);
data->nofec_frame->ssrc = data->recv_frame->ssrc;
data->nofec_frame->timestamp = data->recv_frame->timestamp;
if (data->recv_frame->fec_params.type != FEC_NONE) {
bool buffer_swapped = false;
@@ -704,6 +705,7 @@ static void *decompress_thread(void *args) {
long long putf_timeout = force_putf_timeout != -1 ? force_putf_timeout : PUTF_NONBLOCK; // originally was BLOCKING when !is_codec_interframe(decoder->received_vid_desc.color_spec)
decoder->frame->ssrc = msg->nofec_frame->ssrc;
decoder->frame->timestamp = msg->nofec_frame->timestamp;
int ret = display_put_frame(decoder->display,
decoder->frame, putf_timeout);
msg->is_displayed = ret == 0;
@@ -1532,6 +1534,7 @@ int decode_video_frame(struct coded_data *cdata, void *decoder_data, struct pbuf
}
frame->ssrc = cdata->data->ssrc;
frame->timestamp = cdata->data->ts;
if (PT_VIDEO_HAS_FEC(cdata->data->pt)) {
const uint32_t *hdr = (uint32_t *)(void *)cdata->data->data;
const uint32_t tmp = ntohl(hdr[3]);