123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #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 "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.h"
- #include "pc/rtp_transport_internal.h"
- #include "pc/session_description.h"
- #include "rtc_base/system/file_wrapper.h"
- #include "rtc_base/thread.h"
- namespace cricket {
- class ChannelManager final {
- public:
-
- ChannelManager(std::unique_ptr<MediaEngineInterface> media_engine,
- std::unique_ptr<DataEngineInterface> data_engine,
- rtc::Thread* worker_thread,
- rtc::Thread* network_thread);
- ~ChannelManager();
-
-
- rtc::Thread* worker_thread() const { return worker_thread_; }
- bool set_worker_thread(rtc::Thread* thread) {
- if (initialized_) {
- return false;
- }
- worker_thread_ = thread;
- return true;
- }
- rtc::Thread* network_thread() const { return network_thread_; }
- bool set_network_thread(rtc::Thread* thread) {
- if (initialized_) {
- return false;
- }
- network_thread_ = thread;
- return true;
- }
- MediaEngineInterface* media_engine() { return media_engine_.get(); }
-
-
- void GetSupportedAudioSendCodecs(std::vector<AudioCodec>* codecs) const;
- void GetSupportedAudioReceiveCodecs(std::vector<AudioCodec>* codecs) const;
- void GetSupportedVideoSendCodecs(std::vector<VideoCodec>* codecs) const;
- void GetSupportedVideoReceiveCodecs(std::vector<VideoCodec>* codecs) const;
- void GetSupportedDataCodecs(std::vector<DataCodec>* codecs) const;
- RtpHeaderExtensions GetDefaultEnabledAudioRtpHeaderExtensions() const;
- std::vector<webrtc::RtpHeaderExtensionCapability>
- GetSupportedAudioRtpHeaderExtensions() const;
- RtpHeaderExtensions GetDefaultEnabledVideoRtpHeaderExtensions() const;
- std::vector<webrtc::RtpHeaderExtensionCapability>
- GetSupportedVideoRtpHeaderExtensions() const;
-
- bool initialized() const { return initialized_; }
-
- bool Init();
-
- void Terminate();
-
-
-
-
- VoiceChannel* CreateVoiceChannel(webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- webrtc::RtpTransportInternal* rtp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const webrtc::CryptoOptions& crypto_options,
- rtc::UniqueRandomIdGenerator* ssrc_generator,
- const AudioOptions& options);
-
- void DestroyVoiceChannel(VoiceChannel* voice_channel);
-
-
-
- VideoChannel* CreateVideoChannel(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- webrtc::RtpTransportInternal* rtp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const webrtc::CryptoOptions& crypto_options,
- rtc::UniqueRandomIdGenerator* ssrc_generator,
- const VideoOptions& options,
- webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory);
-
- void DestroyVideoChannel(VideoChannel* video_channel);
- RtpDataChannel* CreateRtpDataChannel(
- const cricket::MediaConfig& media_config,
- webrtc::RtpTransportInternal* rtp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const webrtc::CryptoOptions& crypto_options,
- rtc::UniqueRandomIdGenerator* ssrc_generator);
-
- void DestroyRtpDataChannel(RtpDataChannel* data_channel);
-
- bool has_channels() const {
- return (!voice_channels_.empty() || !video_channels_.empty() ||
- !data_channels_.empty());
- }
-
-
- bool SetVideoRtxEnabled(bool enable);
-
- bool capturing() const { return capturing_; }
-
-
-
-
- bool StartAecDump(webrtc::FileWrapper file, int64_t max_size_bytes);
-
- void StopAecDump();
- private:
- std::unique_ptr<MediaEngineInterface> media_engine_;
- std::unique_ptr<DataEngineInterface> data_engine_;
- bool initialized_ = false;
- rtc::Thread* main_thread_;
- rtc::Thread* worker_thread_;
- rtc::Thread* network_thread_;
-
- std::vector<std::unique_ptr<VoiceChannel>> voice_channels_;
- std::vector<std::unique_ptr<VideoChannel>> video_channels_;
- std::vector<std::unique_ptr<RtpDataChannel>> data_channels_;
- bool enable_rtx_ = false;
- bool capturing_ = false;
- };
- }
- #endif
|