Bug 1813468 - Rename ConcreteConduitControl to not be specific for conduits. r=bwc

This sets it up so MediaPipeline control interfaces can be added.

Differential Revision: https://phabricator.services.mozilla.com/D168725
This commit is contained in:
Andreas Pehrson 2023-02-09 15:33:01 +00:00
parent df94e1e4de
commit edb33bfa25
4 changed files with 19 additions and 20 deletions

View File

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MEDIA_WEBRTC_SIGNALING_GTEST_CONCRETECONDUITCONTROL_H_
#define MEDIA_WEBRTC_SIGNALING_GTEST_CONCRETECONDUITCONTROL_H_
#ifndef MEDIA_WEBRTC_SIGNALING_GTEST_CANONICALS_H_
#define MEDIA_WEBRTC_SIGNALING_GTEST_CANONICALS_H_
#include "MediaConduitControl.h"
#include "WaitFor.h"
@ -61,14 +61,14 @@ class ConcreteCanonicals {
};
#undef INIT_CANONICAL
class ConcreteConduitControl : public AudioConduitControlInterface,
public VideoConduitControlInterface,
private ConcreteCanonicals {
class ConcreteControl : public AudioConduitControlInterface,
public VideoConduitControlInterface,
private ConcreteCanonicals {
private:
RefPtr<nsISerialEventTarget> mTarget;
public:
explicit ConcreteConduitControl(RefPtr<nsISerialEventTarget> aTarget)
explicit ConcreteControl(RefPtr<nsISerialEventTarget> aTarget)
: mTarget(std::move(aTarget)) {}
template <typename Function>

View File

@ -8,7 +8,7 @@
#include "gtest/gtest.h"
#include "AudioConduit.h"
#include "ConcreteConduitControl.h"
#include "Canonicals.h"
#include "WaitFor.h"
#include "MockCall.h"
@ -38,7 +38,7 @@ class AudioConduitTest : public ::testing::Test {
const RefPtr<MockCallWrapper> mCallWrapper;
const RefPtr<WebrtcAudioConduit> mAudioConduit;
ConcreteConduitControl mControl;
ConcreteControl mControl;
};
TEST_F(AudioConduitTest, TestConfigureSendMediaCodec) {

View File

@ -11,7 +11,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/scoped_refptr.h"
#include "AudioSegment.h"
#include "ConcreteConduitControl.h"
#include "Canonicals.h"
#include "modules/audio_device/include/fake_audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/audio_processing/include/audio_processing.h"
@ -244,7 +244,7 @@ class LoopbackTransport : public MediaTransportHandler {
class TestAgent {
public:
explicit TestAgent(const RefPtr<SharedWebrtcState>& aSharedState)
: conduit_control_(aSharedState->mCallWorkerThread),
: control_(aSharedState->mCallWorkerThread),
audio_config_(109, "opus", 48000, 2, false),
call_(WebrtcCallWrapper::Create(mozilla::dom::RTCStatsTimestampMaker(),
nullptr, aSharedState)),
@ -253,7 +253,7 @@ class TestAgent {
audio_pipeline_(),
transport_(new LoopbackTransport) {
Unused << WaitFor(InvokeAsync(call_->mCallThread, __func__, [&] {
audio_conduit_->InitControl(&conduit_control_);
audio_conduit_->InitControl(&control_);
return GenericPromise::CreateAndResolve(true, "TestAgent()");
}));
}
@ -286,7 +286,7 @@ class TestAgent {
audio_pipeline_->Stop();
}
if (audio_conduit_) {
conduit_control_.Update([](auto& aControl) {
control_.Update([](auto& aControl) {
aControl.mTransmitting = false;
aControl.mReceiving = false;
});
@ -338,7 +338,7 @@ class TestAgent {
}
protected:
ConcreteConduitControl conduit_control_;
ConcreteControl control_;
AudioCodecConfig audio_config_;
RefPtr<WebrtcCallWrapper> call_;
RefPtr<AudioSessionConduit> audio_conduit_;
@ -354,7 +354,7 @@ class TestAgentSend : public TestAgent {
public:
explicit TestAgentSend(const RefPtr<SharedWebrtcState>& aSharedState)
: TestAgent(aSharedState) {
conduit_control_.Update([&](auto& aControl) {
control_.Update([&](auto& aControl) {
aControl.mAudioSendCodec = Some(audio_config_);
});
audio_track_ = new FakeAudioTrack();
@ -369,8 +369,7 @@ class TestAgentSend : public TestAgent {
audio_pipeline->SetSendTrackOverride(audio_track_);
audio_pipeline->Start();
conduit_control_.Update(
[](auto& aControl) { aControl.mTransmitting = true; });
control_.Update([](auto& aControl) { aControl.mTransmitting = true; });
audio_pipeline_ = audio_pipeline;
@ -382,7 +381,7 @@ class TestAgentReceive : public TestAgent {
public:
explicit TestAgentReceive(const RefPtr<SharedWebrtcState>& aSharedState)
: TestAgent(aSharedState) {
conduit_control_.Update([&](auto& aControl) {
control_.Update([&](auto& aControl) {
std::vector<AudioCodecConfig> codecs;
codecs.push_back(audio_config_);
aControl.mAudioRecvCodecs = codecs;
@ -399,7 +398,7 @@ class TestAgentReceive : public TestAgent {
TrackingId(), PRINCIPAL_HANDLE_NONE, PrincipalPrivacy::NonPrivate);
audio_pipeline_->Start();
conduit_control_.Update([](auto& aControl) { aControl.mReceiving = true; });
control_.Update([](auto& aControl) { aControl.mReceiving = true; });
audio_pipeline_->UpdateTransport_m(aTransportId, std::move(bundle_filter_));
}

View File

@ -10,7 +10,7 @@
#include "nss.h"
#include "ssl.h"
#include "ConcreteConduitControl.h"
#include "Canonicals.h"
#include "VideoConduit.h"
#include "RtpRtcpConfig.h"
#include "WebrtcCallWrapper.h"
@ -88,7 +88,7 @@ class VideoConduitTest : public Test {
const RefPtr<MockCallWrapper> mCallWrapper;
const RefPtr<mozilla::WebrtcVideoConduit> mVideoConduit;
ConcreteConduitControl mControl;
ConcreteControl mControl;
};
TEST_F(VideoConduitTest, TestConfigureReceiveMediaCodecs) {