Skip to content

Commit

Permalink
Fixing audio timestamp stall during inactivation (under a kill switch)
Browse files Browse the repository at this point in the history
TEST: tested on chromium.

(cherry picked from commit 49dbad0)

No-Try: True
Bug: webrtc:12397, chromium:1171206
Change-Id: I1e15605f90e253a6ef61ab7ead8c576a80e8f01b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203886
Reviewed-by: Jakob Ivarsson <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Reviewed-by: Sam Zackrisson <[email protected]>
Commit-Queue: Minyue Li <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#33080}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/204302
Reviewed-by: Mirko Bonadei <[email protected]>
Reviewed-by: Minyue Li <[email protected]>
Cr-Commit-Position: refs/branch-heads/4389@{#4}
Cr-Branched-From: 7acc2d9-refs/heads/master@{#32986}
  • Loading branch information
minyuel committed Jan 29, 2021
1 parent 54d4910 commit a63d8d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion audio/channel_send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ class ChannelSend : public ChannelSendInterface,
// Defined last to ensure that there are no running tasks when the other
// members are destroyed.
rtc::TaskQueue encoder_queue_;

const bool fixing_timestamp_stall_;
};

const int kTelephoneEventAttenuationdB = 10;
Expand Down Expand Up @@ -471,7 +473,9 @@ ChannelSend::ChannelSend(
crypto_options_(crypto_options),
encoder_queue_(task_queue_factory->CreateTaskQueue(
"AudioEncoder",
TaskQueueFactory::Priority::NORMAL)) {
TaskQueueFactory::Priority::NORMAL)),
fixing_timestamp_stall_(
!field_trial::IsDisabled("WebRTC-Audio-FixTimestampStall")) {
RTC_DCHECK(module_process_thread);
module_process_thread_checker_.Detach();

Expand Down Expand Up @@ -808,6 +812,10 @@ void ChannelSend::ProcessAndEncodeAudio(
[this, audio_frame = std::move(audio_frame)]() mutable {
RTC_DCHECK_RUN_ON(&encoder_queue_);
if (!encoder_queue_is_active_) {
if (fixing_timestamp_stall_) {
_timeStamp +=
static_cast<uint32_t>(audio_frame->samples_per_channel_);
}
return;
}
// Measure time between when the audio frame is added to the task queue
Expand Down

0 comments on commit a63d8d0

Please sign in to comment.