webrtc_m130/pc/channel_manager.h
Harald Alvestrand c3fa7c38b2 Remove remaining trampoline functions from channel_manager
This is part of the project to delete the class entirely.
The CL also adds an "use_rtx" parameter to the function for listing
video codecs, rather than filtering those away afterwards.

Bug: webrtc:13931
Change-Id: I96b9b18c694a1c0986ccf22face76ef4c704d372
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262666
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36963}
2022-05-23 08:09:06 +00:00

106 lines
3.7 KiB
C++

/*
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef PC_CHANNEL_MANAGER_H_
#define PC_CHANNEL_MANAGER_H_
#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "api/audio_options.h"
#include "api/crypto/crypto_options.h"
#include "api/rtp_parameters.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "call/call.h"
#include "media/base/codec.h"
#include "media/base/media_channel.h"
#include "media/base/media_config.h"
#include "media/base/media_engine.h"
#include "pc/channel_factory_interface.h"
#include "pc/channel_interface.h"
#include "pc/session_description.h"
#include "rtc_base/system/file_wrapper.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/unique_id_generator.h"
namespace cricket {
// ChannelManager allows the MediaEngine to run on a separate thread, and takes
// care of marshalling calls between threads. It also creates and keeps track of
// voice and video channels; by doing so, it can temporarily pause all the
// channels when a new audio or video device is chosen. The voice and video
// channels are stored in separate vectors, to easily allow operations on just
// voice or just video channels.
// ChannelManager also allows the application to discover what devices it has
// using device manager.
class ChannelManager : public ChannelFactoryInterface {
public:
// Returns an initialized instance of ChannelManager.
// If media_engine is non-nullptr, then the returned ChannelManager instance
// will own that reference and media engine initialization
static std::unique_ptr<ChannelManager> Create(
MediaEngineInterface* media_engine,
rtc::UniqueRandomIdGenerator* ssrc_generator,
bool enable_rtx,
rtc::Thread* worker_thread,
rtc::Thread* network_thread);
ChannelManager() = delete;
~ChannelManager() override;
// The operations below all occur on the worker thread.
// The caller is responsible for ensuring that destruction happens
// on the worker thread.
// Creates a voice channel, to be associated with the specified session.
std::unique_ptr<VoiceChannel> CreateVoiceChannel(
webrtc::Call* call,
const MediaConfig& media_config,
absl::string_view mid,
bool srtp_required,
const webrtc::CryptoOptions& crypto_options,
const AudioOptions& options) override;
// Creates a video channel, synced with the specified voice channel, and
// associated with the specified session.
// Version of the above that takes PacketTransportInternal.
std::unique_ptr<VideoChannel> CreateVideoChannel(
webrtc::Call* call,
const MediaConfig& media_config,
absl::string_view mid,
bool srtp_required,
const webrtc::CryptoOptions& crypto_options,
const VideoOptions& options,
webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory)
override;
protected:
ChannelManager(MediaEngineInterface* media_engine,
rtc::UniqueRandomIdGenerator* ssrc_generator_,
bool enable_rtx,
rtc::Thread* worker_thread,
rtc::Thread* network_thread);
private:
MediaEngineInterface* media_engine_; // Nullable.
rtc::UniqueRandomIdGenerator* ssrc_generator_;
rtc::Thread* const signaling_thread_;
rtc::Thread* const worker_thread_;
rtc::Thread* const network_thread_;
};
} // namespace cricket
#endif // PC_CHANNEL_MANAGER_H_