| OLD | NEW |
| 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 |
| 11 #ifndef TALK_SESSION_MEDIA_CHANNEL_H_ | 11 #ifndef WEBRTC_PC_CHANNEL_H_ |
| 12 #define TALK_SESSION_MEDIA_CHANNEL_H_ | 12 #define WEBRTC_PC_CHANNEL_H_ |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <utility> | 17 #include <utility> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "webrtc/audio_sink.h" | 20 #include "webrtc/audio_sink.h" |
| 21 #include "webrtc/base/asyncudpsocket.h" | 21 #include "webrtc/base/asyncudpsocket.h" |
| 22 #include "webrtc/base/criticalsection.h" | 22 #include "webrtc/base/criticalsection.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 bool rtcp); | 432 bool rtcp); |
| 433 ~VideoChannel(); | 433 ~VideoChannel(); |
| 434 bool Init(); | 434 bool Init(); |
| 435 | 435 |
| 436 // downcasts a MediaChannel | 436 // downcasts a MediaChannel |
| 437 virtual VideoMediaChannel* media_channel() const { | 437 virtual VideoMediaChannel* media_channel() const { |
| 438 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); | 438 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool SetSink(uint32_t ssrc, rtc::VideoSinkInterface<VideoFrame>* sink); | 441 bool SetSink(uint32_t ssrc, rtc::VideoSinkInterface<VideoFrame>* sink); |
| 442 | |
| 443 // TODO(pthatcher): Refactor to use a "capture id" instead of an | |
| 444 // ssrc here as the "key". | |
| 445 // Passes ownership of the capturer to the channel. | |
| 446 bool AddScreencast(uint32_t ssrc, VideoCapturer* capturer); | |
| 447 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer); | 442 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer); |
| 448 bool RemoveScreencast(uint32_t ssrc); | |
| 449 // True if we've added a screencast. Doesn't matter if the capturer | |
| 450 // has been started or not. | |
| 451 bool IsScreencasting(); | |
| 452 // Get statistics about the current media session. | 443 // Get statistics about the current media session. |
| 453 bool GetStats(VideoMediaInfo* stats); | 444 bool GetStats(VideoMediaInfo* stats); |
| 454 | 445 |
| 455 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&> | 446 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&> |
| 456 SignalConnectionMonitor; | 447 SignalConnectionMonitor; |
| 457 | 448 |
| 458 void StartMediaMonitor(int cms); | 449 void StartMediaMonitor(int cms); |
| 459 void StopMediaMonitor(); | 450 void StopMediaMonitor(); |
| 460 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; | 451 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; |
| 461 sigslot::signal2<uint32_t, rtc::WindowEvent> SignalScreencastWindowEvent; | |
| 462 | 452 |
| 463 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); | 453 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); |
| 464 | 454 |
| 465 private: | 455 private: |
| 466 typedef std::map<uint32_t, VideoCapturer*> ScreencastMap; | |
| 467 | |
| 468 // overrides from BaseChannel | 456 // overrides from BaseChannel |
| 469 virtual void ChangeState(); | 457 virtual void ChangeState(); |
| 470 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 458 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
| 471 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 459 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 472 ContentAction action, | 460 ContentAction action, |
| 473 std::string* error_desc); | 461 std::string* error_desc); |
| 474 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 462 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 475 ContentAction action, | 463 ContentAction action, |
| 476 std::string* error_desc); | 464 std::string* error_desc); |
| 477 | |
| 478 bool AddScreencast_w(uint32_t ssrc, VideoCapturer* capturer); | |
| 479 bool RemoveScreencast_w(uint32_t ssrc); | |
| 480 void OnScreencastWindowEvent_s(uint32_t ssrc, rtc::WindowEvent we); | |
| 481 bool IsScreencasting_w() const; | |
| 482 bool GetStats_w(VideoMediaInfo* stats); | 465 bool GetStats_w(VideoMediaInfo* stats); |
| 483 | 466 |
| 484 virtual void OnMessage(rtc::Message* pmsg); | 467 virtual void OnMessage(rtc::Message* pmsg); |
| 485 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 468 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; |
| 486 virtual void OnConnectionMonitorUpdate( | 469 virtual void OnConnectionMonitorUpdate( |
| 487 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 470 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
| 488 virtual void OnMediaMonitorUpdate( | 471 virtual void OnMediaMonitorUpdate( |
| 489 VideoMediaChannel* media_channel, const VideoMediaInfo& info); | 472 VideoMediaChannel* media_channel, const VideoMediaInfo& info); |
| 490 virtual void OnScreencastWindowEvent(uint32_t ssrc, rtc::WindowEvent event); | |
| 491 virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev); | |
| 492 bool GetLocalSsrc(const VideoCapturer* capturer, uint32_t* ssrc); | |
| 493 | 473 |
| 494 ScreencastMap screencast_capturers_; | |
| 495 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_; | 474 rtc::scoped_ptr<VideoMediaMonitor> media_monitor_; |
| 496 | 475 |
| 497 rtc::WindowEvent previous_we_; | |
| 498 | |
| 499 // Last VideoSendParameters sent down to the media_channel() via | 476 // Last VideoSendParameters sent down to the media_channel() via |
| 500 // SetSendParameters. | 477 // SetSendParameters. |
| 501 VideoSendParameters last_send_params_; | 478 VideoSendParameters last_send_params_; |
| 502 // Last VideoRecvParameters sent down to the media_channel() via | 479 // Last VideoRecvParameters sent down to the media_channel() via |
| 503 // SetRecvParameters. | 480 // SetRecvParameters. |
| 504 VideoRecvParameters last_recv_params_; | 481 VideoRecvParameters last_recv_params_; |
| 505 }; | 482 }; |
| 506 | 483 |
| 507 // DataChannel is a specialization for data. | 484 // DataChannel is a specialization for data. |
| 508 class DataChannel : public BaseChannel { | 485 class DataChannel : public BaseChannel { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 // Last DataSendParameters sent down to the media_channel() via | 596 // Last DataSendParameters sent down to the media_channel() via |
| 620 // SetSendParameters. | 597 // SetSendParameters. |
| 621 DataSendParameters last_send_params_; | 598 DataSendParameters last_send_params_; |
| 622 // Last DataRecvParameters sent down to the media_channel() via | 599 // Last DataRecvParameters sent down to the media_channel() via |
| 623 // SetRecvParameters. | 600 // SetRecvParameters. |
| 624 DataRecvParameters last_recv_params_; | 601 DataRecvParameters last_recv_params_; |
| 625 }; | 602 }; |
| 626 | 603 |
| 627 } // namespace cricket | 604 } // namespace cricket |
| 628 | 605 |
| 629 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 606 #endif // WEBRTC_PC_CHANNEL_H_ |
| OLD | NEW |