diff --git a/webrtc/api/test/fakeaudiocapturemodule.cc b/webrtc/api/test/fakeaudiocapturemodule.cc index 0b6478ed2f..b85f30b836 100644 --- a/webrtc/api/test/fakeaudiocapturemodule.cc +++ b/webrtc/api/test/fakeaudiocapturemodule.cc @@ -85,8 +85,9 @@ int64_t FakeAudioCaptureModule::TimeUntilNextProcess() { return kAdmMaxIdleTimeProcess - elapsed_time; } -void FakeAudioCaptureModule::Process() { +int32_t FakeAudioCaptureModule::Process() { last_process_time_ms_ = rtc::Time(); + return 0; } int32_t FakeAudioCaptureModule::ActiveAudioLayer( diff --git a/webrtc/api/test/fakeaudiocapturemodule.h b/webrtc/api/test/fakeaudiocapturemodule.h index 9200bdf6f3..c27d02df64 100644 --- a/webrtc/api/test/fakeaudiocapturemodule.h +++ b/webrtc/api/test/fakeaudiocapturemodule.h @@ -56,7 +56,7 @@ class FakeAudioCaptureModule // nothing and return success. If a function is not expected to be called by // PeerConnection an assertion is triggered if it is in fact called. int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override; diff --git a/webrtc/api/test/fakeaudiocapturemodule_unittest.cc b/webrtc/api/test/fakeaudiocapturemodule_unittest.cc index 2c5730a813..1611b81ddd 100644 --- a/webrtc/api/test/fakeaudiocapturemodule_unittest.cc +++ b/webrtc/api/test/fakeaudiocapturemodule_unittest.cc @@ -123,8 +123,8 @@ TEST_F(FakeAdmTest, TestProccess) { // Next process call must be some time in the future (or now). EXPECT_LE(0, fake_audio_capture_module_->TimeUntilNextProcess()); // Process call updates TimeUntilNextProcess() but there are no guarantees on - // timing so just check that Process can be called successfully. - fake_audio_capture_module_->Process(); + // timing so just check that Process can ba called successfully. + EXPECT_LE(0, fake_audio_capture_module_->Process()); } TEST_F(FakeAdmTest, PlayoutTest) { diff --git a/webrtc/media/engine/fakewebrtcvideocapturemodule.h b/webrtc/media/engine/fakewebrtcvideocapturemodule.h index 43f72b9538..8c63d2b6e1 100644 --- a/webrtc/media/engine/fakewebrtcvideocapturemodule.h +++ b/webrtc/media/engine/fakewebrtcvideocapturemodule.h @@ -30,7 +30,7 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { delay_(0) { } int64_t TimeUntilNextProcess() override { return 0; } - void Process() override {} + int32_t Process() override { return 0; } void RegisterCaptureDataCallback( webrtc::VideoCaptureDataCallback& callback) override { callback_ = &callback; diff --git a/webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h b/webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h index 7b14f2f79d..7370442704 100644 --- a/webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h +++ b/webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h @@ -40,7 +40,7 @@ public: // Module functions int64_t TimeUntilNextProcess() override = 0; - void Process() override = 0; + int32_t Process() override = 0; // Register/unregister a callback class for receiving the mixed audio. virtual int32_t RegisterMixedStreamCallback( diff --git a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc index 1d7602533e..9411a9a47e 100644 --- a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc +++ b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc @@ -189,7 +189,7 @@ int64_t AudioConferenceMixerImpl::TimeUntilNextProcess() { return timeUntilNextProcess; } -void AudioConferenceMixerImpl::Process() { +int32_t AudioConferenceMixerImpl::Process() { size_t remainingParticipantsAllowedToMix = kMaximumAmountOfMixedParticipants; { @@ -222,7 +222,7 @@ void AudioConferenceMixerImpl::Process() { if(lowFreq <= 0) { CriticalSectionScoped cs(_crit.get()); _processCalls--; - return; + return 0; } else { switch(lowFreq) { case 8000: @@ -250,7 +250,7 @@ void AudioConferenceMixerImpl::Process() { CriticalSectionScoped cs(_crit.get()); _processCalls--; - return; + return -1; } } @@ -267,9 +267,10 @@ void AudioConferenceMixerImpl::Process() { WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, "failed PopMemory() call"); assert(false); - return; + return -1; } + int retval = 0; { CriticalSectionScoped cs(_crit.get()); @@ -303,7 +304,8 @@ void AudioConferenceMixerImpl::Process() { mixedAudio->Mute(); } else { // Only call the limiter if we have something to mix. - LimitMixedAudio(mixedAudio); + if(!LimitMixedAudio(mixedAudio)) + retval = -1; } } @@ -328,7 +330,7 @@ void AudioConferenceMixerImpl::Process() { CriticalSectionScoped cs(_crit.get()); _processCalls--; } - return; + return retval; } int32_t AudioConferenceMixerImpl::RegisterMixedStreamCallback( diff --git a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.h b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.h index 13d30c3a71..0fab84ba81 100644 --- a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.h +++ b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.h @@ -64,7 +64,7 @@ public: // Module functions int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; // AudioConferenceMixer functions int32_t RegisterMixedStreamCallback( diff --git a/webrtc/modules/audio_conference_mixer/test/audio_conference_mixer_unittest.cc b/webrtc/modules/audio_conference_mixer/test/audio_conference_mixer_unittest.cc index f393e0f029..293bfa0db9 100644 --- a/webrtc/modules/audio_conference_mixer/test/audio_conference_mixer_unittest.cc +++ b/webrtc/modules/audio_conference_mixer/test/audio_conference_mixer_unittest.cc @@ -145,7 +145,7 @@ TEST(AudioConferenceMixer, LargestEnergyVadActiveMixed) { EXPECT_CALL(output_receiver, NewMixedAudio(_, _, _, _)) .Times(AtLeast(1)); - mixer->Process(); + EXPECT_EQ(0, mixer->Process()); for (int i = 0; i < kParticipants; ++i) { bool is_mixed = participants[i].IsMixed(); diff --git a/webrtc/modules/audio_device/audio_device_impl.cc b/webrtc/modules/audio_device/audio_device_impl.cc index 6496f5efc4..a11c496289 100644 --- a/webrtc/modules/audio_device/audio_device_impl.cc +++ b/webrtc/modules/audio_device/audio_device_impl.cc @@ -427,7 +427,7 @@ int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() // new reports exists. // ---------------------------------------------------------------------------- -void AudioDeviceModuleImpl::Process() +int32_t AudioDeviceModuleImpl::Process() { _lastProcessTime = TickTime::MillisecondTimestamp(); @@ -479,6 +479,8 @@ void AudioDeviceModuleImpl::Process() } _ptrAudioDevice->ClearRecordingError(); } + + return 0; } // ============================================================================ diff --git a/webrtc/modules/audio_device/audio_device_impl.h b/webrtc/modules/audio_device/audio_device_impl.h index d7c48abf17..c7312bf4b0 100644 --- a/webrtc/modules/audio_device/audio_device_impl.h +++ b/webrtc/modules/audio_device/audio_device_impl.h @@ -45,7 +45,7 @@ class AudioDeviceModuleImpl : public AudioDeviceModule { virtual ~AudioDeviceModuleImpl(); int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; // Factory methods (resource allocation/deallocation) static AudioDeviceModule* Create( diff --git a/webrtc/modules/audio_device/include/fake_audio_device.h b/webrtc/modules/audio_device/include/fake_audio_device.h index 45bf45c181..8b154794c7 100644 --- a/webrtc/modules/audio_device/include/fake_audio_device.h +++ b/webrtc/modules/audio_device/include/fake_audio_device.h @@ -37,7 +37,7 @@ class FakeAudioDeviceModule : public AudioDeviceModule { virtual int32_t SetAGC(bool enable) { return 0; } virtual int32_t StopRecording() { return 0; } virtual int64_t TimeUntilNextProcess() { return 0; } - virtual void Process() {} + virtual int32_t Process() { return 0; } virtual int32_t Terminate() { return 0; } virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const { return 0; } diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc index bf608789d5..72a5ff510d 100644 --- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc +++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc @@ -162,15 +162,16 @@ int64_t BitrateControllerImpl::TimeUntilNextProcess() { kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); } -void BitrateControllerImpl::Process() { +int32_t BitrateControllerImpl::Process() { if (TimeUntilNextProcess() > 0) - return; + return 0; { rtc::CritScope cs(&critsect_); bandwidth_estimation_.UpdateEstimate(clock_->TimeInMilliseconds()); } MaybeTriggerOnNetworkChanged(); last_bitrate_update_ms_ = clock_->TimeInMilliseconds(); + return 0; } void BitrateControllerImpl::OnReceivedRtcpReceiverReport( diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.h b/webrtc/modules/bitrate_controller/bitrate_controller_impl.h index da42b4c749..74f3c14334 100644 --- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.h +++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.h @@ -45,7 +45,7 @@ class BitrateControllerImpl : public BitrateController { void SetEventLog(RtcEventLog* event_log) override; int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; private: class RtcpBandwidthObserverImpl; diff --git a/webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h b/webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h index 45b596a868..8748696d45 100644 --- a/webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h +++ b/webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h @@ -36,7 +36,7 @@ class MockBitrateController : public BitrateController { MOCK_CONST_METHOD1(AvailableBandwidth, bool(uint32_t* bandwidth)); MOCK_METHOD1(SetReservedBitrate, void(uint32_t reserved_bitrate_bps)); - MOCK_METHOD0(Process, void()); + MOCK_METHOD0(Process, int()); MOCK_METHOD0(TimeUntilNextProcess, int64_t()); }; } // namespace test diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc index f9e7e018e5..50074d50e4 100644 --- a/webrtc/modules/congestion_controller/congestion_controller.cc +++ b/webrtc/modules/congestion_controller/congestion_controller.cc @@ -53,9 +53,9 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator { rbe_->IncomingPacket(arrival_time_ms, payload_size, header, was_paced); } - void Process() override { + int32_t Process() override { CriticalSectionScoped cs(crit_sect_.get()); - rbe_->Process(); + return rbe_->Process(); } int64_t TimeUntilNextProcess() override { @@ -241,9 +241,10 @@ int64_t CongestionController::TimeUntilNextProcess() { remote_bitrate_estimator_->TimeUntilNextProcess()); } -void CongestionController::Process() { +int32_t CongestionController::Process() { bitrate_controller_->Process(); remote_bitrate_estimator_->Process(); + return 0; } } // namespace webrtc diff --git a/webrtc/modules/congestion_controller/include/congestion_controller.h b/webrtc/modules/congestion_controller/include/congestion_controller.h index 2c0b2e3d79..f4381e2a4d 100644 --- a/webrtc/modules/congestion_controller/include/congestion_controller.h +++ b/webrtc/modules/congestion_controller/include/congestion_controller.h @@ -65,7 +65,7 @@ class CongestionController : public CallStatsObserver, public Module { // Implements Module. int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; private: Clock* const clock_; diff --git a/webrtc/modules/include/module.h b/webrtc/modules/include/module.h index 432ed409ee..d02aa95dc8 100644 --- a/webrtc/modules/include/module.h +++ b/webrtc/modules/include/module.h @@ -32,7 +32,7 @@ class Module { // Process any pending tasks such as timeouts. // Called on a worker thread. - virtual void Process() = 0; + virtual int32_t Process() = 0; // This method is called when the module is attached to a *running* process // thread or detached from one. In the case of detaching, |process_thread| diff --git a/webrtc/modules/media_file/media_file_impl.cc b/webrtc/modules/media_file/media_file_impl.cc index 76bcca74d2..abc7b9d9e0 100644 --- a/webrtc/modules/media_file/media_file_impl.cc +++ b/webrtc/modules/media_file/media_file_impl.cc @@ -95,10 +95,11 @@ int64_t MediaFileImpl::TimeUntilNextProcess() return -1; } -void MediaFileImpl::Process() +int32_t MediaFileImpl::Process() { WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, "Process: This method is not used by MediaFile class."); + return -1; } int32_t MediaFileImpl::PlayoutAudioData(int8_t* buffer, diff --git a/webrtc/modules/media_file/media_file_impl.h b/webrtc/modules/media_file/media_file_impl.h index 677098e8fc..c23f514c75 100644 --- a/webrtc/modules/media_file/media_file_impl.h +++ b/webrtc/modules/media_file/media_file_impl.h @@ -26,7 +26,7 @@ public: MediaFileImpl(const int32_t id); ~MediaFileImpl(); - void Process() override; + int32_t Process() override; int64_t TimeUntilNextProcess() override; // MediaFile functions diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc index 6998650979..c32d365668 100644 --- a/webrtc/modules/pacing/paced_sender.cc +++ b/webrtc/modules/pacing/paced_sender.cc @@ -373,7 +373,7 @@ int64_t PacedSender::TimeUntilNextProcess() { return std::max(kMinPacketLimitMs - elapsed_time_ms, 0); } -void PacedSender::Process() { +int32_t PacedSender::Process() { int64_t now_us = clock_->TimeInMicroseconds(); CriticalSectionScoped cs(critsect_.get()); int64_t elapsed_time_ms = (now_us - time_last_update_us_ + 500) / 1000; @@ -402,7 +402,7 @@ void PacedSender::Process() { } while (!packets_->Empty()) { if (media_budget_->bytes_remaining() == 0 && !prober_->IsProbing()) - return; + return 0; // Since we need to release the lock in order to send, we first pop the // element from the priority queue but keep it in storage, so that we can @@ -413,17 +413,17 @@ void PacedSender::Process() { // Send succeeded, remove it from the queue. packets_->FinalizePop(packet); if (prober_->IsProbing()) - return; + return 0; } else { // Send failed, put it back into the queue. packets_->CancelPop(packet); - return; + return 0; } } // TODO(holmer): Remove the paused_ check when issue 5307 has been fixed. if (paused_ || !packets_->Empty()) - return; + return 0; size_t padding_needed; if (prober_->IsProbing()) { @@ -434,6 +434,7 @@ void PacedSender::Process() { if (padding_needed > 0) SendPadding(static_cast(padding_needed)); + return 0; } bool PacedSender::SendPacket(const paced_sender::Packet& packet) { diff --git a/webrtc/modules/pacing/paced_sender.h b/webrtc/modules/pacing/paced_sender.h index e2c757dc8f..62e794fdbc 100644 --- a/webrtc/modules/pacing/paced_sender.h +++ b/webrtc/modules/pacing/paced_sender.h @@ -122,7 +122,7 @@ class PacedSender : public Module, public RtpPacketSender { int64_t TimeUntilNextProcess() override; // Process any pending packets in the queue(s). - void Process() override; + int32_t Process() override; private: // Updates the number of bytes that can be sent for the next time interval. diff --git a/webrtc/modules/pacing/paced_sender_unittest.cc b/webrtc/modules/pacing/paced_sender_unittest.cc index 2c1383346d..70ffc75c92 100644 --- a/webrtc/modules/pacing/paced_sender_unittest.cc +++ b/webrtc/modules/pacing/paced_sender_unittest.cc @@ -222,12 +222,12 @@ TEST_F(PacedSenderTest, PaceQueuedPackets) { .Times(3) .WillRepeatedly(Return(true)); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); } EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); SendAndExpectPacket(PacedSender::kNormalPriority, ssrc, sequence_number++, @@ -290,12 +290,12 @@ TEST_F(PacedSenderTest, PaceQueuedPacketsWithDuplicates) { .WillRepeatedly(Return(true)); } EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); } EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); SendAndExpectPacket(PacedSender::kNormalPriority, ssrc, sequence_number++, @@ -373,7 +373,7 @@ TEST_F(PacedSenderTest, Padding) { EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); // 5 milliseconds later we have enough budget to send some padding. EXPECT_CALL(callback_, TimeToSendPadding(250)).Times(1). @@ -381,7 +381,7 @@ TEST_F(PacedSenderTest, Padding) { EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); } TEST_F(PacedSenderTest, VerifyPaddingUpToBitrate) { @@ -486,7 +486,7 @@ TEST_F(PacedSenderTest, Priority) { EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); EXPECT_CALL(callback_, TimeToSendPacket( @@ -497,7 +497,7 @@ TEST_F(PacedSenderTest, Priority) { EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); } TEST_F(PacedSenderTest, HighPrioDoesntAffectBudget) { @@ -587,7 +587,7 @@ TEST_F(PacedSenderTest, Pause) { for (int i = 0; i < 10; ++i) { clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); } // Expect high prio packets to come out first followed by all packets in the // way they were added. @@ -602,7 +602,7 @@ TEST_F(PacedSenderTest, Pause) { EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); clock_.AdvanceTimeMilliseconds(5); EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); - send_bucket_->Process(); + EXPECT_EQ(0, send_bucket_->Process()); EXPECT_EQ(0, send_bucket_->QueueInMs()); } diff --git a/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h b/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h index 2c35df872b..588e1e714a 100644 --- a/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h +++ b/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h @@ -37,7 +37,7 @@ class MockRemoteBitrateEstimator : public RemoteBitrateEstimator { // From Module. MOCK_METHOD0(TimeUntilNextProcess, int64_t()); - MOCK_METHOD0(Process, void()); + MOCK_METHOD0(Process, int32_t()); MOCK_METHOD1(SetMinBitrate, void(int)); }; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc index bf3fdc23df..db54cab43c 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc @@ -333,7 +333,9 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( } } -void RemoteBitrateEstimatorAbsSendTime::Process() {} +int32_t RemoteBitrateEstimatorAbsSendTime::Process() { + return 0; +} int64_t RemoteBitrateEstimatorAbsSendTime::TimeUntilNextProcess() { const int64_t kDisabledModuleTime = 1000; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h index 39d3e032a7..69b777395d 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h @@ -82,7 +82,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { // every other second) for streams to be timed out properly. Therefore it // shouldn't be detached from the ProcessThread except if it's about to be // deleted. - void Process() override; + int32_t Process() override; int64_t TimeUntilNextProcess() override; void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; void RemoveStream(uint32_t ssrc) override; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc index 7d39b03666..c1a498806b 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc @@ -93,10 +93,10 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProcessAfterTimeout) { IncomingPacket(0, 1000, clock_.TimeInMilliseconds(), 0, 0, true); clock_.AdvanceTimeMilliseconds(kStreamTimeOutMs + 1); // Trigger timeout. - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); clock_.AdvanceTimeMilliseconds(kProcessIntervalMs); // This shouldn't crash. - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); } TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetection) { @@ -118,7 +118,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetection) { true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_GT(bitrate_observer_->latest_bitrate(), 1500000u); } @@ -140,7 +140,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, false); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_GT(bitrate_observer_->latest_bitrate(), 800000u); } @@ -171,7 +171,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, AbsSendTime(send_time_ms, 1000), true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 800000u, 10000); } @@ -191,7 +191,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, AbsSendTime(send_time_ms, 1000), true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_GT(bitrate_observer_->latest_bitrate(), 800000u); } @@ -210,7 +210,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetectionFasterArrival) { AbsSendTime(send_time_ms, 1000), true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_FALSE(bitrate_observer_->updated()); } @@ -228,7 +228,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetectionSlowerArrival) { AbsSendTime(send_time_ms, 1000), true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 1140000, 10000); } @@ -248,7 +248,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, AbsSendTime(send_time_ms, 1000), true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 4000000u, 10000); } @@ -265,7 +265,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, ProbingIgnoresSmallPackets) { true); } - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_FALSE(bitrate_observer_->updated()); // Followed by a probe with 1000 bytes packets, should be detected as a @@ -280,7 +280,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, ProbingIgnoresSmallPackets) { // Wait long enough so that we can call Process again. clock_.AdvanceTimeMilliseconds(1000); - bitrate_estimator_->Process(); + EXPECT_EQ(0, bitrate_estimator_->Process()); EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 800000u, 10000); } diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc index 9a1bbc16b5..2b740434c1 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc @@ -118,15 +118,16 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(int64_t arrival_time_ms, } } -void RemoteBitrateEstimatorSingleStream::Process() { +int32_t RemoteBitrateEstimatorSingleStream::Process() { if (TimeUntilNextProcess() > 0) { - return; + return 0; } { CriticalSectionScoped cs(crit_sect_.get()); UpdateEstimate(clock_->TimeInMilliseconds()); } last_process_time_ = clock_->TimeInMilliseconds(); + return 0; } int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess() { diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h index f3a208a0b7..001311b45d 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h @@ -31,7 +31,7 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { size_t payload_size, const RTPHeader& header, bool was_paced) override; - void Process() override; + int32_t Process() override; int64_t TimeUntilNextProcess() override; void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; void RemoveStream(uint32_t ssrc) override; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc index eace9fc8b0..1703a274d6 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc @@ -71,9 +71,9 @@ int64_t RemoteEstimatorProxy::TimeUntilNextProcess() { return time_until_next; } -void RemoteEstimatorProxy::Process() { +int32_t RemoteEstimatorProxy::Process() { if (TimeUntilNextProcess() > 0) - return; + return 0; last_process_time_ms_ = clock_->TimeInMilliseconds(); bool more_to_build = true; @@ -86,6 +86,8 @@ void RemoteEstimatorProxy::Process() { more_to_build = false; } } + + return 0; } void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number, diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h index 93d5244b67..7145543960 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h @@ -47,7 +47,7 @@ class RemoteEstimatorProxy : public RemoteBitrateEstimator { void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override {} void SetMinBitrate(int min_bitrate_bps) override {} int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; static const int kDefaultProcessIntervalMs; static const int kBackWindowMs; diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe.cc index 5e282c6f08..c667b6864e 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/bwe.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.cc @@ -67,7 +67,7 @@ class NullBweSender : public BweSender { int64_t TimeUntilNextProcess() override { return std::numeric_limits::max(); } - void Process() override {} + int Process() override { return 0; } private: RTC_DISALLOW_COPY_AND_ASSIGN(NullBweSender); diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc index b91ee6df0b..066b4b5e35 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc @@ -238,7 +238,8 @@ int64_t NadaBweSender::TimeUntilNextProcess() { return 100; } -void NadaBweSender::Process() { +int NadaBweSender::Process() { + return 0; } void NadaBweSender::AcceleratedRampUp(const NadaFeedback& fb) { diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h index ab4541672d..bf23d09884 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h @@ -71,7 +71,7 @@ class NadaBweSender : public BweSender { void GiveFeedback(const FeedbackPacket& feedback) override; void OnPacketsSent(const Packets& packets) override {} int64_t TimeUntilNextProcess() override; - void Process() override; + int Process() override; void AcceleratedRampUp(const NadaFeedback& fb); void AcceleratedRampDown(const NadaFeedback& fb); void GradualRateUpdate(const NadaFeedback& fb, diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc index d469e675e4..3f049df918 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc @@ -53,8 +53,8 @@ int64_t RembBweSender::TimeUntilNextProcess() { return bitrate_controller_->TimeUntilNextProcess(); } -void RembBweSender::Process() { - bitrate_controller_->Process(); +int RembBweSender::Process() { + return bitrate_controller_->Process(); } int RembBweSender::GetFeedbackIntervalMs() const { diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h index 058873eeda..c6fddf7d38 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h @@ -35,7 +35,7 @@ class RembBweSender : public BweSender { void GiveFeedback(const FeedbackPacket& feedback) override; void OnPacketsSent(const Packets& packets) override {} int64_t TimeUntilNextProcess() override; - void Process() override; + int Process() override; protected: rtc::scoped_ptr bitrate_controller_; diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc index 36dff1fb2a..c55bb1ab11 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc @@ -110,9 +110,9 @@ int64_t FullBweSender::TimeUntilNextProcess() { return bitrate_controller_->TimeUntilNextProcess(); } -void FullBweSender::Process() { +int FullBweSender::Process() { rbe_->Process(); - bitrate_controller_->Process(); + return bitrate_controller_->Process(); } SendSideBweReceiver::SendSideBweReceiver(int flow_id) diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h index 9832eb2d28..57d0432f89 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h @@ -31,7 +31,7 @@ class FullBweSender : public BweSender, public RemoteBitrateObserver { void OnReceiveBitrateChanged(const std::vector& ssrcs, uint32_t bitrate) override; int64_t TimeUntilNextProcess() override; - void Process() override; + int Process() override; protected: rtc::scoped_ptr bitrate_controller_; diff --git a/webrtc/modules/rtp_rtcp/include/receive_statistics.h b/webrtc/modules/rtp_rtcp/include/receive_statistics.h index cc21e22df5..b4a7cd0de2 100644 --- a/webrtc/modules/rtp_rtcp/include/receive_statistics.h +++ b/webrtc/modules/rtp_rtcp/include/receive_statistics.h @@ -90,7 +90,7 @@ class NullReceiveStatistics : public ReceiveStatistics { StatisticianMap GetActiveStatisticians() const override; StreamStatistician* GetStatistician(uint32_t ssrc) const override; int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; void SetMaxReorderingThreshold(int max_reordering_threshold) override; void RegisterRtcpStatisticsCallback( RtcpStatisticsCallback* callback) override; diff --git a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index d4d6e1491c..796be1304c 100644 --- a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -249,7 +249,7 @@ class MockRtpRtcp : public RtpRtcp { MOCK_METHOD0(TimeUntilNextProcess, int64_t()); MOCK_METHOD0(Process, - void()); + int32_t()); MOCK_METHOD1(RegisterSendFrameCountObserver, void(FrameCountObserver*)); MOCK_CONST_METHOD0(GetSendFrameCountObserver, diff --git a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc index 022fc9610f..24f1e2c96e 100644 --- a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc @@ -454,13 +454,14 @@ void ReceiveStatisticsImpl::SetMaxReorderingThreshold( } } -void ReceiveStatisticsImpl::Process() { +int32_t ReceiveStatisticsImpl::Process() { CriticalSectionScoped cs(receive_statistics_lock_.get()); for (StatisticianImplMap::iterator it = statisticians_.begin(); it != statisticians_.end(); ++it) { it->second->ProcessBitrate(); } last_rate_update_ms_ = clock_->TimeInMilliseconds(); + return 0; } int64_t ReceiveStatisticsImpl::TimeUntilNextProcess() { @@ -529,7 +530,7 @@ void NullReceiveStatistics::SetMaxReorderingThreshold( int64_t NullReceiveStatistics::TimeUntilNextProcess() { return 0; } -void NullReceiveStatistics::Process() {} +int32_t NullReceiveStatistics::Process() { return 0; } void NullReceiveStatistics::RegisterRtcpStatisticsCallback( RtcpStatisticsCallback* callback) {} diff --git a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h index 6da8334da6..025dcd42c7 100644 --- a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h +++ b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h @@ -112,7 +112,7 @@ class ReceiveStatisticsImpl : public ReceiveStatistics, void SetMaxReorderingThreshold(int max_reordering_threshold) override; // Implement Module. - void Process() override; + int32_t Process() override; int64_t TimeUntilNextProcess() override; void RegisterRtcpStatisticsCallback( diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 7f33bc2ee5..07889f9eca 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -118,7 +118,7 @@ int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { } // Process any pending tasks such as timeouts (non time critical events). -void ModuleRtpRtcpImpl::Process() { +int32_t ModuleRtpRtcpImpl::Process() { const int64_t now = clock_->TimeInMilliseconds(); last_process_time_ = now; @@ -202,6 +202,7 @@ void ModuleRtpRtcpImpl::Process() { // A receiver has timed out rtcp_receiver_.UpdateTMMBR(); } + return 0; } void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 8c211e4d9c..3621f9bdfd 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -35,7 +35,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp { int64_t TimeUntilNextProcess() override; // Process any pending tasks such as timeouts. - void Process() override; + int32_t Process() override; // Receiver part. diff --git a/webrtc/modules/utility/source/process_thread_impl_unittest.cc b/webrtc/modules/utility/source/process_thread_impl_unittest.cc index 4f70e8acde..0b35fad7d2 100644 --- a/webrtc/modules/utility/source/process_thread_impl_unittest.cc +++ b/webrtc/modules/utility/source/process_thread_impl_unittest.cc @@ -28,7 +28,7 @@ using ::testing::SetArgPointee; class MockModule : public Module { public: MOCK_METHOD0(TimeUntilNextProcess, int64_t()); - MOCK_METHOD0(Process, void()); + MOCK_METHOD0(Process, int32_t()); MOCK_METHOD1(ProcessThreadAttached, void(ProcessThread*)); }; @@ -77,8 +77,8 @@ TEST(ProcessThreadImpl, ProcessCall) { MockModule module; EXPECT_CALL(module, TimeUntilNextProcess()).WillRepeatedly(Return(0)); EXPECT_CALL(module, Process()) - .WillOnce(DoAll(SetEvent(event.get()), Return())) - .WillRepeatedly(Return()); + .WillOnce(DoAll(SetEvent(event.get()), Return(0))) + .WillRepeatedly(Return(0)); EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); @@ -97,8 +97,8 @@ TEST(ProcessThreadImpl, ProcessCall2) { MockModule module; EXPECT_CALL(module, TimeUntilNextProcess()).WillRepeatedly(Return(0)); EXPECT_CALL(module, Process()) - .WillOnce(DoAll(SetEvent(event.get()), Return())) - .WillRepeatedly(Return()); + .WillOnce(DoAll(SetEvent(event.get()), Return(0))) + .WillRepeatedly(Return(0)); thread.RegisterModule(&module); @@ -122,8 +122,8 @@ TEST(ProcessThreadImpl, Deregister) { EXPECT_CALL(module, Process()) .WillOnce(DoAll(SetEvent(event.get()), Increment(&process_count), - Return())) - .WillRepeatedly(DoAll(Increment(&process_count), Return())); + Return(0))) + .WillRepeatedly(DoAll(Increment(&process_count), Return(0))); thread.RegisterModule(&module); @@ -163,8 +163,8 @@ void ProcessCallAfterAFewMs(int64_t milliseconds) { EXPECT_CALL(module, Process()) .WillOnce(DoAll(SetTimestamp(&called_time), SetEvent(event.get()), - Return())) - .WillRepeatedly(Return()); + Return(0))) + .WillRepeatedly(Return(0)); EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); @@ -225,7 +225,7 @@ TEST(ProcessThreadImpl, DISABLED_Process50Times) { .WillRepeatedly(Return(20)); EXPECT_CALL(module, Process()) .WillRepeatedly(DoAll(Increment(&callback_count), - Return())); + Return(0))); EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); @@ -269,9 +269,10 @@ TEST(ProcessThreadImpl, WakeUp) { Return(1000))) .WillOnce(Return(1000)); EXPECT_CALL(module, Process()) - .WillOnce( - DoAll(SetTimestamp(&called_time), SetEvent(called.get()), Return())) - .WillRepeatedly(Return()); + .WillOnce(DoAll(SetTimestamp(&called_time), + SetEvent(called.get()), + Return(0))) + .WillRepeatedly(Return(0)); EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc index 3013a7def0..90730cd984 100644 --- a/webrtc/modules/video_capture/video_capture_impl.cc +++ b/webrtc/modules/video_capture/video_capture_impl.cc @@ -93,7 +93,7 @@ int64_t VideoCaptureImpl::TimeUntilNextProcess() } // Process any pending tasks such as timeouts -void VideoCaptureImpl::Process() +int32_t VideoCaptureImpl::Process() { CriticalSectionScoped cs(&_callBackCs); @@ -136,6 +136,8 @@ void VideoCaptureImpl::Process() } _lastProcessFrameCount = _incomingFrameTimes[0]; + + return 0; } VideoCaptureImpl::VideoCaptureImpl(const int32_t id) diff --git a/webrtc/modules/video_capture/video_capture_impl.h b/webrtc/modules/video_capture/video_capture_impl.h index 4aa39394c7..164421776c 100644 --- a/webrtc/modules/video_capture/video_capture_impl.h +++ b/webrtc/modules/video_capture/video_capture_impl.h @@ -79,7 +79,7 @@ public: // Module handling virtual int64_t TimeUntilNextProcess(); - virtual void Process(); + virtual int32_t Process(); // Implement VideoCaptureExternal // |capture_time| must be specified in NTP time format in milliseconds. diff --git a/webrtc/modules/video_coding/test/vcm_payload_sink_factory.cc b/webrtc/modules/video_coding/test/vcm_payload_sink_factory.cc index 88242fd0ab..c9ec372f41 100644 --- a/webrtc/modules/video_coding/test/vcm_payload_sink_factory.cc +++ b/webrtc/modules/video_coding/test/vcm_payload_sink_factory.cc @@ -74,7 +74,9 @@ class VcmPayloadSinkFactory::VcmPayloadSink : public PayloadSinkInterface, bool Process() { if (vcm_->TimeUntilNextProcess() <= 0) { - vcm_->Process(); + if (vcm_->Process() < 0) { + return false; + } } return true; } diff --git a/webrtc/modules/video_coding/video_coding_impl.cc b/webrtc/modules/video_coding/video_coding_impl.cc index 7d6d17798d..7f74b4162f 100644 --- a/webrtc/modules/video_coding/video_coding_impl.cc +++ b/webrtc/modules/video_coding/video_coding_impl.cc @@ -94,9 +94,12 @@ class VideoCodingModuleImpl : public VideoCodingModule { return VCM_MIN(sender_time, receiver_time); } - void Process() override { - sender_.Process(); - receiver_.Process(); + int32_t Process() override { + int32_t sender_return = sender_.Process(); + int32_t receiver_return = receiver_.Process(); + if (sender_return != VCM_OK) + return sender_return; + return receiver_return; } int32_t RegisterSendCodec(const VideoCodec* sendCodec, diff --git a/webrtc/modules/video_coding/video_coding_impl.h b/webrtc/modules/video_coding/video_coding_impl.h index dc766b1ed2..581ab0eda5 100644 --- a/webrtc/modules/video_coding/video_coding_impl.h +++ b/webrtc/modules/video_coding/video_coding_impl.h @@ -93,7 +93,7 @@ class VideoSender { bool VideoSuspended() const; int64_t TimeUntilNextProcess(); - void Process(); + int32_t Process(); private: void SetEncoderParameters(EncoderParameters params) @@ -172,7 +172,7 @@ class VideoReceiver { int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable); int64_t TimeUntilNextProcess(); - void Process(); + int32_t Process(); void RegisterPreDecodeImageCallback(EncodedImageCallback* observer); void TriggerDecoderShutdown(); diff --git a/webrtc/modules/video_coding/video_coding_robustness_unittest.cc b/webrtc/modules/video_coding/video_coding_robustness_unittest.cc index eb5d485d59..51cffcdb2d 100644 --- a/webrtc/modules/video_coding/video_coding_robustness_unittest.cc +++ b/webrtc/modules/video_coding/video_coding_robustness_unittest.cc @@ -113,20 +113,20 @@ TEST_F(VCMRobustnessTest, TestHardNack) { clock_->AdvanceTimeMilliseconds(10); - vcm_->Process(); + ASSERT_EQ(VCM_OK, vcm_->Process()); ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0)); InsertPacket(6000, 8, false, true, kVideoFrameDelta); clock_->AdvanceTimeMilliseconds(10); - vcm_->Process(); + ASSERT_EQ(VCM_OK, vcm_->Process()); ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0)); InsertPacket(6000, 6, true, false, kVideoFrameDelta); InsertPacket(6000, 7, false, false, kVideoFrameDelta); clock_->AdvanceTimeMilliseconds(10); - vcm_->Process(); + ASSERT_EQ(VCM_OK, vcm_->Process()); ASSERT_EQ(VCM_OK, vcm_->Decode(0)); } @@ -143,12 +143,12 @@ TEST_F(VCMRobustnessTest, TestHardNackNoneDecoded) { InsertPacket(3000, 5, false, true, kVideoFrameDelta); EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0)); - vcm_->Process(); + ASSERT_EQ(VCM_OK, vcm_->Process()); clock_->AdvanceTimeMilliseconds(10); EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0)); - vcm_->Process(); + ASSERT_EQ(VCM_OK, vcm_->Process()); } TEST_F(VCMRobustnessTest, TestModeNoneWithErrors) { @@ -195,25 +195,25 @@ TEST_F(VCMRobustnessTest, TestModeNoneWithErrors) { InsertPacket(0, 1, false, false, kVideoFrameKey); InsertPacket(0, 2, false, true, kVideoFrameKey); EXPECT_EQ(VCM_OK, vcm_->Decode(33)); // Decode timestamp 0. - vcm_->Process(); + EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list. clock_->AdvanceTimeMilliseconds(33); InsertPacket(3000, 3, true, false, kVideoFrameDelta); // Packet 4 missing InsertPacket(3000, 5, false, true, kVideoFrameDelta); EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0)); - vcm_->Process(); + EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list. clock_->AdvanceTimeMilliseconds(33); InsertPacket(6000, 6, true, false, kVideoFrameDelta); InsertPacket(6000, 7, false, false, kVideoFrameDelta); InsertPacket(6000, 8, false, true, kVideoFrameDelta); EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 3000 incomplete. - vcm_->Process(); + EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list. clock_->AdvanceTimeMilliseconds(10); EXPECT_EQ(VCM_OK, vcm_->Decode(23)); // Decode timestamp 6000 complete. - vcm_->Process(); + EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list. clock_->AdvanceTimeMilliseconds(23); InsertPacket(3000, 4, false, false, kVideoFrameDelta); diff --git a/webrtc/modules/video_coding/video_receiver.cc b/webrtc/modules/video_coding/video_receiver.cc index e7844d0add..02d51a7b90 100644 --- a/webrtc/modules/video_coding/video_receiver.cc +++ b/webrtc/modules/video_coding/video_receiver.cc @@ -63,7 +63,9 @@ VideoReceiver::~VideoReceiver() { #endif } -void VideoReceiver::Process() { +int32_t VideoReceiver::Process() { + int32_t returnValue = VCM_OK; + // Receive-side statistics if (_receiveStatsTimer.TimeUntilProcess() == 0) { _receiveStatsTimer.Processed(); @@ -106,8 +108,12 @@ void VideoReceiver::Process() { CriticalSectionScoped cs(process_crit_sect_.get()); request_key_frame = _scheduleKeyRequest && _frameTypeCallback != NULL; } - if (request_key_frame) - RequestKeyFrame(); + if (request_key_frame) { + const int32_t ret = RequestKeyFrame(); + if (ret != VCM_OK && returnValue == VCM_OK) { + returnValue = ret; + } + } } // Packet retransmission requests @@ -129,6 +135,9 @@ void VideoReceiver::Process() { int32_t ret = VCM_OK; if (request_key_frame) { ret = RequestKeyFrame(); + if (ret != VCM_OK && returnValue == VCM_OK) { + returnValue = ret; + } } if (ret == VCM_OK && !nackList.empty()) { CriticalSectionScoped cs(process_crit_sect_.get()); @@ -138,6 +147,8 @@ void VideoReceiver::Process() { } } } + + return returnValue; } int64_t VideoReceiver::TimeUntilNextProcess() { diff --git a/webrtc/modules/video_coding/video_receiver_unittest.cc b/webrtc/modules/video_coding/video_receiver_unittest.cc index 693fdc60ee..820ce9ae2d 100644 --- a/webrtc/modules/video_coding/video_receiver_unittest.cc +++ b/webrtc/modules/video_coding/video_receiver_unittest.cc @@ -52,7 +52,7 @@ class TestVideoReceiver : public ::testing::Test { EXPECT_EQ(0, receiver_->IncomingPacket(payload, 0, *header)); ++header->header.sequenceNumber; } - receiver_->Process(); + EXPECT_EQ(0, receiver_->Process()); EXPECT_CALL(decoder_, Decode(_, _, _, _, _)).Times(0); EXPECT_EQ(VCM_FRAME_NOT_READY, receiver_->Decode(100)); } @@ -64,7 +64,7 @@ class TestVideoReceiver : public ::testing::Test { EXPECT_EQ(0, receiver_->IncomingPacket(payload, length, *header)); ++header->header.sequenceNumber; EXPECT_CALL(packet_request_callback_, ResendPackets(_, _)).Times(0); - receiver_->Process();; + EXPECT_EQ(0, receiver_->Process()); EXPECT_CALL(decoder_, Decode(_, _, _, _, _)).Times(1); EXPECT_EQ(0, receiver_->Decode(100)); } diff --git a/webrtc/modules/video_coding/video_sender.cc b/webrtc/modules/video_coding/video_sender.cc index d92ad4593d..f14f852114 100644 --- a/webrtc/modules/video_coding/video_sender.cc +++ b/webrtc/modules/video_coding/video_sender.cc @@ -53,7 +53,9 @@ VideoSender::VideoSender(Clock* clock, VideoSender::~VideoSender() {} -void VideoSender::Process() { +int32_t VideoSender::Process() { + int32_t returnValue = VCM_OK; + if (_sendStatsTimer.TimeUntilProcess() == 0) { _sendStatsTimer.Processed(); CriticalSectionScoped cs(process_crit_sect_.get()); @@ -70,6 +72,8 @@ void VideoSender::Process() { // updated even if bandwidth hasn't changed. encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); } + + return returnValue; } int64_t VideoSender::TimeUntilNextProcess() { diff --git a/webrtc/modules/video_render/video_render.h b/webrtc/modules/video_render/video_render.h index 84c9536e35..a193a187e7 100644 --- a/webrtc/modules/video_render/video_render.h +++ b/webrtc/modules/video_render/video_render.h @@ -53,7 +53,7 @@ public: static void DestroyVideoRender(VideoRender* module); int64_t TimeUntilNextProcess() override = 0; - void Process() override = 0; + int32_t Process() override = 0; /************************************************************************** * diff --git a/webrtc/modules/video_render/video_render_impl.cc b/webrtc/modules/video_render/video_render_impl.cc index 2f145a7ec9..d2a074b4c4 100644 --- a/webrtc/modules/video_render/video_render_impl.cc +++ b/webrtc/modules/video_render/video_render_impl.cc @@ -119,7 +119,11 @@ int64_t ModuleVideoRenderImpl::TimeUntilNextProcess() // Not used return 50; } -void ModuleVideoRenderImpl::Process() {} +int32_t ModuleVideoRenderImpl::Process() +{ + // Not used + return 0; +} void* ModuleVideoRenderImpl::Window() diff --git a/webrtc/modules/video_render/video_render_impl.h b/webrtc/modules/video_render/video_render_impl.h index 12244a60b8..ce93cea6b5 100644 --- a/webrtc/modules/video_render/video_render_impl.h +++ b/webrtc/modules/video_render/video_render_impl.h @@ -35,7 +35,7 @@ public: virtual ~ModuleVideoRenderImpl(); virtual int64_t TimeUntilNextProcess(); - virtual void Process(); + virtual int32_t Process(); /* * Returns the render window diff --git a/webrtc/modules/video_render/video_render_internal_impl.cc b/webrtc/modules/video_render/video_render_internal_impl.cc index a9ae0b0948..1fed26e9c4 100644 --- a/webrtc/modules/video_render/video_render_internal_impl.cc +++ b/webrtc/modules/video_render/video_render_internal_impl.cc @@ -299,7 +299,11 @@ int64_t ModuleVideoRenderImpl::TimeUntilNextProcess() // Not used return 50; } -void ModuleVideoRenderImpl::Process() {} +int32_t ModuleVideoRenderImpl::Process() +{ + // Not used + return 0; +} void* ModuleVideoRenderImpl::Window() diff --git a/webrtc/video/call_stats.cc b/webrtc/video/call_stats.cc index 8874c2b631..1ee4625552 100644 --- a/webrtc/video/call_stats.cc +++ b/webrtc/video/call_stats.cc @@ -109,11 +109,11 @@ int64_t CallStats::TimeUntilNextProcess() { return last_process_time_ + kUpdateIntervalMs - clock_->TimeInMilliseconds(); } -void CallStats::Process() { +int32_t CallStats::Process() { rtc::CritScope cs(&crit_); int64_t now = clock_->TimeInMilliseconds(); if (now < last_process_time_ + kUpdateIntervalMs) - return; + return 0; last_process_time_ = now; @@ -132,6 +132,7 @@ void CallStats::Process() { sum_avg_rtt_ms_ += avg_rtt_ms_; ++num_avg_rtt_; } + return 0; } int64_t CallStats::avg_rtt_ms() const { diff --git a/webrtc/video/call_stats.h b/webrtc/video/call_stats.h index bb3670c39d..385f6ffbe0 100644 --- a/webrtc/video/call_stats.h +++ b/webrtc/video/call_stats.h @@ -34,7 +34,7 @@ class CallStats : public Module { // Implements Module, to use the process thread. int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; // Returns a RtcpRttStats to register at a statistics provider. The object // has the same lifetime as the CallStats instance. diff --git a/webrtc/video/overuse_frame_detector.cc b/webrtc/video/overuse_frame_detector.cc index 18c6b9e7ed..9f12137940 100644 --- a/webrtc/video/overuse_frame_detector.cc +++ b/webrtc/video/overuse_frame_detector.cc @@ -297,14 +297,14 @@ void OveruseFrameDetector::FrameSent(uint32_t timestamp) { } } -void OveruseFrameDetector::Process() { +int32_t OveruseFrameDetector::Process() { RTC_DCHECK(processing_thread_.CalledOnValidThread()); int64_t now = clock_->TimeInMilliseconds(); // Used to protect against Process() being called too often. if (now < next_process_time_ms_) - return; + return 0; next_process_time_ms_ = now + kProcessIntervalMs; @@ -313,7 +313,7 @@ void OveruseFrameDetector::Process() { rtc::CritScope cs(&crit_); ++num_process_times_; if (num_process_times_ <= options_.min_process_count || !metrics_) - return; + return 0; current_metrics = *metrics_; } @@ -358,6 +358,8 @@ void OveruseFrameDetector::Process() { << " encode usage " << current_metrics.encode_usage_percent << " overuse detections " << num_overuse_detections_ << " rampup delay " << rampup_delay; + + return 0; } bool OveruseFrameDetector::IsOverusing(const CpuOveruseMetrics& metrics) { diff --git a/webrtc/video/overuse_frame_detector.h b/webrtc/video/overuse_frame_detector.h index 43c9e28459..80c9b55fb0 100644 --- a/webrtc/video/overuse_frame_detector.h +++ b/webrtc/video/overuse_frame_detector.h @@ -90,7 +90,7 @@ class OveruseFrameDetector : public Module { // Implements Module. int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; private: class SendProcessingUsage; diff --git a/webrtc/video/vie_sync_module.cc b/webrtc/video/vie_sync_module.cc index f8376e53d1..dc924fb62f 100644 --- a/webrtc/video/vie_sync_module.cc +++ b/webrtc/video/vie_sync_module.cc @@ -88,14 +88,14 @@ int64_t ViESyncModule::TimeUntilNextProcess() { return kSyncIntervalMs - (TickTime::Now() - last_sync_time_).Milliseconds(); } -void ViESyncModule::Process() { +int32_t ViESyncModule::Process() { rtc::CritScope lock(&data_cs_); last_sync_time_ = TickTime::Now(); const int current_video_delay_ms = vcm_->Delay(); if (voe_channel_id_ == -1) { - return; + return 0; } assert(video_rtp_rtcp_ && voe_sync_interface_); assert(sync_.get()); @@ -105,7 +105,7 @@ void ViESyncModule::Process() { if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_, &audio_jitter_buffer_delay_ms, &playout_buffer_delay_ms) != 0) { - return; + return 0; } const int current_audio_delay_ms = audio_jitter_buffer_delay_ms + playout_buffer_delay_ms; @@ -114,26 +114,26 @@ void ViESyncModule::Process() { RtpReceiver* voice_receiver = NULL; if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_, &voice_rtp_rtcp, &voice_receiver)) { - return; + return 0; } assert(voice_rtp_rtcp); assert(voice_receiver); if (UpdateMeasurements(&video_measurement_, *video_rtp_rtcp_, *video_receiver_) != 0) { - return; + return 0; } if (UpdateMeasurements(&audio_measurement_, *voice_rtp_rtcp, *voice_receiver) != 0) { - return; + return 0; } int relative_delay_ms; // Calculate how much later or earlier the audio stream is compared to video. if (!sync_->ComputeRelativeDelay(audio_measurement_, video_measurement_, &relative_delay_ms)) { - return; + return 0; } TRACE_COUNTER1("webrtc", "SyncCurrentVideoDelay", current_video_delay_ms); @@ -147,7 +147,7 @@ void ViESyncModule::Process() { current_audio_delay_ms, &target_audio_delay_ms, &target_video_delay_ms)) { - return; + return 0; } if (voe_sync_interface_->SetMinimumPlayoutDelay( @@ -155,6 +155,7 @@ void ViESyncModule::Process() { LOG(LS_ERROR) << "Error setting voice delay."; } vcm_->SetMinimumPlayoutDelay(target_video_delay_ms); + return 0; } } // namespace webrtc diff --git a/webrtc/video/vie_sync_module.h b/webrtc/video/vie_sync_module.h index 5724ce799a..779eb00a45 100644 --- a/webrtc/video/vie_sync_module.h +++ b/webrtc/video/vie_sync_module.h @@ -40,7 +40,7 @@ class ViESyncModule : public Module { // Implements Module. int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; private: rtc::CriticalSection data_cs_; diff --git a/webrtc/voice_engine/monitor_module.cc b/webrtc/voice_engine/monitor_module.cc index fb3c2b4920..2d8f4d4656 100644 --- a/webrtc/voice_engine/monitor_module.cc +++ b/webrtc/voice_engine/monitor_module.cc @@ -57,7 +57,7 @@ MonitorModule::TimeUntilNextProcess() return kAverageProcessUpdateTimeMs - (now - _lastProcessTime); } -void +int32_t MonitorModule::Process() { _lastProcessTime = TickTime::MillisecondTimestamp(); @@ -66,6 +66,7 @@ MonitorModule::Process() { _observerPtr->OnPeriodicProcess(); } + return 0; } } // namespace voe diff --git a/webrtc/voice_engine/monitor_module.h b/webrtc/voice_engine/monitor_module.h index f026f725d5..5539915238 100644 --- a/webrtc/voice_engine/monitor_module.h +++ b/webrtc/voice_engine/monitor_module.h @@ -42,7 +42,7 @@ public: public: // module int64_t TimeUntilNextProcess() override; - void Process() override; + int32_t Process() override; private: rtc::CriticalSection _callbackCritSect; diff --git a/webrtc/voice_engine/output_mixer.cc b/webrtc/voice_engine/output_mixer.cc index 1c9525a1ab..aa50e0bf2b 100644 --- a/webrtc/voice_engine/output_mixer.cc +++ b/webrtc/voice_engine/output_mixer.cc @@ -224,8 +224,7 @@ OutputMixer::SetAnonymousMixabilityStatus(MixerParticipant& participant, int32_t OutputMixer::MixActiveChannels() { - _mixerModule.Process(); - return 0; + return _mixerModule.Process(); } int