Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 // This file contains classes that implement RtpReceiverInterface. | 11 // This file contains classes that implement RtpReceiverInterface. |
| 12 // An RtpReceiver associates a MediaStreamTrackInterface with an underlying | 12 // An RtpReceiver associates a MediaStreamTrackInterface with an underlying |
| 13 // transport (provided by AudioProviderInterface/VideoProviderInterface) | 13 // transport (provided by AudioProviderInterface/VideoProviderInterface) |
| 14 | 14 |
| 15 #ifndef WEBRTC_API_RTPRECEIVER_H_ | 15 #ifndef WEBRTC_API_RTPRECEIVER_H_ |
| 16 #define WEBRTC_API_RTPRECEIVER_H_ | 16 #define WEBRTC_API_RTPRECEIVER_H_ |
| 17 | 17 |
| 18 #include <string> | 18 #include <string> |
| 19 | 19 |
| 20 #include "webrtc/api/mediastreamprovider.h" | 20 #include "webrtc/api/mediastreamprovider.h" |
| 21 #include "webrtc/api/rtpreceiverinterface.h" | 21 #include "webrtc/api/rtpreceiverinterface.h" |
| 22 #include "webrtc/api/videotracksource.h" | |
| 22 #include "webrtc/base/basictypes.h" | 23 #include "webrtc/base/basictypes.h" |
| 24 #include "webrtc/media/base/videobroadcaster.h" | |
| 23 | 25 |
| 24 namespace webrtc { | 26 namespace webrtc { |
| 25 | 27 |
| 26 class AudioRtpReceiver : public ObserverInterface, | 28 class AudioRtpReceiver : public ObserverInterface, |
| 27 public AudioSourceInterface::AudioObserver, | 29 public AudioSourceInterface::AudioObserver, |
| 28 public rtc::RefCountedObject<RtpReceiverInterface> { | 30 public rtc::RefCountedObject<RtpReceiverInterface> { |
| 29 public: | 31 public: |
| 30 AudioRtpReceiver(AudioTrackInterface* track, | 32 AudioRtpReceiver(AudioTrackInterface* track, |
| 31 uint32_t ssrc, | 33 uint32_t ssrc, |
| 32 AudioProviderInterface* provider); | 34 AudioProviderInterface* provider); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 53 | 55 |
| 54 const std::string id_; | 56 const std::string id_; |
| 55 const rtc::scoped_refptr<AudioTrackInterface> track_; | 57 const rtc::scoped_refptr<AudioTrackInterface> track_; |
| 56 const uint32_t ssrc_; | 58 const uint32_t ssrc_; |
| 57 AudioProviderInterface* provider_; // Set to null in Stop(). | 59 AudioProviderInterface* provider_; // Set to null in Stop(). |
| 58 bool cached_track_enabled_; | 60 bool cached_track_enabled_; |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { | 63 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { |
| 62 public: | 64 public: |
| 63 VideoRtpReceiver(VideoTrackInterface* track, | 65 VideoRtpReceiver(const std::string& track_id, |
| 66 rtc::Thread* worker_thread, | |
| 64 uint32_t ssrc, | 67 uint32_t ssrc, |
| 65 VideoProviderInterface* provider); | 68 VideoProviderInterface* provider); |
| 66 | 69 |
| 67 virtual ~VideoRtpReceiver(); | 70 virtual ~VideoRtpReceiver(); |
| 68 | 71 |
| 72 rtc::scoped_refptr<VideoTrackInterface> video_track() const { | |
| 73 return track_.get(); | |
| 74 } | |
| 75 | |
| 69 // RtpReceiverInterface implementation | 76 // RtpReceiverInterface implementation |
| 70 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { | 77 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
| 71 return track_.get(); | 78 return track_.get(); |
| 72 } | 79 } |
| 73 | 80 |
| 74 std::string id() const override { return id_; } | 81 std::string id() const override { return id_; } |
| 75 | 82 |
| 76 void Stop() override; | 83 void Stop() override; |
| 77 | 84 |
| 78 private: | 85 private: |
| 79 std::string id_; | 86 std::string id_; |
| 80 rtc::scoped_refptr<VideoTrackInterface> track_; | |
| 81 uint32_t ssrc_; | 87 uint32_t ssrc_; |
| 82 VideoProviderInterface* provider_; | 88 VideoProviderInterface* provider_; |
| 89 rtc::VideoBroadcaster broadcaster_; | |
|
pthatcher1
2016/03/09 18:16:49
Can you add a comment explaining that this is need
perkj_webrtc
2016/03/09 21:22:59
Done.
| |
| 90 // |source_| is held here to be able to change the state of the source when | |
| 91 // the VideoRtpReceiver is stopped. | |
| 92 rtc::scoped_refptr<VideoTrackSource> source_; | |
| 93 rtc::scoped_refptr<VideoTrackInterface> track_; | |
| 83 }; | 94 }; |
| 84 | 95 |
| 85 } // namespace webrtc | 96 } // namespace webrtc |
| 86 | 97 |
| 87 #endif // WEBRTC_API_RTPRECEIVER_H_ | 98 #endif // WEBRTC_API_RTPRECEIVER_H_ |
| OLD | NEW |