Index: webrtc/call/call.cc |
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
index 93b638a44864da8e129ac590c19aa78278ed2445..36bc5ade982f995d809e481e46faa83182d67d2c 100644 |
--- a/webrtc/call/call.cc |
+++ b/webrtc/call/call.cc |
@@ -9,7 +9,6 @@ |
*/ |
#include <string.h> |
- |
#include <algorithm> |
#include <map> |
#include <memory> |
@@ -22,6 +21,7 @@ |
#include "webrtc/base/checks.h" |
#include "webrtc/base/constructormagic.h" |
#include "webrtc/base/logging.h" |
+#include "webrtc/base/task_queue.h" |
#include "webrtc/base/thread_annotations.h" |
#include "webrtc/base/thread_checker.h" |
#include "webrtc/base/trace_event.h" |
@@ -133,6 +133,9 @@ class Call : public webrtc::Call, |
Clock* const clock_; |
const int num_cpu_cores_; |
+ // TODO(perkj): |worker_queu_| is supposed to replace |module_process_thread_| |
+ // in the long run. |
+ rtc::TaskQueue worker_queu_; |
tommi
2016/06/17 07:59:01
worker_queue_
perkj_webrtc
2016/06/27 14:34:34
Done.
|
const std::unique_ptr<ProcessThread> module_process_thread_; |
const std::unique_ptr<ProcessThread> pacer_thread_; |
const std::unique_ptr<CallStats> call_stats_; |
@@ -201,6 +204,7 @@ namespace internal { |
Call::Call(const Call::Config& config) |
: clock_(Clock::GetRealTimeClock()), |
num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
+ worker_queu_("worker_queue"), |
module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
pacer_thread_(ProcessThread::Create("PacerThread")), |
call_stats_(new CallStats(clock_)), |
@@ -419,8 +423,8 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream( |
// TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if |
// the call has already started. |
VideoSendStream* send_stream = new VideoSendStream( |
- num_cpu_cores_, module_process_thread_.get(), call_stats_.get(), |
- congestion_controller_.get(), bitrate_allocator_.get(), |
+ num_cpu_cores_, module_process_thread_.get(), &worker_queu_, |
+ call_stats_.get(), congestion_controller_.get(), bitrate_allocator_.get(), |
video_send_delay_stats_.get(), &remb_, event_log_, config, encoder_config, |
suspended_video_send_ssrcs_); |
{ |
@@ -461,11 +465,11 @@ void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
} |
RTC_CHECK(send_stream_impl != nullptr); |
- VideoSendStream::RtpStateMap rtp_state = send_stream_impl->GetRtpStates(); |
+ VideoSendStream::RtpStateMap rtp_state = |
+ send_stream_impl->StopPermanentlyAndGetRtpStates(); |
for (VideoSendStream::RtpStateMap::iterator it = rtp_state.begin(); |
- it != rtp_state.end(); |
- ++it) { |
+ it != rtp_state.end(); ++it) { |
suspended_video_send_ssrcs_[it->first] = it->second; |
} |
@@ -684,6 +688,15 @@ void Call::OnSentPacket(const rtc::SentPacket& sent_packet) { |
void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss, |
int64_t rtt_ms) { |
+ // TODO(perkj): Consider making sure CongestionController operates on |
+ // |worker_queu_|. |
+ if (!worker_queu_.IsCurrent()) { |
+ worker_queu_.PostTask([this, target_bitrate_bps, fraction_loss, rtt_ms] { |
+ OnNetworkChanged(target_bitrate_bps, fraction_loss, rtt_ms); |
+ }); |
+ return; |
+ } |
+ RTC_DCHECK_RUN_ON(&worker_queu_); |
bitrate_allocator_->OnNetworkChanged(target_bitrate_bps, fraction_loss, |
rtt_ms); |