| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "webrtc/base/asyncudpsocket.h" | 46 #include "webrtc/base/asyncudpsocket.h" |
| 47 #include "webrtc/base/criticalsection.h" | 47 #include "webrtc/base/criticalsection.h" |
| 48 #include "webrtc/base/network.h" | 48 #include "webrtc/base/network.h" |
| 49 #include "webrtc/base/sigslot.h" | 49 #include "webrtc/base/sigslot.h" |
| 50 #include "webrtc/base/window.h" | 50 #include "webrtc/base/window.h" |
| 51 | 51 |
| 52 namespace cricket { | 52 namespace cricket { |
| 53 | 53 |
| 54 struct CryptoParams; | 54 struct CryptoParams; |
| 55 class MediaContentDescription; | 55 class MediaContentDescription; |
| 56 struct TypingMonitorOptions; | |
| 57 class TypingMonitor; | |
| 58 struct ViewRequest; | 56 struct ViewRequest; |
| 59 | 57 |
| 60 enum SinkType { | 58 enum SinkType { |
| 61 SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption. | 59 SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption. |
| 62 SINK_POST_CRYPTO // Sink packets after encryption or before decryption. | 60 SINK_POST_CRYPTO // Sink packets after encryption or before decryption. |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 // BaseChannel contains logic common to voice and video, including | 63 // BaseChannel contains logic common to voice and video, including |
| 66 // enable/mute, marshaling calls to a worker thread, and | 64 // enable/mute, marshaling calls to a worker thread, and |
| 67 // connection and media monitors. | 65 // connection and media monitors. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return remote_streams_; | 154 return remote_streams_; |
| 157 } | 155 } |
| 158 | 156 |
| 159 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; | 157 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; |
| 160 void SignalDtlsSetupFailure_w(bool rtcp); | 158 void SignalDtlsSetupFailure_w(bool rtcp); |
| 161 void SignalDtlsSetupFailure_s(bool rtcp); | 159 void SignalDtlsSetupFailure_s(bool rtcp); |
| 162 | 160 |
| 163 // Used for latency measurements. | 161 // Used for latency measurements. |
| 164 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 162 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
| 165 | 163 |
| 166 // Used to alert UI when the muted status changes, perhaps autonomously. | |
| 167 sigslot::repeater2<BaseChannel*, bool> SignalAutoMuted; | |
| 168 | |
| 169 // Made public for easier testing. | 164 // Made public for easier testing. |
| 170 void SetReadyToSend(TransportChannel* channel, bool ready); | 165 void SetReadyToSend(TransportChannel* channel, bool ready); |
| 171 | 166 |
| 172 // Only public for unit tests. Otherwise, consider protected. | 167 // Only public for unit tests. Otherwise, consider protected. |
| 173 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val); | 168 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val); |
| 174 | 169 |
| 175 protected: | 170 protected: |
| 176 virtual MediaChannel* media_channel() const { return media_channel_; } | 171 virtual MediaChannel* media_channel() const { return media_channel_; } |
| 177 // Sets the transport_channel_ and rtcp_transport_channel_. If | 172 // Sets the transport_channel_ and rtcp_transport_channel_. If |
| 178 // |rtcp| is false, set rtcp_transport_channel_ is set to NULL. Get | 173 // |rtcp| is false, set rtcp_transport_channel_ is set to NULL. Get |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); | 220 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); |
| 226 void HandlePacket(bool rtcp, rtc::Buffer* packet, | 221 void HandlePacket(bool rtcp, rtc::Buffer* packet, |
| 227 const rtc::PacketTime& packet_time); | 222 const rtc::PacketTime& packet_time); |
| 228 | 223 |
| 229 // Apply the new local/remote session description. | 224 // Apply the new local/remote session description. |
| 230 void OnNewLocalDescription(BaseSession* session, ContentAction action); | 225 void OnNewLocalDescription(BaseSession* session, ContentAction action); |
| 231 void OnNewRemoteDescription(BaseSession* session, ContentAction action); | 226 void OnNewRemoteDescription(BaseSession* session, ContentAction action); |
| 232 | 227 |
| 233 void EnableMedia_w(); | 228 void EnableMedia_w(); |
| 234 void DisableMedia_w(); | 229 void DisableMedia_w(); |
| 235 virtual bool MuteStream_w(uint32 ssrc, bool mute); | 230 bool MuteStream_w(uint32 ssrc, bool mute); |
| 236 bool IsStreamMuted_w(uint32 ssrc); | 231 bool IsStreamMuted_w(uint32 ssrc); |
| 237 void ChannelWritable_w(); | 232 void ChannelWritable_w(); |
| 238 void ChannelNotWritable_w(); | 233 void ChannelNotWritable_w(); |
| 239 bool AddRecvStream_w(const StreamParams& sp); | 234 bool AddRecvStream_w(const StreamParams& sp); |
| 240 bool RemoveRecvStream_w(uint32 ssrc); | 235 bool RemoveRecvStream_w(uint32 ssrc); |
| 241 bool AddSendStream_w(const StreamParams& sp); | 236 bool AddSendStream_w(const StreamParams& sp); |
| 242 bool RemoveSendStream_w(uint32 ssrc); | 237 bool RemoveSendStream_w(uint32 ssrc); |
| 243 virtual bool ShouldSetupDtlsSrtp() const; | 238 virtual bool ShouldSetupDtlsSrtp() const; |
| 244 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. | 239 // 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. | 240 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 371 |
| 377 void StartMediaMonitor(int cms); | 372 void StartMediaMonitor(int cms); |
| 378 void StopMediaMonitor(); | 373 void StopMediaMonitor(); |
| 379 sigslot::signal2<VoiceChannel*, const VoiceMediaInfo&> SignalMediaMonitor; | 374 sigslot::signal2<VoiceChannel*, const VoiceMediaInfo&> SignalMediaMonitor; |
| 380 | 375 |
| 381 void StartAudioMonitor(int cms); | 376 void StartAudioMonitor(int cms); |
| 382 void StopAudioMonitor(); | 377 void StopAudioMonitor(); |
| 383 bool IsAudioMonitorRunning() const; | 378 bool IsAudioMonitorRunning() const; |
| 384 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor; | 379 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor; |
| 385 | 380 |
| 386 void StartTypingMonitor(const TypingMonitorOptions& settings); | |
| 387 void StopTypingMonitor(); | |
| 388 bool IsTypingMonitorRunning() const; | |
| 389 | |
| 390 // Overrides BaseChannel::MuteStream_w. | |
| 391 virtual bool MuteStream_w(uint32 ssrc, bool mute); | |
| 392 | |
| 393 int GetInputLevel_w(); | 381 int GetInputLevel_w(); |
| 394 int GetOutputLevel_w(); | 382 int GetOutputLevel_w(); |
| 395 void GetActiveStreams_w(AudioInfo::StreamList* actives); | 383 void GetActiveStreams_w(AudioInfo::StreamList* actives); |
| 396 | 384 |
| 397 // Signal errors from VoiceMediaChannel. Arguments are: | 385 // Signal errors from VoiceMediaChannel. Arguments are: |
| 398 // ssrc(uint32), and error(VoiceMediaChannel::Error). | 386 // ssrc(uint32), and error(VoiceMediaChannel::Error). |
| 399 sigslot::signal3<VoiceChannel*, uint32, VoiceMediaChannel::Error> | 387 sigslot::signal3<VoiceChannel*, uint32, VoiceMediaChannel::Error> |
| 400 SignalMediaError; | 388 SignalMediaError; |
| 401 | 389 |
| 402 // Configuration and setting. | 390 // Configuration and setting. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 432 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); | 420 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); |
| 433 void OnVoiceChannelError(uint32 ssrc, VoiceMediaChannel::Error error); | 421 void OnVoiceChannelError(uint32 ssrc, VoiceMediaChannel::Error error); |
| 434 void SendLastMediaError(); | 422 void SendLastMediaError(); |
| 435 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error); | 423 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error); |
| 436 | 424 |
| 437 static const int kEarlyMediaTimeout = 1000; | 425 static const int kEarlyMediaTimeout = 1000; |
| 438 MediaEngineInterface* media_engine_; | 426 MediaEngineInterface* media_engine_; |
| 439 bool received_media_; | 427 bool received_media_; |
| 440 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; | 428 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; |
| 441 rtc::scoped_ptr<AudioMonitor> audio_monitor_; | 429 rtc::scoped_ptr<AudioMonitor> audio_monitor_; |
| 442 rtc::scoped_ptr<TypingMonitor> typing_monitor_; | |
| 443 | 430 |
| 444 // Last AudioSendParameters sent down to the media_channel() via | 431 // Last AudioSendParameters sent down to the media_channel() via |
| 445 // SetSendParameters. | 432 // SetSendParameters. |
| 446 AudioSendParameters last_send_params_; | 433 AudioSendParameters last_send_params_; |
| 447 // Last AudioRecvParameters sent down to the media_channel() via | 434 // Last AudioRecvParameters sent down to the media_channel() via |
| 448 // SetRecvParameters. | 435 // SetRecvParameters. |
| 449 AudioRecvParameters last_recv_params_; | 436 AudioRecvParameters last_recv_params_; |
| 450 }; | 437 }; |
| 451 | 438 |
| 452 // VideoChannel is a specialization for video. | 439 // VideoChannel is a specialization for video. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // SetSendParameters. | 654 // SetSendParameters. |
| 668 DataSendParameters last_send_params_; | 655 DataSendParameters last_send_params_; |
| 669 // Last DataRecvParameters sent down to the media_channel() via | 656 // Last DataRecvParameters sent down to the media_channel() via |
| 670 // SetRecvParameters. | 657 // SetRecvParameters. |
| 671 DataRecvParameters last_recv_params_; | 658 DataRecvParameters last_recv_params_; |
| 672 }; | 659 }; |
| 673 | 660 |
| 674 } // namespace cricket | 661 } // namespace cricket |
| 675 | 662 |
| 676 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 663 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
| OLD | NEW |