| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 // Made public for easier testing. | 168 // Made public for easier testing. |
| 169 void SetReadyToSend(bool rtcp, bool ready); | 169 void SetReadyToSend(bool rtcp, bool ready); |
| 170 | 170 |
| 171 // Only public for unit tests. Otherwise, consider protected. | 171 // Only public for unit tests. Otherwise, consider protected. |
| 172 int SetOption(SocketType type, rtc::Socket::Option o, int val) | 172 int SetOption(SocketType type, rtc::Socket::Option o, int val) |
| 173 override; | 173 override; |
| 174 | 174 |
| 175 SrtpFilter* srtp_filter() { return &srtp_filter_; } | 175 SrtpFilter* srtp_filter() { return &srtp_filter_; } |
| 176 | 176 |
| 177 bool SetCryptoOptions(const rtc::CryptoOptions& crypto_options); |
| 178 |
| 177 protected: | 179 protected: |
| 178 virtual MediaChannel* media_channel() const { return media_channel_; } | 180 virtual MediaChannel* media_channel() const { return media_channel_; } |
| 179 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is | 181 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is |
| 180 // true). Gets the transport channels from |transport_controller_|. | 182 // true). Gets the transport channels from |transport_controller_|. |
| 181 bool SetTransport_w(const std::string& transport_name); | 183 bool SetTransport_w(const std::string& transport_name); |
| 182 | 184 |
| 183 void set_transport_channel(TransportChannel* transport); | 185 void set_transport_channel(TransportChannel* transport); |
| 184 void set_rtcp_transport_channel(TransportChannel* transport, | 186 void set_rtcp_transport_channel(TransportChannel* transport, |
| 185 bool update_writablity); | 187 bool update_writablity); |
| 186 | 188 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 bool SetRtcpMux_w(bool enable, | 289 bool SetRtcpMux_w(bool enable, |
| 288 ContentAction action, | 290 ContentAction action, |
| 289 ContentSource src, | 291 ContentSource src, |
| 290 std::string* error_desc); | 292 std::string* error_desc); |
| 291 | 293 |
| 292 // From MessageHandler | 294 // From MessageHandler |
| 293 void OnMessage(rtc::Message* pmsg) override; | 295 void OnMessage(rtc::Message* pmsg) override; |
| 294 | 296 |
| 295 // Handled in derived classes | 297 // Handled in derived classes |
| 296 // Get the SRTP crypto suites to use for RTP media | 298 // Get the SRTP crypto suites to use for RTP media |
| 297 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; | 299 virtual void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 300 std::vector<int>* crypto_suites) const = 0; |
| 298 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, | 301 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, |
| 299 const std::vector<ConnectionInfo>& infos) = 0; | 302 const std::vector<ConnectionInfo>& infos) = 0; |
| 300 | 303 |
| 301 // Helper function for invoking bool-returning methods on the worker thread. | 304 // Helper function for invoking bool-returning methods on the worker thread. |
| 302 template <class FunctorT> | 305 template <class FunctorT> |
| 303 bool InvokeOnWorker(const FunctorT& functor) { | 306 bool InvokeOnWorker(const FunctorT& functor) { |
| 304 return worker_thread_->Invoke<bool>(functor); | 307 return worker_thread_->Invoke<bool>(functor); |
| 305 } | 308 } |
| 306 | 309 |
| 307 private: | 310 private: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 325 bool enabled_; | 328 bool enabled_; |
| 326 bool writable_; | 329 bool writable_; |
| 327 bool rtp_ready_to_send_; | 330 bool rtp_ready_to_send_; |
| 328 bool rtcp_ready_to_send_; | 331 bool rtcp_ready_to_send_; |
| 329 bool was_ever_writable_; | 332 bool was_ever_writable_; |
| 330 MediaContentDirection local_content_direction_; | 333 MediaContentDirection local_content_direction_; |
| 331 MediaContentDirection remote_content_direction_; | 334 MediaContentDirection remote_content_direction_; |
| 332 bool has_received_packet_; | 335 bool has_received_packet_; |
| 333 bool dtls_keyed_; | 336 bool dtls_keyed_; |
| 334 bool secure_required_; | 337 bool secure_required_; |
| 338 rtc::CryptoOptions crypto_options_; |
| 335 int rtp_abs_sendtime_extn_id_; | 339 int rtp_abs_sendtime_extn_id_; |
| 336 }; | 340 }; |
| 337 | 341 |
| 338 // VoiceChannel is a specialization that adds support for early media, DTMF, | 342 // VoiceChannel is a specialization that adds support for early media, DTMF, |
| 339 // and input/output level monitoring. | 343 // and input/output level monitoring. |
| 340 class VoiceChannel : public BaseChannel { | 344 class VoiceChannel : public BaseChannel { |
| 341 public: | 345 public: |
| 342 VoiceChannel(rtc::Thread* thread, | 346 VoiceChannel(rtc::Thread* thread, |
| 343 MediaEngineInterface* media_engine, | 347 MediaEngineInterface* media_engine, |
| 344 VoiceMediaChannel* channel, | 348 VoiceMediaChannel* channel, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 std::string* error_desc); | 415 std::string* error_desc); |
| 412 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 416 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 413 ContentAction action, | 417 ContentAction action, |
| 414 std::string* error_desc); | 418 std::string* error_desc); |
| 415 void HandleEarlyMediaTimeout(); | 419 void HandleEarlyMediaTimeout(); |
| 416 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); | 420 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); |
| 417 bool SetOutputVolume_w(uint32_t ssrc, double volume); | 421 bool SetOutputVolume_w(uint32_t ssrc, double volume); |
| 418 bool GetStats_w(VoiceMediaInfo* stats); | 422 bool GetStats_w(VoiceMediaInfo* stats); |
| 419 | 423 |
| 420 virtual void OnMessage(rtc::Message* pmsg); | 424 virtual void OnMessage(rtc::Message* pmsg); |
| 421 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 425 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 426 std::vector<int>* crypto_suites) const override; |
| 422 virtual void OnConnectionMonitorUpdate( | 427 virtual void OnConnectionMonitorUpdate( |
| 423 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 428 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
| 424 virtual void OnMediaMonitorUpdate( | 429 virtual void OnMediaMonitorUpdate( |
| 425 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); | 430 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); |
| 426 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); | 431 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); |
| 427 | 432 |
| 428 static const int kEarlyMediaTimeout = 1000; | 433 static const int kEarlyMediaTimeout = 1000; |
| 429 MediaEngineInterface* media_engine_; | 434 MediaEngineInterface* media_engine_; |
| 430 bool received_media_; | 435 bool received_media_; |
| 431 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; | 436 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 std::string* error_desc); | 502 std::string* error_desc); |
| 498 bool ApplyViewRequest_w(const ViewRequest& request); | 503 bool ApplyViewRequest_w(const ViewRequest& request); |
| 499 | 504 |
| 500 bool AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer); | 505 bool AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer); |
| 501 bool RemoveScreencast_w(uint32_t ssrc); | 506 bool RemoveScreencast_w(uint32_t ssrc); |
| 502 void OnScreencastWindowEvent_s(uint32_t ssrc, rtc::WindowEvent we); | 507 void OnScreencastWindowEvent_s(uint32_t ssrc, rtc::WindowEvent we); |
| 503 bool IsScreencasting_w() const; | 508 bool IsScreencasting_w() const; |
| 504 bool GetStats_w(VideoMediaInfo* stats); | 509 bool GetStats_w(VideoMediaInfo* stats); |
| 505 | 510 |
| 506 virtual void OnMessage(rtc::Message* pmsg); | 511 virtual void OnMessage(rtc::Message* pmsg); |
| 507 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 512 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 513 std::vector<int>* crypto_suites) const override; |
| 508 virtual void OnConnectionMonitorUpdate( | 514 virtual void OnConnectionMonitorUpdate( |
| 509 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 515 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
| 510 virtual void OnMediaMonitorUpdate( | 516 virtual void OnMediaMonitorUpdate( |
| 511 VideoMediaChannel* media_channel, const VideoMediaInfo& info); | 517 VideoMediaChannel* media_channel, const VideoMediaInfo& info); |
| 512 virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event); | 518 virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event); |
| 513 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); | 519 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); |
| 514 bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc); | 520 bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc); |
| 515 | 521 |
| 516 VideoRenderer* renderer_; | 522 VideoRenderer* renderer_; |
| 517 ScreencastMap screencast_capturers_; | 523 ScreencastMap screencast_capturers_; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 620 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 615 ContentAction action, | 621 ContentAction action, |
| 616 std::string* error_desc); | 622 std::string* error_desc); |
| 617 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 623 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 618 ContentAction action, | 624 ContentAction action, |
| 619 std::string* error_desc); | 625 std::string* error_desc); |
| 620 virtual void ChangeState(); | 626 virtual void ChangeState(); |
| 621 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); | 627 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); |
| 622 | 628 |
| 623 virtual void OnMessage(rtc::Message* pmsg); | 629 virtual void OnMessage(rtc::Message* pmsg); |
| 624 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 630 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 631 std::vector<int>* crypto_suites) const override; |
| 625 virtual void OnConnectionMonitorUpdate( | 632 virtual void OnConnectionMonitorUpdate( |
| 626 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 633 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
| 627 virtual void OnMediaMonitorUpdate( | 634 virtual void OnMediaMonitorUpdate( |
| 628 DataMediaChannel* media_channel, const DataMediaInfo& info); | 635 DataMediaChannel* media_channel, const DataMediaInfo& info); |
| 629 virtual bool ShouldSetupDtlsSrtp() const; | 636 virtual bool ShouldSetupDtlsSrtp() const; |
| 630 void OnDataReceived( | 637 void OnDataReceived( |
| 631 const ReceiveDataParams& params, const char* data, size_t len); | 638 const ReceiveDataParams& params, const char* data, size_t len); |
| 632 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error); | 639 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error); |
| 633 void OnDataChannelReadyToSend(bool writable); | 640 void OnDataChannelReadyToSend(bool writable); |
| 634 void OnStreamClosedRemotely(uint32_t sid); | 641 void OnStreamClosedRemotely(uint32_t sid); |
| 635 | 642 |
| 636 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; | 643 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; |
| 637 // TODO(pthatcher): Make a separate SctpDataChannel and | 644 // TODO(pthatcher): Make a separate SctpDataChannel and |
| 638 // RtpDataChannel instead of using this. | 645 // RtpDataChannel instead of using this. |
| 639 DataChannelType data_channel_type_; | 646 DataChannelType data_channel_type_; |
| 640 bool ready_to_send_data_; | 647 bool ready_to_send_data_; |
| 641 | 648 |
| 642 // Last DataSendParameters sent down to the media_channel() via | 649 // Last DataSendParameters sent down to the media_channel() via |
| 643 // SetSendParameters. | 650 // SetSendParameters. |
| 644 DataSendParameters last_send_params_; | 651 DataSendParameters last_send_params_; |
| 645 // Last DataRecvParameters sent down to the media_channel() via | 652 // Last DataRecvParameters sent down to the media_channel() via |
| 646 // SetRecvParameters. | 653 // SetRecvParameters. |
| 647 DataRecvParameters last_recv_params_; | 654 DataRecvParameters last_recv_params_; |
| 648 }; | 655 }; |
| 649 | 656 |
| 650 } // namespace cricket | 657 } // namespace cricket |
| 651 | 658 |
| 652 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 659 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
| OLD | NEW |