Call ChannelManager aec dump methods on the worker thread.

Before, the calls went through the signaling thread and
blocked while the operation completed on the worker.

Bug: webrtc:12601
Change-Id: I58991fa98a55d0fa9304a68bd85bb269f1f123d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212619
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33615}
This commit is contained in:
Tomas Gunnarsson 2021-04-01 19:14:54 +02:00 committed by Commit Bot
parent 0b5ec183b5
commit 95d2f478e9
4 changed files with 13 additions and 13 deletions

View File

@ -22,7 +22,7 @@ namespace webrtc {
// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
// are called on is an implementation detail.
BEGIN_PRIMARY_PROXY_MAP(PeerConnectionFactory)
BEGIN_PROXY_MAP(PeerConnectionFactory)
PROXY_PRIMARY_THREAD_DESTRUCTOR()
PROXY_METHOD1(void, SetOptions, const Options&)
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
@ -59,8 +59,8 @@ PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
CreateAudioTrack,
const std::string&,
AudioSourceInterface*)
PROXY_METHOD2(bool, StartAecDump, FILE*, int64_t)
PROXY_METHOD0(void, StopAecDump)
PROXY_SECONDARY_METHOD2(bool, StartAecDump, FILE*, int64_t)
PROXY_SECONDARY_METHOD0(void, StopAecDump)
END_PROXY_MAP()
} // namespace webrtc

View File

@ -360,14 +360,13 @@ bool ChannelManager::has_channels() const {
bool ChannelManager::StartAecDump(webrtc::FileWrapper file,
int64_t max_size_bytes) {
return worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
return media_engine_->voice().StartAecDump(std::move(file), max_size_bytes);
});
RTC_DCHECK_RUN_ON(worker_thread_);
return media_engine_->voice().StartAecDump(std::move(file), max_size_bytes);
}
void ChannelManager::StopAecDump() {
worker_thread_->Invoke<void>(RTC_FROM_HERE,
[&] { media_engine_->voice().StopAecDump(); });
RTC_DCHECK_RUN_ON(worker_thread_);
media_engine_->voice().StopAecDump();
}
} // namespace cricket

View File

@ -73,8 +73,8 @@ CreateModularPeerConnectionFactory(
// Verify that the invocation and the initialization ended up agreeing on the
// thread.
RTC_DCHECK_RUN_ON(pc_factory->signaling_thread());
return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(),
pc_factory);
return PeerConnectionFactoryProxy::Create(
pc_factory->signaling_thread(), pc_factory->worker_thread(), pc_factory);
}
// Static
@ -176,12 +176,12 @@ PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) {
}
bool PeerConnectionFactory::StartAecDump(FILE* file, int64_t max_size_bytes) {
RTC_DCHECK(signaling_thread()->IsCurrent());
RTC_DCHECK_RUN_ON(worker_thread());
return channel_manager()->StartAecDump(FileWrapper(file), max_size_bytes);
}
void PeerConnectionFactory::StopAecDump() {
RTC_DCHECK(signaling_thread()->IsCurrent());
RTC_DCHECK_RUN_ON(worker_thread());
channel_manager()->StopAecDump();
}

View File

@ -117,6 +117,8 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
return context_->signaling_thread();
}
rtc::Thread* worker_thread() const { return context_->worker_thread(); }
const Options& options() const {
RTC_DCHECK_RUN_ON(signaling_thread());
return options_;
@ -137,7 +139,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
virtual ~PeerConnectionFactory();
private:
rtc::Thread* worker_thread() const { return context_->worker_thread(); }
rtc::Thread* network_thread() const { return context_->network_thread(); }
bool IsTrialEnabled(absl::string_view key) const;