From: Steinar H. Gunderson Date: Sun, 17 Apr 2016 22:56:54 +0000 (+0200) Subject: Correct audio pts for framing. Still something fishy around, though. X-Git-Tag: 1.3.0~84 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=279aed5eebe0e50790c31b439ac39cace38ca746;p=nageru Correct audio pts for framing. Still something fishy around, though. --- diff --git a/h264encode.cpp b/h264encode.cpp index c1649e1..8c615b4 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -1698,14 +1698,17 @@ void H264EncoderImpl::encode_audio( return; } + int64_t sample_offset = audio_queue->size(); + audio_queue->insert(audio_queue->end(), audio.begin(), audio.end()); size_t sample_num; for (sample_num = 0; sample_num + ctx->frame_size * 2 <= audio_queue->size(); sample_num += ctx->frame_size * 2) { + int64_t adjusted_audio_pts = audio_pts + (int64_t(sample_num) - sample_offset) * TIMEBASE / (OUTPUT_FREQUENCY * 2); encode_audio_one_frame(&(*audio_queue)[sample_num], ctx->frame_size, - audio_pts, // FIXME: Must be increased or decreased as needed. + adjusted_audio_pts, ctx, resampler, destinations);