Simplify construction of MediaChannel classes.

Removes a few constructors where similar ones existed.
Removes MediaConfig dependency from MediaChannel and fixes an iwyu.

Bug: none
Change-Id: I9e34a1da0852c3fb21222161fad315e70598db3a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/242966
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35608}
This commit is contained in:
Tomas Gunnarsson 2021-12-30 20:43:05 +00:00 committed by WebRTC LUCI CQ
parent f1ea4170ea
commit 4163a3dae8
5 changed files with 13 additions and 24 deletions

View File

@ -26,14 +26,8 @@ VideoOptions::VideoOptions()
: content_hint(VideoTrackInterface::ContentHint::kNone) {}
VideoOptions::~VideoOptions() = default;
MediaChannel::MediaChannel(const MediaConfig& config,
TaskQueueBase* network_thread)
: enable_dscp_(config.enable_dscp),
network_safety_(PendingTaskSafetyFlag::CreateDetachedInactive()),
network_thread_(network_thread) {}
MediaChannel::MediaChannel(TaskQueueBase* network_thread)
: enable_dscp_(false),
MediaChannel::MediaChannel(TaskQueueBase* network_thread, bool enable_dscp)
: enable_dscp_(enable_dscp),
network_safety_(PendingTaskSafetyFlag::CreateDetachedInactive()),
network_thread_(network_thread) {}

View File

@ -38,7 +38,6 @@
#include "common_video/include/quality_limitation_reason.h"
#include "media/base/codec.h"
#include "media/base/delayable.h"
#include "media/base/media_config.h"
#include "media/base/media_constants.h"
#include "media/base/stream_params.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
@ -170,9 +169,8 @@ class MediaChannel {
virtual ~NetworkInterface() {}
};
MediaChannel(const MediaConfig& config,
webrtc::TaskQueueBase* network_thread);
explicit MediaChannel(webrtc::TaskQueueBase* network_thread);
explicit MediaChannel(webrtc::TaskQueueBase* network_thread,
bool enable_dscp = false);
virtual ~MediaChannel();
virtual cricket::MediaType media_type() const = 0;
@ -774,11 +772,9 @@ struct AudioRecvParameters : RtpParameters<AudioCodec> {};
class VoiceMediaChannel : public MediaChannel, public Delayable {
public:
explicit VoiceMediaChannel(webrtc::TaskQueueBase* network_thread)
: MediaChannel(network_thread) {}
VoiceMediaChannel(const MediaConfig& config,
webrtc::TaskQueueBase* network_thread)
: MediaChannel(config, network_thread) {}
VoiceMediaChannel(webrtc::TaskQueueBase* network_thread,
bool enable_dscp = false)
: MediaChannel(network_thread, enable_dscp) {}
~VoiceMediaChannel() override {}
cricket::MediaType media_type() const override;
@ -846,11 +842,9 @@ struct VideoRecvParameters : RtpParameters<VideoCodec> {};
class VideoMediaChannel : public MediaChannel, public Delayable {
public:
explicit VideoMediaChannel(webrtc::TaskQueueBase* network_thread)
: MediaChannel(network_thread) {}
VideoMediaChannel(const MediaConfig& config,
webrtc::TaskQueueBase* network_thread)
: MediaChannel(config, network_thread) {}
explicit VideoMediaChannel(webrtc::TaskQueueBase* network_thread,
bool enable_dscp = false)
: MediaChannel(network_thread, enable_dscp) {}
~VideoMediaChannel() override {}
cricket::MediaType media_type() const override;

View File

@ -24,6 +24,7 @@
#include "call/audio_state.h"
#include "media/base/codec.h"
#include "media/base/media_channel.h"
#include "media/base/media_config.h"
#include "media/base/video_common.h"
#include "rtc_base/system/file_wrapper.h"

View File

@ -684,7 +684,7 @@ WebRtcVideoChannel::WebRtcVideoChannel(
webrtc::VideoEncoderFactory* encoder_factory,
webrtc::VideoDecoderFactory* decoder_factory,
webrtc::VideoBitrateAllocatorFactory* bitrate_allocator_factory)
: VideoMediaChannel(config, call->network_thread()),
: VideoMediaChannel(call->network_thread(), config.enable_dscp),
worker_thread_(call->worker_thread()),
call_(call),
unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),

View File

@ -1332,7 +1332,7 @@ WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(
const AudioOptions& options,
const webrtc::CryptoOptions& crypto_options,
webrtc::Call* call)
: VoiceMediaChannel(config, call->network_thread()),
: VoiceMediaChannel(call->network_thread(), config.enable_dscp),
worker_thread_(call->worker_thread()),
engine_(engine),
call_(call),