Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: webrtc/pc/channel.h

Issue 1528843005: Add support for GCM cipher suites from RFC 7714. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix failing SRTP-but-no-DTLS tests. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // Made public for easier testing. 152 // Made public for easier testing.
153 void SetReadyToSend(bool rtcp, bool ready); 153 void SetReadyToSend(bool rtcp, bool ready);
154 154
155 // Only public for unit tests. Otherwise, consider protected. 155 // Only public for unit tests. Otherwise, consider protected.
156 int SetOption(SocketType type, rtc::Socket::Option o, int val) 156 int SetOption(SocketType type, rtc::Socket::Option o, int val)
157 override; 157 override;
158 158
159 SrtpFilter* srtp_filter() { return &srtp_filter_; } 159 SrtpFilter* srtp_filter() { return &srtp_filter_; }
160 160
161 bool SetCryptoOptions(const rtc::CryptoOptions& crypto_options);
162
161 protected: 163 protected:
162 virtual MediaChannel* media_channel() const { return media_channel_; } 164 virtual MediaChannel* media_channel() const { return media_channel_; }
163 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is 165 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is
164 // true). Gets the transport channels from |transport_controller_|. 166 // true). Gets the transport channels from |transport_controller_|.
165 bool SetTransport_w(const std::string& transport_name); 167 bool SetTransport_w(const std::string& transport_name);
166 168
167 void set_transport_channel(TransportChannel* transport); 169 void set_transport_channel(TransportChannel* transport);
168 void set_rtcp_transport_channel(TransportChannel* transport, 170 void set_rtcp_transport_channel(TransportChannel* transport,
169 bool update_writablity); 171 bool update_writablity);
170 172
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 bool SetRtcpMux_w(bool enable, 278 bool SetRtcpMux_w(bool enable,
277 ContentAction action, 279 ContentAction action,
278 ContentSource src, 280 ContentSource src,
279 std::string* error_desc); 281 std::string* error_desc);
280 282
281 // From MessageHandler 283 // From MessageHandler
282 void OnMessage(rtc::Message* pmsg) override; 284 void OnMessage(rtc::Message* pmsg) override;
283 285
284 // Handled in derived classes 286 // Handled in derived classes
285 // Get the SRTP crypto suites to use for RTP media 287 // Get the SRTP crypto suites to use for RTP media
286 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; 288 virtual void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options,
289 std::vector<int>* crypto_suites) const = 0;
287 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, 290 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor,
288 const std::vector<ConnectionInfo>& infos) = 0; 291 const std::vector<ConnectionInfo>& infos) = 0;
289 292
290 // Helper function for invoking bool-returning methods on the worker thread. 293 // Helper function for invoking bool-returning methods on the worker thread.
291 template <class FunctorT> 294 template <class FunctorT>
292 bool InvokeOnWorker(const FunctorT& functor) { 295 bool InvokeOnWorker(const FunctorT& functor) {
293 return worker_thread_->Invoke<bool>(functor); 296 return worker_thread_->Invoke<bool>(functor);
294 } 297 }
295 298
296 private: 299 private:
(...skipping 17 matching lines...) Expand all
314 bool enabled_; 317 bool enabled_;
315 bool writable_; 318 bool writable_;
316 bool rtp_ready_to_send_; 319 bool rtp_ready_to_send_;
317 bool rtcp_ready_to_send_; 320 bool rtcp_ready_to_send_;
318 bool was_ever_writable_; 321 bool was_ever_writable_;
319 MediaContentDirection local_content_direction_; 322 MediaContentDirection local_content_direction_;
320 MediaContentDirection remote_content_direction_; 323 MediaContentDirection remote_content_direction_;
321 bool has_received_packet_; 324 bool has_received_packet_;
322 bool dtls_keyed_; 325 bool dtls_keyed_;
323 bool secure_required_; 326 bool secure_required_;
327 rtc::CryptoOptions crypto_options_;
mattdr 2016/05/06 22:34:13 Should we make this available as a public or prote
joachim 2016/05/09 23:21:40 Done.
324 int rtp_abs_sendtime_extn_id_; 328 int rtp_abs_sendtime_extn_id_;
325 }; 329 };
326 330
327 // VoiceChannel is a specialization that adds support for early media, DTMF, 331 // VoiceChannel is a specialization that adds support for early media, DTMF,
328 // and input/output level monitoring. 332 // and input/output level monitoring.
329 class VoiceChannel : public BaseChannel { 333 class VoiceChannel : public BaseChannel {
330 public: 334 public:
331 VoiceChannel(rtc::Thread* thread, 335 VoiceChannel(rtc::Thread* thread,
332 MediaEngineInterface* media_engine, 336 MediaEngineInterface* media_engine,
333 VoiceMediaChannel* channel, 337 VoiceMediaChannel* channel,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 std::string* error_desc); 408 std::string* error_desc);
405 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 409 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
406 ContentAction action, 410 ContentAction action,
407 std::string* error_desc); 411 std::string* error_desc);
408 void HandleEarlyMediaTimeout(); 412 void HandleEarlyMediaTimeout();
409 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); 413 bool InsertDtmf_w(uint32_t ssrc, int event, int duration);
410 bool SetOutputVolume_w(uint32_t ssrc, double volume); 414 bool SetOutputVolume_w(uint32_t ssrc, double volume);
411 bool GetStats_w(VoiceMediaInfo* stats); 415 bool GetStats_w(VoiceMediaInfo* stats);
412 416
413 virtual void OnMessage(rtc::Message* pmsg); 417 virtual void OnMessage(rtc::Message* pmsg);
414 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 418 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options,
419 std::vector<int>* crypto_suites) const override;
415 virtual void OnConnectionMonitorUpdate( 420 virtual void OnConnectionMonitorUpdate(
416 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 421 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
417 virtual void OnMediaMonitorUpdate( 422 virtual void OnMediaMonitorUpdate(
418 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); 423 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info);
419 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); 424 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info);
420 425
421 static const int kEarlyMediaTimeout = 1000; 426 static const int kEarlyMediaTimeout = 1000;
422 MediaEngineInterface* media_engine_; 427 MediaEngineInterface* media_engine_;
423 bool received_media_; 428 bool received_media_;
424 std::unique_ptr<VoiceMediaMonitor> media_monitor_; 429 std::unique_ptr<VoiceMediaMonitor> media_monitor_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 ContentAction action, 480 ContentAction action,
476 std::string* error_desc); 481 std::string* error_desc);
477 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 482 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
478 ContentAction action, 483 ContentAction action,
479 std::string* error_desc); 484 std::string* error_desc);
480 bool GetStats_w(VideoMediaInfo* stats); 485 bool GetStats_w(VideoMediaInfo* stats);
481 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; 486 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const;
482 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); 487 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters);
483 488
484 virtual void OnMessage(rtc::Message* pmsg); 489 virtual void OnMessage(rtc::Message* pmsg);
485 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 490 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options,
491 std::vector<int>* crypto_suites) const override;
486 virtual void OnConnectionMonitorUpdate( 492 virtual void OnConnectionMonitorUpdate(
487 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 493 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
488 virtual void OnMediaMonitorUpdate( 494 virtual void OnMediaMonitorUpdate(
489 VideoMediaChannel* media_channel, const VideoMediaInfo& info); 495 VideoMediaChannel* media_channel, const VideoMediaInfo& info);
490 496
491 std::unique_ptr<VideoMediaMonitor> media_monitor_; 497 std::unique_ptr<VideoMediaMonitor> media_monitor_;
492 498
493 // Last VideoSendParameters sent down to the media_channel() via 499 // Last VideoSendParameters sent down to the media_channel() via
494 // SetSendParameters. 500 // SetSendParameters.
495 VideoSendParameters last_send_params_; 501 VideoSendParameters last_send_params_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 virtual bool SetLocalContent_w(const MediaContentDescription* content, 591 virtual bool SetLocalContent_w(const MediaContentDescription* content,
586 ContentAction action, 592 ContentAction action,
587 std::string* error_desc); 593 std::string* error_desc);
588 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 594 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
589 ContentAction action, 595 ContentAction action,
590 std::string* error_desc); 596 std::string* error_desc);
591 virtual void ChangeState(); 597 virtual void ChangeState();
592 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); 598 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet);
593 599
594 virtual void OnMessage(rtc::Message* pmsg); 600 virtual void OnMessage(rtc::Message* pmsg);
595 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 601 void GetSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options,
602 std::vector<int>* crypto_suites) const override;
596 virtual void OnConnectionMonitorUpdate( 603 virtual void OnConnectionMonitorUpdate(
597 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 604 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
598 virtual void OnMediaMonitorUpdate( 605 virtual void OnMediaMonitorUpdate(
599 DataMediaChannel* media_channel, const DataMediaInfo& info); 606 DataMediaChannel* media_channel, const DataMediaInfo& info);
600 virtual bool ShouldSetupDtlsSrtp() const; 607 virtual bool ShouldSetupDtlsSrtp() const;
601 void OnDataReceived( 608 void OnDataReceived(
602 const ReceiveDataParams& params, const char* data, size_t len); 609 const ReceiveDataParams& params, const char* data, size_t len);
603 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error); 610 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error);
604 void OnDataChannelReadyToSend(bool writable); 611 void OnDataChannelReadyToSend(bool writable);
605 void OnStreamClosedRemotely(uint32_t sid); 612 void OnStreamClosedRemotely(uint32_t sid);
606 613
607 std::unique_ptr<DataMediaMonitor> media_monitor_; 614 std::unique_ptr<DataMediaMonitor> media_monitor_;
608 // TODO(pthatcher): Make a separate SctpDataChannel and 615 // TODO(pthatcher): Make a separate SctpDataChannel and
609 // RtpDataChannel instead of using this. 616 // RtpDataChannel instead of using this.
610 DataChannelType data_channel_type_; 617 DataChannelType data_channel_type_;
611 bool ready_to_send_data_; 618 bool ready_to_send_data_;
612 619
613 // Last DataSendParameters sent down to the media_channel() via 620 // Last DataSendParameters sent down to the media_channel() via
614 // SetSendParameters. 621 // SetSendParameters.
615 DataSendParameters last_send_params_; 622 DataSendParameters last_send_params_;
616 // Last DataRecvParameters sent down to the media_channel() via 623 // Last DataRecvParameters sent down to the media_channel() via
617 // SetRecvParameters. 624 // SetRecvParameters.
618 DataRecvParameters last_recv_params_; 625 DataRecvParameters last_recv_params_;
619 }; 626 };
620 627
621 } // namespace cricket 628 } // namespace cricket
622 629
623 #endif // WEBRTC_PC_CHANNEL_H_ 630 #endif // WEBRTC_PC_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698