| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef TALK_SESSION_MEDIA_CHANNEL_H_ | 28 #ifndef TALK_SESSION_MEDIA_CHANNEL_H_ |
| 29 #define TALK_SESSION_MEDIA_CHANNEL_H_ | 29 #define TALK_SESSION_MEDIA_CHANNEL_H_ |
| 30 | 30 |
| 31 #include <string> | 31 #include <string> |
| 32 #include <vector> | 32 #include <vector> |
| 33 #include <map> |
| 34 #include <set> |
| 35 #include <utility> |
| 33 | 36 |
| 34 #include "talk/media/base/mediachannel.h" | 37 #include "talk/media/base/mediachannel.h" |
| 35 #include "talk/media/base/mediaengine.h" | 38 #include "talk/media/base/mediaengine.h" |
| 36 #include "talk/media/base/streamparams.h" | 39 #include "talk/media/base/streamparams.h" |
| 37 #include "talk/media/base/videocapturer.h" | 40 #include "talk/media/base/videocapturer.h" |
| 38 #include "webrtc/p2p/base/session.h" | 41 #include "webrtc/p2p/base/transportcontroller.h" |
| 39 #include "webrtc/p2p/client/socketmonitor.h" | 42 #include "webrtc/p2p/client/socketmonitor.h" |
| 40 #include "talk/session/media/audiomonitor.h" | 43 #include "talk/session/media/audiomonitor.h" |
| 41 #include "talk/session/media/bundlefilter.h" | 44 #include "talk/session/media/bundlefilter.h" |
| 42 #include "talk/session/media/mediamonitor.h" | 45 #include "talk/session/media/mediamonitor.h" |
| 43 #include "talk/session/media/mediasession.h" | 46 #include "talk/session/media/mediasession.h" |
| 44 #include "talk/session/media/rtcpmuxfilter.h" | 47 #include "talk/session/media/rtcpmuxfilter.h" |
| 45 #include "talk/session/media/srtpfilter.h" | 48 #include "talk/session/media/srtpfilter.h" |
| 46 #include "webrtc/base/asyncudpsocket.h" | 49 #include "webrtc/base/asyncudpsocket.h" |
| 47 #include "webrtc/base/criticalsection.h" | 50 #include "webrtc/base/criticalsection.h" |
| 48 #include "webrtc/base/network.h" | 51 #include "webrtc/base/network.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! | 72 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! |
| 70 // This is required to avoid a data race between the destructor modifying the | 73 // This is required to avoid a data race between the destructor modifying the |
| 71 // vtable, and the media channel's thread using BaseChannel as the | 74 // vtable, and the media channel's thread using BaseChannel as the |
| 72 // NetworkInterface. | 75 // NetworkInterface. |
| 73 | 76 |
| 74 class BaseChannel | 77 class BaseChannel |
| 75 : public rtc::MessageHandler, public sigslot::has_slots<>, | 78 : public rtc::MessageHandler, public sigslot::has_slots<>, |
| 76 public MediaChannel::NetworkInterface, | 79 public MediaChannel::NetworkInterface, |
| 77 public ConnectionStatsGetter { | 80 public ConnectionStatsGetter { |
| 78 public: | 81 public: |
| 79 BaseChannel(rtc::Thread* thread, MediaChannel* channel, BaseSession* session, | 82 BaseChannel(rtc::Thread* thread, |
| 80 const std::string& content_name, bool rtcp); | 83 MediaChannel* channel, |
| 84 TransportController* transport_controller, |
| 85 const std::string& content_name, |
| 86 bool rtcp); |
| 81 virtual ~BaseChannel(); | 87 virtual ~BaseChannel(); |
| 82 bool Init(); | 88 bool Init(); |
| 83 // Deinit may be called multiple times and is simply ignored if it's alreay | 89 // Deinit may be called multiple times and is simply ignored if it's alreay |
| 84 // done. | 90 // done. |
| 85 void Deinit(); | 91 void Deinit(); |
| 86 | 92 |
| 87 rtc::Thread* worker_thread() const { return worker_thread_; } | 93 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 88 BaseSession* session() const { return session_; } | 94 const std::string& content_name() const { return content_name_; } |
| 89 const std::string& content_name() { return content_name_; } | 95 const std::string& transport_name() const { return transport_name_; } |
| 90 TransportChannel* transport_channel() const { | 96 TransportChannel* transport_channel() const { |
| 91 return transport_channel_; | 97 return transport_channel_; |
| 92 } | 98 } |
| 93 TransportChannel* rtcp_transport_channel() const { | 99 TransportChannel* rtcp_transport_channel() const { |
| 94 return rtcp_transport_channel_; | 100 return rtcp_transport_channel_; |
| 95 } | 101 } |
| 96 bool enabled() const { return enabled_; } | 102 bool enabled() const { return enabled_; } |
| 97 | 103 |
| 98 // This function returns true if we are using SRTP. | 104 // This function returns true if we are using SRTP. |
| 99 bool secure() const { return srtp_filter_.IsActive(); } | 105 bool secure() const { return srtp_filter_.IsActive(); } |
| 100 // The following function returns true if we are using | 106 // The following function returns true if we are using |
| 101 // DTLS-based keying. If you turned off SRTP later, however | 107 // DTLS-based keying. If you turned off SRTP later, however |
| 102 // you could have secure() == false and dtls_secure() == true. | 108 // you could have secure() == false and dtls_secure() == true. |
| 103 bool secure_dtls() const { return dtls_keyed_; } | 109 bool secure_dtls() const { return dtls_keyed_; } |
| 104 // This function returns true if we require secure channel for call setup. | 110 // This function returns true if we require secure channel for call setup. |
| 105 bool secure_required() const { return secure_required_; } | 111 bool secure_required() const { return secure_required_; } |
| 106 | 112 |
| 107 bool writable() const { return writable_; } | 113 bool writable() const { return writable_; } |
| 108 bool IsStreamMuted(uint32 ssrc); | 114 bool IsStreamMuted(uint32 ssrc); |
| 109 | 115 |
| 110 // Activate RTCP mux, regardless of the state so far. Once | 116 // Activate RTCP mux, regardless of the state so far. Once |
| 111 // activated, it can not be deactivated, and if the remote | 117 // activated, it can not be deactivated, and if the remote |
| 112 // description doesn't support RTCP mux, setting the remote | 118 // description doesn't support RTCP mux, setting the remote |
| 113 // description will fail. | 119 // description will fail. |
| 114 void ActivateRtcpMux(); | 120 void ActivateRtcpMux(); |
| 121 bool SetTransport(const std::string& transport_name); |
| 115 bool PushdownLocalDescription(const SessionDescription* local_desc, | 122 bool PushdownLocalDescription(const SessionDescription* local_desc, |
| 116 ContentAction action, | 123 ContentAction action, |
| 117 std::string* error_desc); | 124 std::string* error_desc); |
| 118 bool PushdownRemoteDescription(const SessionDescription* remote_desc, | 125 bool PushdownRemoteDescription(const SessionDescription* remote_desc, |
| 119 ContentAction action, | 126 ContentAction action, |
| 120 std::string* error_desc); | 127 std::string* error_desc); |
| 121 // Channel control | 128 // Channel control |
| 122 bool SetLocalContent(const MediaContentDescription* content, | 129 bool SetLocalContent(const MediaContentDescription* content, |
| 123 ContentAction action, | 130 ContentAction action, |
| 124 std::string* error_desc); | 131 std::string* error_desc); |
| 125 bool SetRemoteContent(const MediaContentDescription* content, | 132 bool SetRemoteContent(const MediaContentDescription* content, |
| 126 ContentAction action, | 133 ContentAction action, |
| 127 std::string* error_desc); | 134 std::string* error_desc); |
| 128 | 135 |
| 129 bool Enable(bool enable); | 136 bool Enable(bool enable); |
| 130 // Mute sending media on the stream with SSRC |ssrc| | 137 // Mute sending media on the stream with SSRC |ssrc| |
| 131 // If there is only one sending stream SSRC 0 can be used. | 138 // If there is only one sending stream SSRC 0 can be used. |
| 132 bool MuteStream(uint32 ssrc, bool mute); | 139 bool MuteStream(uint32 ssrc, bool mute); |
| 133 | 140 |
| 134 // Multiplexing | 141 // Multiplexing |
| 135 bool AddRecvStream(const StreamParams& sp); | 142 bool AddRecvStream(const StreamParams& sp); |
| 136 bool RemoveRecvStream(uint32 ssrc); | 143 bool RemoveRecvStream(uint32 ssrc); |
| 137 bool AddSendStream(const StreamParams& sp); | 144 bool AddSendStream(const StreamParams& sp); |
| 138 bool RemoveSendStream(uint32 ssrc); | 145 bool RemoveSendStream(uint32 ssrc); |
| 139 | 146 |
| 140 // Monitoring | 147 // Monitoring |
| 141 void StartConnectionMonitor(int cms); | 148 void StartConnectionMonitor(int cms); |
| 142 void StopConnectionMonitor(); | 149 void StopConnectionMonitor(); |
| 143 // For ConnectionStatsGetter, used by ConnectionMonitor | 150 // For ConnectionStatsGetter, used by ConnectionMonitor |
| 144 virtual bool GetConnectionStats(ConnectionInfos* infos) override; | 151 bool GetConnectionStats(ConnectionInfos* infos) override; |
| 145 | 152 |
| 146 void set_srtp_signal_silent_time(uint32 silent_time) { | 153 void set_srtp_signal_silent_time(uint32 silent_time) { |
| 147 srtp_filter_.set_signal_silent_time(silent_time); | 154 srtp_filter_.set_signal_silent_time(silent_time); |
| 148 } | 155 } |
| 149 | 156 |
| 150 BundleFilter* bundle_filter() { return &bundle_filter_; } | 157 BundleFilter* bundle_filter() { return &bundle_filter_; } |
| 151 | 158 |
| 152 const std::vector<StreamParams>& local_streams() const { | 159 const std::vector<StreamParams>& local_streams() const { |
| 153 return local_streams_; | 160 return local_streams_; |
| 154 } | 161 } |
| 155 const std::vector<StreamParams>& remote_streams() const { | 162 const std::vector<StreamParams>& remote_streams() const { |
| 156 return remote_streams_; | 163 return remote_streams_; |
| 157 } | 164 } |
| 158 | 165 |
| 159 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; | 166 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; |
| 160 void SignalDtlsSetupFailure_w(bool rtcp); | 167 void SignalDtlsSetupFailure_w(bool rtcp); |
| 161 void SignalDtlsSetupFailure_s(bool rtcp); | 168 void SignalDtlsSetupFailure_s(bool rtcp); |
| 162 | 169 |
| 163 // Used for latency measurements. | 170 // Used for latency measurements. |
| 164 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 171 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
| 165 | 172 |
| 166 // Used to alert UI when the muted status changes, perhaps autonomously. | 173 // Used to alert UI when the muted status changes, perhaps autonomously. |
| 167 sigslot::repeater2<BaseChannel*, bool> SignalAutoMuted; | 174 sigslot::repeater2<BaseChannel*, bool> SignalAutoMuted; |
| 168 | 175 |
| 169 // Made public for easier testing. | 176 // Made public for easier testing. |
| 170 void SetReadyToSend(TransportChannel* channel, bool ready); | 177 void SetReadyToSend(bool rtcp, bool ready); |
| 171 | 178 |
| 172 // Only public for unit tests. Otherwise, consider protected. | 179 // Only public for unit tests. Otherwise, consider protected. |
| 173 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val); | 180 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val); |
| 174 | 181 |
| 175 protected: | 182 protected: |
| 176 virtual MediaChannel* media_channel() const { return media_channel_; } | 183 virtual MediaChannel* media_channel() const { return media_channel_; } |
| 177 // Sets the transport_channel_ and rtcp_transport_channel_. If | 184 // Sets the transport_channel_ (and rtcp_transport_channel_, if |rtcp_| is |
| 178 // |rtcp| is false, set rtcp_transport_channel_ is set to NULL. Get | 185 // true). Gets the transport channels from |transport_controller_|. |
| 179 // the transport channels from |session|. | 186 bool SetTransportChannels(const std::string& transport_name); |
| 180 // TODO(pthatcher): Pass in a Transport instead of a BaseSession. | 187 bool SetTransportChannels_w(const std::string& transport_name); |
| 181 bool SetTransportChannels(BaseSession* session, bool rtcp); | |
| 182 bool SetTransportChannels_w(BaseSession* session, bool rtcp); | |
| 183 void set_transport_channel(TransportChannel* transport); | 188 void set_transport_channel(TransportChannel* transport); |
| 184 void set_rtcp_transport_channel(TransportChannel* transport); | 189 void set_rtcp_transport_channel(TransportChannel* transport); |
| 185 bool was_ever_writable() const { return was_ever_writable_; } | 190 bool was_ever_writable() const { return was_ever_writable_; } |
| 186 void set_local_content_direction(MediaContentDirection direction) { | 191 void set_local_content_direction(MediaContentDirection direction) { |
| 187 local_content_direction_ = direction; | 192 local_content_direction_ = direction; |
| 188 } | 193 } |
| 189 void set_remote_content_direction(MediaContentDirection direction) { | 194 void set_remote_content_direction(MediaContentDirection direction) { |
| 190 remote_content_direction_ = direction; | 195 remote_content_direction_ = direction; |
| 191 } | 196 } |
| 192 void set_secure_required(bool secure_required) { | 197 void set_secure_required(bool secure_required) { |
| 193 secure_required_ = secure_required; | 198 secure_required_ = secure_required; |
| 194 } | 199 } |
| 195 bool IsReadyToReceive() const; | 200 bool IsReadyToReceive() const; |
| 196 bool IsReadyToSend() const; | 201 bool IsReadyToSend() const; |
| 197 rtc::Thread* signaling_thread() { return session_->signaling_thread(); } | 202 rtc::Thread* signaling_thread() { |
| 203 return transport_controller_->signaling_thread(); |
| 204 } |
| 198 SrtpFilter* srtp_filter() { return &srtp_filter_; } | 205 SrtpFilter* srtp_filter() { return &srtp_filter_; } |
| 199 bool rtcp() const { return rtcp_; } | 206 bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; } |
| 200 | 207 |
| 201 void ConnectToTransportChannel(TransportChannel* tc); | 208 void ConnectToTransportChannel(TransportChannel* tc); |
| 202 void DisconnectFromTransportChannel(TransportChannel* tc); | 209 void DisconnectFromTransportChannel(TransportChannel* tc); |
| 203 | 210 |
| 204 void FlushRtcpMessages(); | 211 void FlushRtcpMessages(); |
| 205 | 212 |
| 206 // NetworkInterface implementation, called by MediaEngine | 213 // NetworkInterface implementation, called by MediaEngine |
| 207 virtual bool SendPacket(rtc::Buffer* packet, | 214 virtual bool SendPacket(rtc::Buffer* packet, |
| 208 rtc::DiffServCodePoint dscp); | 215 rtc::DiffServCodePoint dscp); |
| 209 virtual bool SendRtcp(rtc::Buffer* packet, | 216 virtual bool SendRtcp(rtc::Buffer* packet, |
| 210 rtc::DiffServCodePoint dscp); | 217 rtc::DiffServCodePoint dscp); |
| 211 | 218 |
| 212 // From TransportChannel | 219 // From TransportChannel |
| 213 void OnWritableState(TransportChannel* channel); | 220 void OnWritableState(TransportChannel* channel); |
| 214 virtual void OnChannelRead(TransportChannel* channel, | 221 virtual void OnChannelRead(TransportChannel* channel, |
| 215 const char* data, | 222 const char* data, |
| 216 size_t len, | 223 size_t len, |
| 217 const rtc::PacketTime& packet_time, | 224 const rtc::PacketTime& packet_time, |
| 218 int flags); | 225 int flags); |
| 219 void OnReadyToSend(TransportChannel* channel); | 226 void OnReadyToSend(TransportChannel* channel); |
| 220 | 227 |
| 221 bool PacketIsRtcp(const TransportChannel* channel, const char* data, | 228 bool PacketIsRtcp(const TransportChannel* channel, const char* data, |
| 222 size_t len); | 229 size_t len); |
| 223 bool SendPacket(bool rtcp, rtc::Buffer* packet, | 230 bool SendPacket(bool rtcp, rtc::Buffer* packet, |
| 224 rtc::DiffServCodePoint dscp); | 231 rtc::DiffServCodePoint dscp); |
| 225 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); | 232 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); |
| 226 void HandlePacket(bool rtcp, rtc::Buffer* packet, | 233 void HandlePacket(bool rtcp, rtc::Buffer* packet, |
| 227 const rtc::PacketTime& packet_time); | 234 const rtc::PacketTime& packet_time); |
| 228 | 235 |
| 229 // Apply the new local/remote session description. | |
| 230 void OnNewLocalDescription(BaseSession* session, ContentAction action); | |
| 231 void OnNewRemoteDescription(BaseSession* session, ContentAction action); | |
| 232 | |
| 233 void EnableMedia_w(); | 236 void EnableMedia_w(); |
| 234 void DisableMedia_w(); | 237 void DisableMedia_w(); |
| 235 virtual bool MuteStream_w(uint32 ssrc, bool mute); | 238 virtual bool MuteStream_w(uint32 ssrc, bool mute); |
| 236 bool IsStreamMuted_w(uint32 ssrc); | 239 bool IsStreamMuted_w(uint32 ssrc); |
| 240 void UpdateWritableState_w(); |
| 237 void ChannelWritable_w(); | 241 void ChannelWritable_w(); |
| 238 void ChannelNotWritable_w(); | 242 void ChannelNotWritable_w(); |
| 239 bool AddRecvStream_w(const StreamParams& sp); | 243 bool AddRecvStream_w(const StreamParams& sp); |
| 240 bool RemoveRecvStream_w(uint32 ssrc); | 244 bool RemoveRecvStream_w(uint32 ssrc); |
| 241 bool AddSendStream_w(const StreamParams& sp); | 245 bool AddSendStream_w(const StreamParams& sp); |
| 242 bool RemoveSendStream_w(uint32 ssrc); | 246 bool RemoveSendStream_w(uint32 ssrc); |
| 243 virtual bool ShouldSetupDtlsSrtp() const; | 247 virtual bool ShouldSetupDtlsSrtp() const; |
| 244 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. | 248 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. |
| 245 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. | 249 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. |
| 246 bool SetupDtlsSrtp(bool rtcp_channel); | 250 bool SetupDtlsSrtp(bool rtcp_channel); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 const std::vector<ConnectionInfo>& infos) = 0; | 301 const std::vector<ConnectionInfo>& infos) = 0; |
| 298 | 302 |
| 299 // Helper function for invoking bool-returning methods on the worker thread. | 303 // Helper function for invoking bool-returning methods on the worker thread. |
| 300 template <class FunctorT> | 304 template <class FunctorT> |
| 301 bool InvokeOnWorker(const FunctorT& functor) { | 305 bool InvokeOnWorker(const FunctorT& functor) { |
| 302 return worker_thread_->Invoke<bool>(functor); | 306 return worker_thread_->Invoke<bool>(functor); |
| 303 } | 307 } |
| 304 | 308 |
| 305 private: | 309 private: |
| 306 rtc::Thread* worker_thread_; | 310 rtc::Thread* worker_thread_; |
| 307 BaseSession* session_; | 311 TransportController* transport_controller_; |
| 308 MediaChannel* media_channel_; | 312 MediaChannel* media_channel_; |
| 309 std::vector<StreamParams> local_streams_; | 313 std::vector<StreamParams> local_streams_; |
| 310 std::vector<StreamParams> remote_streams_; | 314 std::vector<StreamParams> remote_streams_; |
| 311 | 315 |
| 312 const std::string content_name_; | 316 const std::string content_name_; |
| 313 bool rtcp_; | 317 std::string transport_name_; |
| 318 bool rtcp_transport_enabled_; |
| 314 TransportChannel* transport_channel_; | 319 TransportChannel* transport_channel_; |
| 320 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
| 315 TransportChannel* rtcp_transport_channel_; | 321 TransportChannel* rtcp_transport_channel_; |
| 322 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
| 316 SrtpFilter srtp_filter_; | 323 SrtpFilter srtp_filter_; |
| 317 RtcpMuxFilter rtcp_mux_filter_; | 324 RtcpMuxFilter rtcp_mux_filter_; |
| 318 BundleFilter bundle_filter_; | 325 BundleFilter bundle_filter_; |
| 319 rtc::scoped_ptr<ConnectionMonitor> connection_monitor_; | 326 rtc::scoped_ptr<ConnectionMonitor> connection_monitor_; |
| 320 bool enabled_; | 327 bool enabled_; |
| 321 bool writable_; | 328 bool writable_; |
| 322 bool rtp_ready_to_send_; | 329 bool rtp_ready_to_send_; |
| 323 bool rtcp_ready_to_send_; | 330 bool rtcp_ready_to_send_; |
| 324 bool was_ever_writable_; | 331 bool was_ever_writable_; |
| 325 MediaContentDirection local_content_direction_; | 332 MediaContentDirection local_content_direction_; |
| 326 MediaContentDirection remote_content_direction_; | 333 MediaContentDirection remote_content_direction_; |
| 327 std::set<uint32> muted_streams_; | 334 std::set<uint32> muted_streams_; |
| 328 bool has_received_packet_; | 335 bool has_received_packet_; |
| 329 bool dtls_keyed_; | 336 bool dtls_keyed_; |
| 330 bool secure_required_; | 337 bool secure_required_; |
| 331 int rtp_abs_sendtime_extn_id_; | 338 int rtp_abs_sendtime_extn_id_; |
| 332 }; | 339 }; |
| 333 | 340 |
| 334 // VoiceChannel is a specialization that adds support for early media, DTMF, | 341 // VoiceChannel is a specialization that adds support for early media, DTMF, |
| 335 // and input/output level monitoring. | 342 // and input/output level monitoring. |
| 336 class VoiceChannel : public BaseChannel { | 343 class VoiceChannel : public BaseChannel { |
| 337 public: | 344 public: |
| 338 VoiceChannel(rtc::Thread* thread, MediaEngineInterface* media_engine, | 345 VoiceChannel(rtc::Thread* thread, |
| 339 VoiceMediaChannel* channel, BaseSession* session, | 346 MediaEngineInterface* media_engine, |
| 340 const std::string& content_name, bool rtcp); | 347 VoiceMediaChannel* channel, |
| 348 TransportController* transport_controller, |
| 349 const std::string& content_name, |
| 350 bool rtcp); |
| 341 ~VoiceChannel(); | 351 ~VoiceChannel(); |
| 342 bool Init(); | 352 bool Init(); |
| 343 bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer); | 353 bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer); |
| 344 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); | 354 bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer); |
| 345 | 355 |
| 346 // downcasts a MediaChannel | 356 // downcasts a MediaChannel |
| 347 virtual VoiceMediaChannel* media_channel() const { | 357 virtual VoiceMediaChannel* media_channel() const { |
| 348 return static_cast<VoiceMediaChannel*>(BaseChannel::media_channel()); | 358 return static_cast<VoiceMediaChannel*>(BaseChannel::media_channel()); |
| 349 } | 359 } |
| 350 | 360 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // SetSendParameters. | 455 // SetSendParameters. |
| 446 AudioSendParameters last_send_params_; | 456 AudioSendParameters last_send_params_; |
| 447 // Last AudioRecvParameters sent down to the media_channel() via | 457 // Last AudioRecvParameters sent down to the media_channel() via |
| 448 // SetRecvParameters. | 458 // SetRecvParameters. |
| 449 AudioRecvParameters last_recv_params_; | 459 AudioRecvParameters last_recv_params_; |
| 450 }; | 460 }; |
| 451 | 461 |
| 452 // VideoChannel is a specialization for video. | 462 // VideoChannel is a specialization for video. |
| 453 class VideoChannel : public BaseChannel { | 463 class VideoChannel : public BaseChannel { |
| 454 public: | 464 public: |
| 455 VideoChannel(rtc::Thread* thread, VideoMediaChannel* channel, | 465 VideoChannel(rtc::Thread* thread, |
| 456 BaseSession* session, const std::string& content_name, | 466 VideoMediaChannel* channel, |
| 467 TransportController* transport_controller, |
| 468 const std::string& content_name, |
| 457 bool rtcp); | 469 bool rtcp); |
| 458 ~VideoChannel(); | 470 ~VideoChannel(); |
| 459 bool Init(); | 471 bool Init(); |
| 460 | 472 |
| 461 // downcasts a MediaChannel | 473 // downcasts a MediaChannel |
| 462 virtual VideoMediaChannel* media_channel() const { | 474 virtual VideoMediaChannel* media_channel() const { |
| 463 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); | 475 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); |
| 464 } | 476 } |
| 465 | 477 |
| 466 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer); | 478 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // Last VideoRecvParameters sent down to the media_channel() via | 556 // Last VideoRecvParameters sent down to the media_channel() via |
| 545 // SetRecvParameters. | 557 // SetRecvParameters. |
| 546 VideoRecvParameters last_recv_params_; | 558 VideoRecvParameters last_recv_params_; |
| 547 }; | 559 }; |
| 548 | 560 |
| 549 // DataChannel is a specialization for data. | 561 // DataChannel is a specialization for data. |
| 550 class DataChannel : public BaseChannel { | 562 class DataChannel : public BaseChannel { |
| 551 public: | 563 public: |
| 552 DataChannel(rtc::Thread* thread, | 564 DataChannel(rtc::Thread* thread, |
| 553 DataMediaChannel* media_channel, | 565 DataMediaChannel* media_channel, |
| 554 BaseSession* session, | 566 TransportController* transport_controller, |
| 555 const std::string& content_name, | 567 const std::string& content_name, |
| 556 bool rtcp); | 568 bool rtcp); |
| 557 ~DataChannel(); | 569 ~DataChannel(); |
| 558 bool Init(); | 570 bool Init(); |
| 559 | 571 |
| 560 virtual bool SendData(const SendDataParams& params, | 572 virtual bool SendData(const SendDataParams& params, |
| 561 const rtc::Buffer& payload, | 573 const rtc::Buffer& payload, |
| 562 SendDataResult* result); | 574 SendDataResult* result); |
| 563 | 575 |
| 564 void StartMediaMonitor(int cms); | 576 void StartMediaMonitor(int cms); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // SetSendParameters. | 679 // SetSendParameters. |
| 668 DataSendParameters last_send_params_; | 680 DataSendParameters last_send_params_; |
| 669 // Last DataRecvParameters sent down to the media_channel() via | 681 // Last DataRecvParameters sent down to the media_channel() via |
| 670 // SetRecvParameters. | 682 // SetRecvParameters. |
| 671 DataRecvParameters last_recv_params_; | 683 DataRecvParameters last_recv_params_; |
| 672 }; | 684 }; |
| 673 | 685 |
| 674 } // namespace cricket | 686 } // namespace cricket |
| 675 | 687 |
| 676 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 688 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
| OLD | NEW |