Commit a4757b67 authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud

recorder: sync local audio with peer audio

Local audio timestamps would always start at 0, while peer audio would
start at the right value, causing audio to be out of sync.

Change-Id: I5c3c2967128b88b2867c5bd26d5f7de1e93f4171
parent 7df421b2
......@@ -88,7 +88,7 @@ AudioInput::process()
auto audioFrame = resampled.toAVFrame();
auto frame = audioFrame->pointer();
auto ms = MediaStream("a:local", format_);
auto ms = MediaStream("a:local", format_, sent_samples);
frame->pts = sent_samples;
sent_samples += frame->nb_samples;
......
......@@ -68,10 +68,15 @@ struct MediaStream {
{}
MediaStream(const std::string& streamName, AudioFormat fmt)
: MediaStream(streamName, fmt, 0)
{}
MediaStream(const std::string& streamName, AudioFormat fmt, int64_t firstTimestamp)
: name(streamName)
, format(fmt.sampleFormat)
, isVideo(false)
, timeBase(1, fmt.sample_rate)
, firstTimestamp(firstTimestamp)
, sampleRate(fmt.sample_rate)
, nbChannels(fmt.nb_channels)
, frameSize(fmt.sample_rate / 50) // standard frame size for our encoder is 20 ms
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment