Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(983)

Unified Diff: webrtc/modules/pacing/paced_sender.cc

Issue 2746153002: Return a long timeout value from TimeUntilNextProcess when the PacedSender is paused (Closed)
Patch Set: Update BUILD.gn Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/pacing/paced_sender.cc
diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc
index 3421d3a817cddb71e457bb3276310f2197b7ff46..bae924f61c504a4fdbf57053b36cbf0647c7d968 100644
--- a/webrtc/modules/pacing/paced_sender.cc
+++ b/webrtc/modules/pacing/paced_sender.cc
@@ -21,6 +21,7 @@
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/pacing/alr_detector.h"
#include "webrtc/modules/pacing/bitrate_prober.h"
+#include "webrtc/modules/utility/include/process_thread.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/field_trial.h"
@@ -275,14 +276,22 @@ void PacedSender::CreateProbeCluster(int bitrate_bps) {
void PacedSender::Pause() {
LOG(LS_INFO) << "PacedSender paused.";
- CriticalSectionScoped cs(critsect_.get());
- paused_ = true;
+ {
+ CriticalSectionScoped cs(critsect_.get());
+ paused_ = true;
+ }
+ if (process_thread_)
+ process_thread_->WakeUp(this);
stefan-webrtc 2017/03/15 12:43:18 Is there a point in waking up the thread if we're
tommi 2017/03/15 13:42:56 Yes, I added a comment that explains why: // Te
}
void PacedSender::Resume() {
LOG(LS_INFO) << "PacedSender resumed.";
- CriticalSectionScoped cs(critsect_.get());
- paused_ = false;
+ {
+ CriticalSectionScoped cs(critsect_.get());
+ paused_ = false;
+ }
+ if (process_thread_)
+ process_thread_->WakeUp(this);
}
void PacedSender::SetProbingEnabled(bool enabled) {
@@ -373,6 +382,9 @@ int64_t PacedSender::AverageQueueTimeMs() {
int64_t PacedSender::TimeUntilNextProcess() {
CriticalSectionScoped cs(critsect_.get());
+ if (paused_)
+ return 1000 * 60 * 60;
+
if (prober_->IsProbing()) {
int64_t ret = prober_->TimeUntilNextProbe(clock_->TimeInMilliseconds());
if (ret > 0 || (ret == 0 && !probing_send_failure_))
@@ -457,6 +469,11 @@ void PacedSender::Process() {
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
}
+void PacedSender::ProcessThreadAttached(ProcessThread* process_thread) {
stefan-webrtc 2017/03/15 12:43:18 We're never detaching because the thread is assume
tommi 2017/03/15 13:42:56 This method is called when the module is registere
stefan-webrtc 2017/03/15 13:51:17 I see, thanks
+ LOG(LS_INFO) << "ProcessThreadAttached 0x" << std::hex << process_thread;
+ process_thread_ = process_thread;
+}
+
bool PacedSender::SendPacket(const paced_sender::Packet& packet,
const PacedPacketInfo& pacing_info) {
if (paused_)

Powered by Google App Engine
This is Rietveld 408576698