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

Side by Side Diff: talk/session/media/channel.h

Issue 1362913004: Remove unused SignalMediaError and infrastructure. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 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
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine_unittest.cc ('k') | talk/session/media/channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 bool RemoveRecvStream(uint32 ssrc); 137 bool RemoveRecvStream(uint32 ssrc);
138 bool AddSendStream(const StreamParams& sp); 138 bool AddSendStream(const StreamParams& sp);
139 bool RemoveSendStream(uint32 ssrc); 139 bool RemoveSendStream(uint32 ssrc);
140 140
141 // Monitoring 141 // Monitoring
142 void StartConnectionMonitor(int cms); 142 void StartConnectionMonitor(int cms);
143 void StopConnectionMonitor(); 143 void StopConnectionMonitor();
144 // For ConnectionStatsGetter, used by ConnectionMonitor 144 // For ConnectionStatsGetter, used by ConnectionMonitor
145 bool GetConnectionStats(ConnectionInfos* infos) override; 145 bool GetConnectionStats(ConnectionInfos* infos) override;
146 146
147 void set_srtp_signal_silent_time(uint32 silent_time) {
148 srtp_filter_.set_signal_silent_time(silent_time);
149 }
150
151 BundleFilter* bundle_filter() { return &bundle_filter_; } 147 BundleFilter* bundle_filter() { return &bundle_filter_; }
152 148
153 const std::vector<StreamParams>& local_streams() const { 149 const std::vector<StreamParams>& local_streams() const {
154 return local_streams_; 150 return local_streams_;
155 } 151 }
156 const std::vector<StreamParams>& remote_streams() const { 152 const std::vector<StreamParams>& remote_streams() const {
157 return remote_streams_; 153 return remote_streams_;
158 } 154 }
159 155
160 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; 156 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure;
161 void SignalDtlsSetupFailure_w(bool rtcp); 157 void SignalDtlsSetupFailure_w(bool rtcp);
162 void SignalDtlsSetupFailure_s(bool rtcp); 158 void SignalDtlsSetupFailure_s(bool rtcp);
163 159
164 // Used for latency measurements. 160 // Used for latency measurements.
165 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; 161 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived;
166 162
167 // Made public for easier testing. 163 // Made public for easier testing.
168 void SetReadyToSend(bool rtcp, bool ready); 164 void SetReadyToSend(bool rtcp, bool ready);
169 165
170 // Only public for unit tests. Otherwise, consider protected. 166 // Only public for unit tests. Otherwise, consider protected.
171 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val); 167 virtual int SetOption(SocketType type, rtc::Socket::Option o, int val);
172 168
169 SrtpFilter* srtp_filter() { return &srtp_filter_; }
170
173 protected: 171 protected:
174 virtual MediaChannel* media_channel() const { return media_channel_; } 172 virtual MediaChannel* media_channel() const { return media_channel_; }
175 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is 173 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is
176 // true). Gets the transport channels from |transport_controller_|. 174 // true). Gets the transport channels from |transport_controller_|.
177 bool SetTransport_w(const std::string& transport_name); 175 bool SetTransport_w(const std::string& transport_name);
178 void set_transport_channel(TransportChannel* transport); 176 void set_transport_channel(TransportChannel* transport);
179 void set_rtcp_transport_channel(TransportChannel* transport); 177 void set_rtcp_transport_channel(TransportChannel* transport);
180 bool was_ever_writable() const { return was_ever_writable_; } 178 bool was_ever_writable() const { return was_ever_writable_; }
181 void set_local_content_direction(MediaContentDirection direction) { 179 void set_local_content_direction(MediaContentDirection direction) {
182 local_content_direction_ = direction; 180 local_content_direction_ = direction;
183 } 181 }
184 void set_remote_content_direction(MediaContentDirection direction) { 182 void set_remote_content_direction(MediaContentDirection direction) {
185 remote_content_direction_ = direction; 183 remote_content_direction_ = direction;
186 } 184 }
187 void set_secure_required(bool secure_required) { 185 void set_secure_required(bool secure_required) {
188 secure_required_ = secure_required; 186 secure_required_ = secure_required;
189 } 187 }
190 bool IsReadyToReceive() const; 188 bool IsReadyToReceive() const;
191 bool IsReadyToSend() const; 189 bool IsReadyToSend() const;
192 rtc::Thread* signaling_thread() { 190 rtc::Thread* signaling_thread() {
193 return transport_controller_->signaling_thread(); 191 return transport_controller_->signaling_thread();
194 } 192 }
195 SrtpFilter* srtp_filter() { return &srtp_filter_; }
196 bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; } 193 bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; }
197 194
198 void ConnectToTransportChannel(TransportChannel* tc); 195 void ConnectToTransportChannel(TransportChannel* tc);
199 void DisconnectFromTransportChannel(TransportChannel* tc); 196 void DisconnectFromTransportChannel(TransportChannel* tc);
200 197
201 void FlushRtcpMessages(); 198 void FlushRtcpMessages();
202 199
203 // NetworkInterface implementation, called by MediaEngine 200 // NetworkInterface implementation, called by MediaEngine
204 virtual bool SendPacket(rtc::Buffer* packet, 201 virtual bool SendPacket(rtc::Buffer* packet,
205 rtc::DiffServCodePoint dscp); 202 rtc::DiffServCodePoint dscp);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 379
383 void StartAudioMonitor(int cms); 380 void StartAudioMonitor(int cms);
384 void StopAudioMonitor(); 381 void StopAudioMonitor();
385 bool IsAudioMonitorRunning() const; 382 bool IsAudioMonitorRunning() const;
386 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor; 383 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor;
387 384
388 int GetInputLevel_w(); 385 int GetInputLevel_w();
389 int GetOutputLevel_w(); 386 int GetOutputLevel_w();
390 void GetActiveStreams_w(AudioInfo::StreamList* actives); 387 void GetActiveStreams_w(AudioInfo::StreamList* actives);
391 388
392 // Signal errors from VoiceMediaChannel. Arguments are:
393 // ssrc(uint32), and error(VoiceMediaChannel::Error).
394 sigslot::signal3<VoiceChannel*, uint32, VoiceMediaChannel::Error>
395 SignalMediaError;
396
397 private: 389 private:
398 // overrides from BaseChannel 390 // overrides from BaseChannel
399 virtual void OnChannelRead(TransportChannel* channel, 391 virtual void OnChannelRead(TransportChannel* channel,
400 const char* data, size_t len, 392 const char* data, size_t len,
401 const rtc::PacketTime& packet_time, 393 const rtc::PacketTime& packet_time,
402 int flags); 394 int flags);
403 virtual void ChangeState(); 395 virtual void ChangeState();
404 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); 396 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc);
405 virtual bool SetLocalContent_w(const MediaContentDescription* content, 397 virtual bool SetLocalContent_w(const MediaContentDescription* content,
406 ContentAction action, 398 ContentAction action,
407 std::string* error_desc); 399 std::string* error_desc);
408 virtual bool SetRemoteContent_w(const MediaContentDescription* content, 400 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
409 ContentAction action, 401 ContentAction action,
410 std::string* error_desc); 402 std::string* error_desc);
411 void HandleEarlyMediaTimeout(); 403 void HandleEarlyMediaTimeout();
412 bool InsertDtmf_w(uint32 ssrc, int event, int duration, int flags); 404 bool InsertDtmf_w(uint32 ssrc, int event, int duration, int flags);
413 bool SetOutputScaling_w(uint32 ssrc, double left, double right); 405 bool SetOutputScaling_w(uint32 ssrc, double left, double right);
414 bool GetStats_w(VoiceMediaInfo* stats); 406 bool GetStats_w(VoiceMediaInfo* stats);
415 407
416 virtual void OnMessage(rtc::Message* pmsg); 408 virtual void OnMessage(rtc::Message* pmsg);
417 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const; 409 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const;
418 virtual void OnConnectionMonitorUpdate( 410 virtual void OnConnectionMonitorUpdate(
419 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 411 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
420 virtual void OnMediaMonitorUpdate( 412 virtual void OnMediaMonitorUpdate(
421 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info); 413 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info);
422 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info); 414 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info);
423 void OnVoiceChannelError(uint32 ssrc, VoiceMediaChannel::Error error);
424 void SendLastMediaError();
425 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error);
426 415
427 static const int kEarlyMediaTimeout = 1000; 416 static const int kEarlyMediaTimeout = 1000;
428 MediaEngineInterface* media_engine_; 417 MediaEngineInterface* media_engine_;
429 bool received_media_; 418 bool received_media_;
430 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_; 419 rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_;
431 rtc::scoped_ptr<AudioMonitor> audio_monitor_; 420 rtc::scoped_ptr<AudioMonitor> audio_monitor_;
432 421
433 // Last AudioSendParameters sent down to the media_channel() via 422 // Last AudioSendParameters sent down to the media_channel() via
434 // SetSendParameters. 423 // SetSendParameters.
435 AudioSendParameters last_send_params_; 424 AudioSendParameters last_send_params_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&> 463 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&>
475 SignalConnectionMonitor; 464 SignalConnectionMonitor;
476 465
477 void StartMediaMonitor(int cms); 466 void StartMediaMonitor(int cms);
478 void StopMediaMonitor(); 467 void StopMediaMonitor();
479 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; 468 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor;
480 sigslot::signal2<uint32, rtc::WindowEvent> SignalScreencastWindowEvent; 469 sigslot::signal2<uint32, rtc::WindowEvent> SignalScreencastWindowEvent;
481 470
482 bool SendIntraFrame(); 471 bool SendIntraFrame();
483 bool RequestIntraFrame(); 472 bool RequestIntraFrame();
484 sigslot::signal3<VideoChannel*, uint32, VideoMediaChannel::Error>
485 SignalMediaError;
486 473
487 // Configure sending media on the stream with SSRC |ssrc| 474 // Configure sending media on the stream with SSRC |ssrc|
488 // If there is only one sending stream SSRC 0 can be used. 475 // If there is only one sending stream SSRC 0 can be used.
489 bool SetVideoSend(uint32 ssrc, bool enable, const VideoOptions* options); 476 bool SetVideoSend(uint32 ssrc, bool enable, const VideoOptions* options);
490 477
491 private: 478 private:
492 typedef std::map<uint32, VideoCapturer*> ScreencastMap; 479 typedef std::map<uint32, VideoCapturer*> ScreencastMap;
493 struct ScreencastDetailsData; 480 struct ScreencastDetailsData;
494 481
495 // overrides from BaseChannel 482 // overrides from BaseChannel
(...skipping 18 matching lines...) Expand all
514 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const; 501 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const;
515 virtual void OnConnectionMonitorUpdate( 502 virtual void OnConnectionMonitorUpdate(
516 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 503 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
517 virtual void OnMediaMonitorUpdate( 504 virtual void OnMediaMonitorUpdate(
518 VideoMediaChannel* media_channel, const VideoMediaInfo& info); 505 VideoMediaChannel* media_channel, const VideoMediaInfo& info);
519 virtual void OnScreencastWindowEvent(uint32 ssrc, 506 virtual void OnScreencastWindowEvent(uint32 ssrc,
520 rtc::WindowEvent event); 507 rtc::WindowEvent event);
521 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); 508 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev);
522 bool GetLocalSsrc(const VideoCapturer* capturer, uint32* ssrc); 509 bool GetLocalSsrc(const VideoCapturer* capturer, uint32* ssrc);
523 510
524 void OnVideoChannelError(uint32 ssrc, VideoMediaChannel::Error error);
525 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error);
526
527 VideoRenderer* renderer_; 511 VideoRenderer* renderer_;
528 ScreencastMap screencast_capturers_; 512 ScreencastMap screencast_capturers_;
529 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_; 513 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_;
530 514
531 rtc::WindowEvent previous_we_; 515 rtc::WindowEvent previous_we_;
532 516
533 // Last VideoSendParameters sent down to the media_channel() via 517 // Last VideoSendParameters sent down to the media_channel() via
534 // SetSendParameters. 518 // SetSendParameters.
535 VideoSendParameters last_send_params_; 519 VideoSendParameters last_send_params_;
536 // Last VideoRecvParameters sent down to the media_channel() via 520 // Last VideoRecvParameters sent down to the media_channel() via
(...skipping 20 matching lines...) Expand all
557 void StopMediaMonitor(); 541 void StopMediaMonitor();
558 542
559 // Should be called on the signaling thread only. 543 // Should be called on the signaling thread only.
560 bool ready_to_send_data() const { 544 bool ready_to_send_data() const {
561 return ready_to_send_data_; 545 return ready_to_send_data_;
562 } 546 }
563 547
564 sigslot::signal2<DataChannel*, const DataMediaInfo&> SignalMediaMonitor; 548 sigslot::signal2<DataChannel*, const DataMediaInfo&> SignalMediaMonitor;
565 sigslot::signal2<DataChannel*, const std::vector<ConnectionInfo>&> 549 sigslot::signal2<DataChannel*, const std::vector<ConnectionInfo>&>
566 SignalConnectionMonitor; 550 SignalConnectionMonitor;
567 sigslot::signal3<DataChannel*, uint32, DataMediaChannel::Error>
568 SignalMediaError;
569 sigslot::signal3<DataChannel*, 551 sigslot::signal3<DataChannel*,
570 const ReceiveDataParams&, 552 const ReceiveDataParams&,
571 const rtc::Buffer&> 553 const rtc::Buffer&>
572 SignalDataReceived; 554 SignalDataReceived;
573 // Signal for notifying when the channel becomes ready to send data. 555 // Signal for notifying when the channel becomes ready to send data.
574 // That occurs when the channel is enabled, the transport is writable, 556 // That occurs when the channel is enabled, the transport is writable,
575 // both local and remote descriptions are set, and the channel is unblocked. 557 // both local and remote descriptions are set, and the channel is unblocked.
576 sigslot::signal1<bool> SignalReadyToSendData; 558 sigslot::signal1<bool> SignalReadyToSendData;
577 // Signal for notifying that the remote side has closed the DataChannel. 559 // Signal for notifying that the remote side has closed the DataChannel.
578 sigslot::signal1<uint32> SignalStreamClosedRemotely; 560 sigslot::signal1<uint32> SignalStreamClosedRemotely;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const; 621 virtual void GetSrtpCryptoSuiteNames(std::vector<std::string>* ciphers) const;
640 virtual void OnConnectionMonitorUpdate( 622 virtual void OnConnectionMonitorUpdate(
641 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); 623 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos);
642 virtual void OnMediaMonitorUpdate( 624 virtual void OnMediaMonitorUpdate(
643 DataMediaChannel* media_channel, const DataMediaInfo& info); 625 DataMediaChannel* media_channel, const DataMediaInfo& info);
644 virtual bool ShouldSetupDtlsSrtp() const; 626 virtual bool ShouldSetupDtlsSrtp() const;
645 void OnDataReceived( 627 void OnDataReceived(
646 const ReceiveDataParams& params, const char* data, size_t len); 628 const ReceiveDataParams& params, const char* data, size_t len);
647 void OnDataChannelError(uint32 ssrc, DataMediaChannel::Error error); 629 void OnDataChannelError(uint32 ssrc, DataMediaChannel::Error error);
648 void OnDataChannelReadyToSend(bool writable); 630 void OnDataChannelReadyToSend(bool writable);
649 void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error);
650 void OnStreamClosedRemotely(uint32 sid); 631 void OnStreamClosedRemotely(uint32 sid);
651 632
652 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; 633 rtc::scoped_ptr<DataMediaMonitor> media_monitor_;
653 // TODO(pthatcher): Make a separate SctpDataChannel and 634 // TODO(pthatcher): Make a separate SctpDataChannel and
654 // RtpDataChannel instead of using this. 635 // RtpDataChannel instead of using this.
655 DataChannelType data_channel_type_; 636 DataChannelType data_channel_type_;
656 bool ready_to_send_data_; 637 bool ready_to_send_data_;
657 638
658 // Last DataSendParameters sent down to the media_channel() via 639 // Last DataSendParameters sent down to the media_channel() via
659 // SetSendParameters. 640 // SetSendParameters.
660 DataSendParameters last_send_params_; 641 DataSendParameters last_send_params_;
661 // Last DataRecvParameters sent down to the media_channel() via 642 // Last DataRecvParameters sent down to the media_channel() via
662 // SetRecvParameters. 643 // SetRecvParameters.
663 DataRecvParameters last_recv_params_; 644 DataRecvParameters last_recv_params_;
664 }; 645 };
665 646
666 } // namespace cricket 647 } // namespace cricket
667 648
668 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ 649 #endif // TALK_SESSION_MEDIA_CHANNEL_H_
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine_unittest.cc ('k') | talk/session/media/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698