| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef PC_CHANNEL_H_ |
| 12 | #define PC_CHANNEL_H_ |
| 13 |
| 14 | #include <stdint.h> |
| 15 |
| 16 | #include <functional> |
| 17 | #include <memory> |
| 18 | #include <string> |
| 19 | #include <utility> |
| 20 | #include <vector> |
| 21 |
| 22 | #include "absl/strings/string_view.h" |
| 23 | #include "absl/types/optional.h" |
| 24 | #include "api/crypto/crypto_options.h" |
| 25 | #include "api/jsep.h" |
| 26 | #include "api/media_types.h" |
| 27 | #include "api/rtp_parameters.h" |
| 28 | #include "api/rtp_transceiver_direction.h" |
| 29 | #include "api/scoped_refptr.h" |
| 30 | #include "api/sequence_checker.h" |
| 31 | #include "api/task_queue/pending_task_safety_flag.h" |
| 32 | #include "call/rtp_demuxer.h" |
| 33 | #include "call/rtp_packet_sink_interface.h" |
| 34 | #include "media/base/media_channel.h" |
| 35 | #include "media/base/media_channel_impl.h" |
| 36 | #include "media/base/stream_params.h" |
| 37 | #include "modules/rtp_rtcp/source/rtp_packet_received.h" |
| 38 | #include "pc/channel_interface.h" |
| 39 | #include "pc/rtp_transport_internal.h" |
| 40 | #include "pc/session_description.h" |
| 41 | #include "rtc_base/async_packet_socket.h" |
| 42 | #include "rtc_base/checks.h" |
| 43 | #include "rtc_base/containers/flat_set.h" |
| 44 | #include "rtc_base/copy_on_write_buffer.h" |
| 45 | #include "rtc_base/network/sent_packet.h" |
| 46 | #include "rtc_base/network_route.h" |
| 47 | #include "rtc_base/socket.h" |
| 48 | #include "rtc_base/thread.h" |
| 49 | #include "rtc_base/thread_annotations.h" |
| 50 | #include "rtc_base/unique_id_generator.h" |
| 51 |
| 52 | namespace cricket { |
| 53 |
| 54 | // BaseChannel contains logic common to voice and video, including enable, |
| 55 | // marshaling calls to a worker and network threads, and connection and media |
| 56 | // monitors. |
| 57 | // |
| 58 | // BaseChannel assumes signaling and other threads are allowed to make |
| 59 | // synchronous calls to the worker thread, the worker thread makes synchronous |
| 60 | // calls only to the network thread, and the network thread can't be blocked by |
| 61 | // other threads. |
| 62 | // All methods with _n suffix must be called on network thread, |
| 63 | // methods with _w suffix on worker thread |
| 64 | // and methods with _s suffix on signaling thread. |
| 65 | // Network and worker threads may be the same thread. |
| 66 | // |
| 67 | class VideoChannel; |
| 68 | class VoiceChannel; |
| 69 |
| 70 | class BaseChannel : public ChannelInterface, |
| 71 | // TODO(tommi): Consider implementing these interfaces |
| 72 | // via composition. |
| 73 | public MediaChannelNetworkInterface, |
| 74 | public webrtc::RtpPacketSinkInterface { |
| 75 | public: |
| 76 | // If `srtp_required` is true, the channel will not send or receive any |
| 77 | // RTP/RTCP packets without using SRTP (either using SDES or DTLS-SRTP). |
| 78 | // The BaseChannel does not own the UniqueRandomIdGenerator so it is the |
| 79 | // responsibility of the user to ensure it outlives this object. |
| 80 | // TODO(zhihuang:) Create a BaseChannel::Config struct for the parameter lists |
| 81 | // which will make it easier to change the constructor. |
| 82 |
| 83 | // Constructor for use when the MediaChannels are split |
| 84 | BaseChannel( |
| 85 | webrtc::TaskQueueBase* worker_thread, |
| 86 | rtc::Thread* network_thread, |
| 87 | webrtc::TaskQueueBase* signaling_thread, |
| 88 | std::unique_ptr<MediaSendChannelInterface> media_send_channel, |
| 89 | std::unique_ptr<MediaReceiveChannelInterface> media_receive_channel, |
| 90 | absl::string_view mid, |
| 91 | bool srtp_required, |
| 92 | webrtc::CryptoOptions crypto_options, |
| 93 | rtc::UniqueRandomIdGenerator* ssrc_generator); |
| 94 | virtual ~BaseChannel(); |
| 95 |
| 96 | webrtc::TaskQueueBase* worker_thread() const { return worker_thread_; } |
| 97 | rtc::Thread* network_thread() const { return network_thread_; } |
| 98 | const std::string& mid() const override { return demuxer_criteria_.mid(); } |
| 99 | // TODO(deadbeef): This is redundant; remove this. |
| 100 | absl::string_view transport_name() const override { |
| 101 | RTC_DCHECK_RUN_ON(network_thread()); |
| 102 | if (rtp_transport_) |
| 103 | return rtp_transport_->transport_name(); |
| 104 | return ""; |
| 105 | } |
| 106 |
| 107 | // This function returns true if using SRTP (DTLS-based keying or SDES). |
| 108 | bool srtp_active() const { |
| 109 | RTC_DCHECK_RUN_ON(network_thread()); |
| 110 | return rtp_transport_ && rtp_transport_->IsSrtpActive(); |
| 111 | } |
| 112 |
| 113 | // Set an RTP level transport which could be an RtpTransport without |
| 114 | // encryption, an SrtpTransport for SDES or a DtlsSrtpTransport for DTLS-SRTP. |
| 115 | // This can be called from any thread and it hops to the network thread |
| 116 | // internally. It would replace the `SetTransports` and its variants. |
| 117 | bool SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) override; |
| 118 |
| 119 | webrtc::RtpTransportInternal* rtp_transport() const { |
| 120 | RTC_DCHECK_RUN_ON(network_thread()); |
| 121 | return rtp_transport_; |
| 122 | } |
| 123 |
| 124 | // Channel control |
| 125 | bool SetLocalContent(const MediaContentDescription* content, |
| 126 | webrtc::SdpType type, |
| 127 | std::string& error_desc) override; |
| 128 | bool SetRemoteContent(const MediaContentDescription* content, |
| 129 | webrtc::SdpType type, |
| 130 | std::string& error_desc) override; |
| 131 | // Controls whether this channel will receive packets on the basis of |
| 132 | // matching payload type alone. This is needed for legacy endpoints that |
| 133 | // don't signal SSRCs or use MID/RID, but doesn't make sense if there is |
| 134 | // more than channel of specific media type, As that creates an ambiguity. |
| 135 | // |
| 136 | // This method will also remove any existing streams that were bound to this |
| 137 | // channel on the basis of payload type, since one of these streams might |
| 138 | // actually belong to a new channel. See: crbug.com/webrtc/11477 |
| 139 | bool SetPayloadTypeDemuxingEnabled(bool enabled) override; |
| 140 |
| 141 | void Enable(bool enable) override; |
| 142 |
| 143 | const std::vector<StreamParams>& local_streams() const override { |
| 144 | return local_streams_; |
| 145 | } |
| 146 | const std::vector<StreamParams>& remote_streams() const override { |
| 147 | return remote_streams_; |
| 148 | } |
| 149 |
| 150 | // Used for latency measurements. |
| 151 | void SetFirstPacketReceivedCallback(std::function<void()> callback) override; |
| 152 |
| 153 | // From RtpTransport - public for testing only |
| 154 | void OnTransportReadyToSend(bool ready); |
| 155 |
| 156 | // Only public for unit tests. Otherwise, consider protected. |
| 157 | int SetOption(SocketType type, rtc::Socket::Option o, int val) override; |
| 158 |
| 159 | // RtpPacketSinkInterface overrides. |
| 160 | void OnRtpPacket(const webrtc::RtpPacketReceived& packet) override; |
| 161 |
| 162 | VideoMediaSendChannelInterface* video_media_send_channel() override { |
| 163 | RTC_CHECK(false) << "Attempt to fetch video channel from non-video"; |
| 164 | return nullptr; |
| 165 | } |
| 166 | VoiceMediaSendChannelInterface* voice_media_send_channel() override { |
| 167 | RTC_CHECK(false) << "Attempt to fetch voice channel from non-voice"; |
| 168 | return nullptr; |
| 169 | } |
| 170 | VideoMediaReceiveChannelInterface* video_media_receive_channel() override { |
| 171 | RTC_CHECK(false) << "Attempt to fetch video channel from non-video"; |
| 172 | return nullptr; |
| 173 | } |
| 174 | VoiceMediaReceiveChannelInterface* voice_media_receive_channel() override { |
| 175 | RTC_CHECK(false) << "Attempt to fetch voice channel from non-voice"; |
| 176 | return nullptr; |
| 177 | } |
| 178 |
| 179 | protected: |
| 180 | void set_local_content_direction(webrtc::RtpTransceiverDirection direction) |
| 181 | RTC_RUN_ON(worker_thread()) { |
| 182 | local_content_direction_ = direction; |
| 183 | } |
| 184 |
| 185 | webrtc::RtpTransceiverDirection local_content_direction() const |
| 186 | RTC_RUN_ON(worker_thread()) { |
| 187 | return local_content_direction_; |
| 188 | } |
| 189 |
| 190 | void set_remote_content_direction(webrtc::RtpTransceiverDirection direction) |
| 191 | RTC_RUN_ON(worker_thread()) { |
| 192 | remote_content_direction_ = direction; |
| 193 | } |
| 194 |
| 195 | webrtc::RtpTransceiverDirection remote_content_direction() const |
| 196 | RTC_RUN_ON(worker_thread()) { |
| 197 | return remote_content_direction_; |
| 198 | } |
| 199 |
| 200 | webrtc::RtpExtension::Filter extensions_filter() const { |
| 201 | return extensions_filter_; |
| 202 | } |
| 203 |
| 204 | bool network_initialized() RTC_RUN_ON(network_thread()) { |
| 205 | return media_send_channel()->HasNetworkInterface(); |
| 206 | } |
| 207 |
| 208 | bool enabled() const RTC_RUN_ON(worker_thread()) { return enabled_; } |
| 209 | webrtc::TaskQueueBase* signaling_thread() const { return signaling_thread_; } |
| 210 |
| 211 | // Call to verify that: |
| 212 | // * The required content description directions have been set. |
| 213 | // * The channel is enabled. |
| 214 | // * The SRTP filter is active if it's needed. |
| 215 | // * The transport has been writable before, meaning it should be at least |
| 216 | // possible to succeed in sending a packet. |
| 217 | // |
| 218 | // When any of these properties change, UpdateMediaSendRecvState_w should be |
| 219 | // called. |
| 220 | bool IsReadyToSendMedia_w() const RTC_RUN_ON(worker_thread()); |
| 221 |
| 222 | // NetworkInterface implementation, called by MediaEngine |
| 223 | bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
| 224 | const rtc::PacketOptions& options) override; |
| 225 | bool SendRtcp(rtc::CopyOnWriteBuffer* packet, |
| 226 | const rtc::PacketOptions& options) override; |
| 227 |
| 228 | // From RtpTransportInternal |
| 229 | void OnWritableState(bool writable); |
| 230 |
| 231 | void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route); |
| 232 |
| 233 | bool SendPacket(bool rtcp, |
| 234 | rtc::CopyOnWriteBuffer* packet, |
| 235 | const rtc::PacketOptions& options); |
| 236 |
| 237 | void EnableMedia_w() RTC_RUN_ON(worker_thread()); |
| 238 | void DisableMedia_w() RTC_RUN_ON(worker_thread()); |
| 239 |
| 240 | // Performs actions if the RTP/RTCP writable state changed. This should |
| 241 | // be called whenever a channel's writable state changes or when RTCP muxing |
| 242 | // becomes active/inactive. |
| 243 | void UpdateWritableState_n() RTC_RUN_ON(network_thread()); |
| 244 | void ChannelWritable_n() RTC_RUN_ON(network_thread()); |
| 245 | void ChannelNotWritable_n() RTC_RUN_ON(network_thread()); |
| 246 |
| 247 | bool SetPayloadTypeDemuxingEnabled_w(bool enabled) |
| 248 | RTC_RUN_ON(worker_thread()); |
| 249 |
| 250 | // Should be called whenever the conditions for |
| 251 | // IsReadyToReceiveMedia/IsReadyToSendMedia are satisfied (or unsatisfied). |
| 252 | // Updates the send/recv state of the media channel. |
| 253 | virtual void UpdateMediaSendRecvState_w() RTC_RUN_ON(worker_thread()) = 0; |
| 254 |
| 255 | bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams, |
| 256 | webrtc::SdpType type, |
| 257 | std::string& error_desc) |
| 258 | RTC_RUN_ON(worker_thread()); |
| 259 | bool UpdateRemoteStreams_w(const MediaContentDescription* content, |
| 260 | webrtc::SdpType type, |
| 261 | std::string& error_desc) |
| 262 | RTC_RUN_ON(worker_thread()); |
| 263 | virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 264 | webrtc::SdpType type, |
| 265 | std::string& error_desc) |
| 266 | RTC_RUN_ON(worker_thread()) = 0; |
| 267 | virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 268 | webrtc::SdpType type, |
| 269 | std::string& error_desc) |
| 270 | RTC_RUN_ON(worker_thread()) = 0; |
| 271 |
| 272 | // Returns a list of RTP header extensions where any extension URI is unique. |
| 273 | // Encrypted extensions will be either preferred or discarded, depending on |
| 274 | // the current crypto_options_. |
| 275 | RtpHeaderExtensions GetDeduplicatedRtpHeaderExtensions( |
| 276 | const RtpHeaderExtensions& extensions); |
| 277 |
| 278 | // Add `payload_type` to `demuxer_criteria_` if payload type demuxing is |
| 279 | // enabled. |
| 280 | // Returns true if the demuxer payload type changed and a re-registration |
| 281 | // is needed. |
| 282 | bool MaybeAddHandledPayloadType(int payload_type) RTC_RUN_ON(worker_thread()); |
| 283 |
| 284 | // Returns true if the demuxer payload type criteria was non-empty before |
| 285 | // clearing. |
| 286 | bool ClearHandledPayloadTypes() RTC_RUN_ON(worker_thread()); |
| 287 |
| 288 | // Hops to the network thread to update the transport if an update is |
| 289 | // requested. If `update_demuxer` is false and `extensions` is not set, the |
| 290 | // function simply returns. If either of these is set, the function updates |
| 291 | // the transport with either or both of the demuxer criteria and the supplied |
| 292 | // rtp header extensions. |
| 293 | // Returns `true` if either an update wasn't needed or one was successfully |
| 294 | // applied. If the return value is `false`, then updating the demuxer criteria |
| 295 | // failed, which needs to be treated as an error. |
| 296 | bool MaybeUpdateDemuxerAndRtpExtensions_w( |
| 297 | bool update_demuxer, |
| 298 | absl::optional<RtpHeaderExtensions> extensions, |
| 299 | std::string& error_desc) RTC_RUN_ON(worker_thread()); |
| 300 |
| 301 | bool RegisterRtpDemuxerSink_w() RTC_RUN_ON(worker_thread()); |
| 302 |
| 303 | // Return description of media channel to facilitate logging |
| 304 | std::string ToString() const; |
| 305 |
| 306 | const std::unique_ptr<MediaSendChannelInterface> media_send_channel_; |
| 307 | const std::unique_ptr<MediaReceiveChannelInterface> media_receive_channel_; |
| 308 |
| 309 | private: |
| 310 | bool ConnectToRtpTransport_n() RTC_RUN_ON(network_thread()); |
| 311 | void DisconnectFromRtpTransport_n() RTC_RUN_ON(network_thread()); |
| 312 | void SignalSentPacket_n(const rtc::SentPacket& sent_packet); |
| 313 |
| 314 | webrtc::TaskQueueBase* const worker_thread_; |
| 315 | rtc::Thread* const network_thread_; |
| 316 | webrtc::TaskQueueBase* const signaling_thread_; |
| 317 | rtc::scoped_refptr<webrtc::PendingTaskSafetyFlag> alive_; |
| 318 |
| 319 | std::function<void()> on_first_packet_received_ |
| 320 | RTC_GUARDED_BY(network_thread()); |
| 321 |
| 322 | webrtc::RtpTransportInternal* rtp_transport_ |
| 323 | RTC_GUARDED_BY(network_thread()) = nullptr; |
| 324 |
| 325 | std::vector<std::pair<rtc::Socket::Option, int> > socket_options_ |
| 326 | RTC_GUARDED_BY(network_thread()); |
| 327 | std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_ |
| 328 | RTC_GUARDED_BY(network_thread()); |
| 329 | bool writable_ RTC_GUARDED_BY(network_thread()) = false; |
| 330 | bool was_ever_writable_n_ RTC_GUARDED_BY(network_thread()) = false; |
| 331 | bool was_ever_writable_ RTC_GUARDED_BY(worker_thread()) = false; |
| 332 | const bool srtp_required_ = true; |
| 333 |
| 334 | // Set to either kPreferEncryptedExtension or kDiscardEncryptedExtension |
| 335 | // based on the supplied CryptoOptions. |
| 336 | const webrtc::RtpExtension::Filter extensions_filter_; |
| 337 |
| 338 | // Currently the `enabled_` flag is accessed from the signaling thread as |
| 339 | // well, but it can be changed only when signaling thread does a synchronous |
| 340 | // call to the worker thread, so it should be safe. |
| 341 | bool enabled_ RTC_GUARDED_BY(worker_thread()) = false; |
| 342 | bool enabled_s_ RTC_GUARDED_BY(signaling_thread()) = false; |
| 343 | bool payload_type_demuxing_enabled_ RTC_GUARDED_BY(worker_thread()) = true; |
| 344 | std::vector<StreamParams> local_streams_ RTC_GUARDED_BY(worker_thread()); |
| 345 | std::vector<StreamParams> remote_streams_ RTC_GUARDED_BY(worker_thread()); |
| 346 | webrtc::RtpTransceiverDirection local_content_direction_ RTC_GUARDED_BY( |
| 347 | worker_thread()) = webrtc::RtpTransceiverDirection::kInactive; |
| 348 | webrtc::RtpTransceiverDirection remote_content_direction_ RTC_GUARDED_BY( |
| 349 | worker_thread()) = webrtc::RtpTransceiverDirection::kInactive; |
| 350 |
| 351 | // Cached list of payload types, used if payload type demuxing is re-enabled. |
| 352 | webrtc::flat_set<uint8_t> payload_types_ RTC_GUARDED_BY(worker_thread()); |
| 353 | // A stored copy of the rtp header extensions as applied to the transport. |
| 354 | RtpHeaderExtensions rtp_header_extensions_ RTC_GUARDED_BY(worker_thread()); |
| 355 | // TODO(bugs.webrtc.org/12239): Modified on worker thread, accessed |
| 356 | // on network thread in RegisterRtpDemuxerSink_n (called from Init_w) |
| 357 | webrtc::RtpDemuxerCriteria demuxer_criteria_; |
| 358 | // This generator is used to generate SSRCs for local streams. |
| 359 | // This is needed in cases where SSRCs are not negotiated or set explicitly |
| 360 | // like in Simulcast. |
| 361 | // This object is not owned by the channel so it must outlive it. |
| 362 | rtc::UniqueRandomIdGenerator* const ssrc_generator_; |
| 363 | }; |
| 364 |
| 365 | // VoiceChannel is a specialization that adds support for early media, DTMF, |
| 366 | // and input/output level monitoring. |
| 367 | class VoiceChannel : public BaseChannel { |
| 368 | public: |
| 369 | VoiceChannel( |
| 370 | webrtc::TaskQueueBase* worker_thread, |
| 371 | rtc::Thread* network_thread, |
| 372 | webrtc::TaskQueueBase* signaling_thread, |
| 373 | std::unique_ptr<VoiceMediaSendChannelInterface> send_channel_impl, |
| 374 | std::unique_ptr<VoiceMediaReceiveChannelInterface> receive_channel_impl, |
| 375 | absl::string_view mid, |
| 376 | bool srtp_required, |
| 377 | webrtc::CryptoOptions crypto_options, |
| 378 | rtc::UniqueRandomIdGenerator* ssrc_generator); |
| 379 |
| 380 | ~VoiceChannel(); |
| 381 |
| 382 | VideoChannel* AsVideoChannel() override { |
| 383 | RTC_CHECK_NOTREACHED(); |
| 384 | return nullptr; |
| 385 | } |
| 386 | VoiceChannel* AsVoiceChannel() override { return this; } |
| 387 |
| 388 | VoiceMediaSendChannelInterface* send_channel() { |
| 389 | return media_send_channel_->AsVoiceSendChannel(); |
| 390 | } |
| 391 |
| 392 | VoiceMediaReceiveChannelInterface* receive_channel() { |
| 393 | return media_receive_channel_->AsVoiceReceiveChannel(); |
| 394 | } |
| 395 |
| 396 | VoiceMediaSendChannelInterface* media_send_channel() override { |
| 397 | return send_channel(); |
| 398 | } |
| 399 |
| 400 | VoiceMediaSendChannelInterface* voice_media_send_channel() override { |
| 401 | return send_channel(); |
| 402 | } |
| 403 |
| 404 | VoiceMediaReceiveChannelInterface* media_receive_channel() override { |
| 405 | return receive_channel(); |
| 406 | } |
| 407 |
| 408 | VoiceMediaReceiveChannelInterface* voice_media_receive_channel() override { |
| 409 | return receive_channel(); |
| 410 | } |
| 411 |
| 412 | cricket::MediaType media_type() const override { |
| 413 | return cricket::MEDIA_TYPE_AUDIO; |
| 414 | } |
| 415 |
| 416 | private: |
| 417 | // overrides from BaseChannel |
| 418 | void UpdateMediaSendRecvState_w() RTC_RUN_ON(worker_thread()) override; |
| 419 | bool SetLocalContent_w(const MediaContentDescription* content, |
| 420 | webrtc::SdpType type, |
| 421 | std::string& error_desc) |
| 422 | RTC_RUN_ON(worker_thread()) override; |
| 423 | bool SetRemoteContent_w(const MediaContentDescription* content, |
| 424 | webrtc::SdpType type, |
| 425 | std::string& error_desc) |
| 426 | RTC_RUN_ON(worker_thread()) override; |
| 427 |
| 428 | // Last AudioSenderParameter sent down to the media_channel() via |
| 429 | // SetSenderParameters. |
| 430 | AudioSenderParameter last_send_params_ RTC_GUARDED_BY(worker_thread()); |
| 431 | // Last AudioReceiverParameters sent down to the media_channel() via |
| 432 | // SetReceiverParameters. |
| 433 | AudioReceiverParameters last_recv_params_ RTC_GUARDED_BY(worker_thread()); |
| 434 | }; |
| 435 |
| 436 | // VideoChannel is a specialization for video. |
| 437 | class VideoChannel : public BaseChannel { |
| 438 | public: |
| 439 | VideoChannel( |
| 440 | webrtc::TaskQueueBase* worker_thread, |
| 441 | rtc::Thread* network_thread, |
| 442 | webrtc::TaskQueueBase* signaling_thread, |
| 443 | std::unique_ptr<VideoMediaSendChannelInterface> media_send_channel, |
| 444 | std::unique_ptr<VideoMediaReceiveChannelInterface> media_receive_channel, |
| 445 | absl::string_view mid, |
| 446 | bool srtp_required, |
| 447 | webrtc::CryptoOptions crypto_options, |
| 448 | rtc::UniqueRandomIdGenerator* ssrc_generator); |
| 449 | ~VideoChannel(); |
| 450 |
| 451 | VideoChannel* AsVideoChannel() override { return this; } |
| 452 | VoiceChannel* AsVoiceChannel() override { |
| 453 | RTC_CHECK_NOTREACHED(); |
| 454 | return nullptr; |
| 455 | } |
| 456 |
| 457 | VideoMediaSendChannelInterface* send_channel() { |
| 458 | return media_send_channel_->AsVideoSendChannel(); |
| 459 | } |
| 460 |
| 461 | VideoMediaReceiveChannelInterface* receive_channel() { |
| 462 | return media_receive_channel_->AsVideoReceiveChannel(); |
| 463 | } |
| 464 |
| 465 | VideoMediaSendChannelInterface* media_send_channel() override { |
| 466 | return send_channel(); |
| 467 | } |
| 468 |
| 469 | VideoMediaSendChannelInterface* video_media_send_channel() override { |
| 470 | return send_channel(); |
| 471 | } |
| 472 |
| 473 | VideoMediaReceiveChannelInterface* media_receive_channel() override { |
| 474 | return receive_channel(); |
| 475 | } |
| 476 |
| 477 | VideoMediaReceiveChannelInterface* video_media_receive_channel() override { |
| 478 | return receive_channel(); |
| 479 | } |
| 480 |
| 481 | cricket::MediaType media_type() const override { |
| 482 | return cricket::MEDIA_TYPE_VIDEO; |
| 483 | } |
| 484 |
| 485 | private: |
| 486 | // overrides from BaseChannel |
| 487 | void UpdateMediaSendRecvState_w() RTC_RUN_ON(worker_thread()) override; |
| 488 | bool SetLocalContent_w(const MediaContentDescription* content, |
| 489 | webrtc::SdpType type, |
| 490 | std::string& error_desc) |
| 491 | RTC_RUN_ON(worker_thread()) override; |
| 492 | bool SetRemoteContent_w(const MediaContentDescription* content, |
| 493 | webrtc::SdpType type, |
| 494 | std::string& error_desc) |
| 495 | RTC_RUN_ON(worker_thread()) override; |
| 496 |
| 497 | // Last VideoSenderParameters sent down to the media_channel() via |
| 498 | // SetSenderParameters. |
| 499 | VideoSenderParameters last_send_params_ RTC_GUARDED_BY(worker_thread()); |
| 500 | // Last VideoReceiverParameters sent down to the media_channel() via |
| 501 | // SetReceiverParameters. |
| 502 | VideoReceiverParameters last_recv_params_ RTC_GUARDED_BY(worker_thread()); |
| 503 | }; |
| 504 |
| 505 | } // namespace cricket |
| 506 |
| 507 | #endif // PC_CHANNEL_H_ |
| 508 |