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

Side by Side Diff: talk/session/media/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: Updates after feedback from Peter Created 5 years 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 * 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
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 SetEnableGcmCryptoSuites(bool enable);
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 void set_transport_channel(TransportChannel* transport); 184 void set_transport_channel(TransportChannel* transport);
183 void set_rtcp_transport_channel(TransportChannel* transport); 185 void set_rtcp_transport_channel(TransportChannel* transport);
184 bool was_ever_writable() const { return was_ever_writable_; } 186 bool was_ever_writable() const { return was_ever_writable_; }
185 void set_local_content_direction(MediaContentDirection direction) { 187 void set_local_content_direction(MediaContentDirection direction) {
186 local_content_direction_ = direction; 188 local_content_direction_ = direction;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 bool SetRtcpMux_w(bool enable, 286 bool SetRtcpMux_w(bool enable,
285 ContentAction action, 287 ContentAction action,
286 ContentSource src, 288 ContentSource src,
287 std::string* error_desc); 289 std::string* error_desc);
288 290
289 // From MessageHandler 291 // From MessageHandler
290 void OnMessage(rtc::Message* pmsg) override; 292 void OnMessage(rtc::Message* pmsg) override;
291 293
292 // Handled in derived classes 294 // Handled in derived classes
293 // Get the SRTP crypto suites to use for RTP media 295 // Get the SRTP crypto suites to use for RTP media
294 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; 296 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites,
297 const MediaSessionOptions& options) const = 0;
295 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, 298 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor,
296 const std::vector<ConnectionInfo>& infos) = 0; 299 const std::vector<ConnectionInfo>& infos) = 0;
297 300
298 // Helper function for invoking bool-returning methods on the worker thread. 301 // Helper function for invoking bool-returning methods on the worker thread.
299 template <class FunctorT> 302 template <class FunctorT>
300 bool InvokeOnWorker(const FunctorT& functor) { 303 bool InvokeOnWorker(const FunctorT& functor) {
301 return worker_thread_->Invoke<bool>(functor); 304 return worker_thread_->Invoke<bool>(functor);
302 } 305 }
303 306
304 private: 307 private:
(...skipping 17 matching lines...) Expand all
322 bool enabled_; 325 bool enabled_;
323 bool writable_; 326 bool writable_;
324 bool rtp_ready_to_send_; 327 bool rtp_ready_to_send_;
325 bool rtcp_ready_to_send_; 328 bool rtcp_ready_to_send_;
326 bool was_ever_writable_; 329 bool was_ever_writable_;
327 MediaContentDirection local_content_direction_; 330 MediaContentDirection local_content_direction_;
328 MediaContentDirection remote_content_direction_; 331 MediaContentDirection remote_content_direction_;
329 bool has_received_packet_; 332 bool has_received_packet_;
330 bool dtls_keyed_; 333 bool dtls_keyed_;
331 bool secure_required_; 334 bool secure_required_;
335 bool enable_gcm_crypto_suites_;
332 int rtp_abs_sendtime_extn_id_; 336 int rtp_abs_sendtime_extn_id_;
333 }; 337 };
334 338
335 // VoiceChannel is a specialization that adds support for early media, DTMF, 339 // VoiceChannel is a specialization that adds support for early media, DTMF,
336 // and input/output level monitoring. 340 // and input/output level monitoring.
337 class VoiceChannel : public BaseChannel { 341 class VoiceChannel : public BaseChannel {
338 public: 342 public:
339 VoiceChannel(rtc::Thread* thread, 343 VoiceChannel(rtc::Thread* thread,
340 MediaEngineInterface* media_engine, 344 MediaEngineInterface* media_engine,
341 VoiceMediaChannel* channel, 345 VoiceMediaChannel* channel,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 std::string* error_desc); 412 std::string* error_desc);
409 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 413 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
410 ContentAction action, 414 ContentAction action,
411 std::string* error_desc); 415 std::string* error_desc);
412 void HandleEarlyMediaTimeout(); 416 void HandleEarlyMediaTimeout();
413 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); 417 bool InsertDtmf_w(uint32_t ssrc, int event, int duration);
414 bool SetOutputVolume_w(uint32_t ssrc, double volume); 418 bool SetOutputVolume_w(uint32_t ssrc, double volume);
415 bool GetStats_w(VoiceMediaInfo* stats); 419 bool GetStats_w(VoiceMediaInfo* stats);
416 420
417 virtual void OnMessage(rtc::Message* pmsg); 421 virtual void OnMessage(rtc::Message* pmsg);
418 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 422 void GetSrtpCryptoSuites(std::vector<int>* crypto_suites,
423 const MediaSessionOptions& options) const override;
419 virtual void OnConnectionMonitorUpdate( 424 virtual void OnConnectionMonitorUpdate(
420 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 425 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
421 virtual void OnMediaMonitorUpdate( 426 virtual void OnMediaMonitorUpdate(
422 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); 427 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info);
423 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); 428 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info);
424 429
425 static const int kEarlyMediaTimeout = 1000; 430 static const int kEarlyMediaTimeout = 1000;
426 MediaEngineInterface* media_engine_; 431 MediaEngineInterface* media_engine_;
427 bool received_media_; 432 bool received_media_;
428 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; 433 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void GetScreencastDetails_w(ScreencastDetailsData* d) const; 509 void GetScreencastDetails_w(ScreencastDetailsData* d) const;
505 bool GetStats_w(VideoMediaInfo* stats); 510 bool GetStats_w(VideoMediaInfo* stats);
506 511
507 virtual void OnMessage(rtc::Message* pmsg); 512 virtual void OnMessage(rtc::Message* pmsg);
508 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 513 void GetSrtpCryptoSuites(std::vector<int>* crypto_suites,
514 const MediaSessionOptions& options) const override;
509 virtual void OnConnectionMonitorUpdate( 515 virtual void OnConnectionMonitorUpdate(
510 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 516 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
511 virtual void OnMediaMonitorUpdate( 517 virtual void OnMediaMonitorUpdate(
512 VideoMediaChannel* media_channel, const VideoMediaInfo& info); 518 VideoMediaChannel* media_channel, const VideoMediaInfo& info);
513 virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event); 519 virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event);
514 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); 520 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev);
515 bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc); 521 bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc);
516 522
517 VideoRenderer* renderer_; 523 VideoRenderer* renderer_;
518 ScreencastMap screencast_capturers_; 524 ScreencastMap screencast_capturers_;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 virtual bool SetLocalContent_w(const MediaContentDescription* content, 621 virtual bool SetLocalContent_w(const MediaContentDescription* content,
616 ContentAction action, 622 ContentAction action,
617 std::string* error_desc); 623 std::string* error_desc);
618 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 624 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
619 ContentAction action, 625 ContentAction action,
620 std::string* error_desc); 626 std::string* error_desc);
621 virtual void ChangeState(); 627 virtual void ChangeState();
622 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); 628 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet);
623 629
624 virtual void OnMessage(rtc::Message* pmsg); 630 virtual void OnMessage(rtc::Message* pmsg);
625 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; 631 void GetSrtpCryptoSuites(std::vector<int>* crypto_suites,
632 const MediaSessionOptions& options) const override;
626 virtual void OnConnectionMonitorUpdate( 633 virtual void OnConnectionMonitorUpdate(
627 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 634 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
628 virtual void OnMediaMonitorUpdate( 635 virtual void OnMediaMonitorUpdate(
629 DataMediaChannel* media_channel, const DataMediaInfo& info); 636 DataMediaChannel* media_channel, const DataMediaInfo& info);
630 virtual bool ShouldSetupDtlsSrtp() const; 637 virtual bool ShouldSetupDtlsSrtp() const;
631 void OnDataReceived( 638 void OnDataReceived(
632 const ReceiveDataParams& params, const char* data, size_t len); 639 const ReceiveDataParams& params, const char* data, size_t len);
633 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error); 640 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error);
634 void OnDataChannelReadyToSend(bool writable); 641 void OnDataChannelReadyToSend(bool writable);
635 void OnStreamClosedRemotely(uint32_t sid); 642 void OnStreamClosedRemotely(uint32_t sid);
636 643
637 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; 644 rtc::scoped_ptr<DataMediaMonitor> media_monitor_;
638 // TODO(pthatcher): Make a separate SctpDataChannel and 645 // TODO(pthatcher): Make a separate SctpDataChannel and
639 // RtpDataChannel instead of using this. 646 // RtpDataChannel instead of using this.
640 DataChannelType data_channel_type_; 647 DataChannelType data_channel_type_;
641 bool ready_to_send_data_; 648 bool ready_to_send_data_;
642 649
643 // Last DataSendParameters sent down to the media_channel() via 650 // Last DataSendParameters sent down to the media_channel() via
644 // SetSendParameters. 651 // SetSendParameters.
645 DataSendParameters last_send_params_; 652 DataSendParameters last_send_params_;
646 // Last DataRecvParameters sent down to the media_channel() via 653 // Last DataRecvParameters sent down to the media_channel() via
647 // SetRecvParameters. 654 // SetRecvParameters.
648 DataRecvParameters last_recv_params_; 655 DataRecvParameters last_recv_params_;
649 }; 656 };
650 657
651 } // namespace cricket 658 } // namespace cricket
652 659
653 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ 660 #endif // TALK_SESSION_MEDIA_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698