Skip to content

Commit

Permalink
Hunch that something might be broken wrt Thread and TQ
Browse files Browse the repository at this point in the history
integration in Chromium.

Change-Id: I5322fce1e874412a6b0a21ce16902d8846bcaf74
Bug: webrtc:11572
Tbr: henrika@webrtc.org
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175041
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31247}
  • Loading branch information
Tommi authored and Commit Bot committed May 13, 2020
1 parent adaec45 commit 47173c9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion video/receive_statistics_proxy2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/task_utils/to_queued_task.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/field_trial.h"
Expand Down Expand Up @@ -81,6 +82,20 @@ std::string UmaSuffixForContentType(VideoContentType content_type) {
return ss.str();
}

// TODO(https://bugs.webrtc.org/11572): Workaround for an issue with some
// rtc::Thread instances and/or implementations that don't register as the
// current task queue.
bool IsCurrentTaskQueueOrThread(TaskQueueBase* task_queue) {
if (task_queue->IsCurrent())
return true;

rtc::Thread* current_thread = rtc::ThreadManager::Instance()->CurrentThread();
if (!current_thread)
return false;

return static_cast<TaskQueueBase*>(current_thread) == task_queue;
}

} // namespace

ReceiveStatisticsProxy::ReceiveStatisticsProxy(
Expand Down Expand Up @@ -766,7 +781,7 @@ void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
if (ssrc != remote_ssrc_)
return;

if (!worker_thread_->IsCurrent()) {
if (!IsCurrentTaskQueueOrThread(worker_thread_)) {
// RtpRtcp::Configuration has a single RtcpPacketTypeCounterObserver and
// that same configuration may be used for both receiver and sender
// (see ModuleRtpRtcpImpl::ModuleRtpRtcpImpl).
Expand Down

0 comments on commit 47173c9

Please sign in to comment.