| 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(MediaStreamInterface* stream, |
| 66 const std::string& track_id, |
| 67 rtc::Thread* worker_thread, |
| 64 uint32_t ssrc, | 68 uint32_t ssrc, |
| 65 VideoProviderInterface* provider); | 69 VideoProviderInterface* provider); |
| 66 | 70 |
| 67 virtual ~VideoRtpReceiver(); | 71 virtual ~VideoRtpReceiver(); |
| 68 | 72 |
| 73 rtc::scoped_refptr<VideoTrackInterface> video_track() const { |
| 74 return track_.get(); |
| 75 } |
| 76 |
| 69 // RtpReceiverInterface implementation | 77 // RtpReceiverInterface implementation |
| 70 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { | 78 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
| 71 return track_.get(); | 79 return track_.get(); |
| 72 } | 80 } |
| 73 | 81 |
| 74 std::string id() const override { return id_; } | 82 std::string id() const override { return id_; } |
| 75 | 83 |
| 76 void Stop() override; | 84 void Stop() override; |
| 77 | 85 |
| 78 private: | 86 private: |
| 79 std::string id_; | 87 std::string id_; |
| 80 rtc::scoped_refptr<VideoTrackInterface> track_; | |
| 81 uint32_t ssrc_; | 88 uint32_t ssrc_; |
| 82 VideoProviderInterface* provider_; | 89 VideoProviderInterface* provider_; |
| 90 // |broadcaster_| is needed since the decoder can only handle one sink. |
| 91 // It might be better if the decoder can handle multiple sinks and consider |
| 92 // the VideoSinkWants. |
| 93 rtc::VideoBroadcaster broadcaster_; |
| 94 // |source_| is held here to be able to change the state of the source when |
| 95 // the VideoRtpReceiver is stopped. |
| 96 rtc::scoped_refptr<VideoTrackSource> source_; |
| 97 rtc::scoped_refptr<VideoTrackInterface> track_; |
| 83 }; | 98 }; |
| 84 | 99 |
| 85 } // namespace webrtc | 100 } // namespace webrtc |
| 86 | 101 |
| 87 #endif // WEBRTC_API_RTPRECEIVER_H_ | 102 #endif // WEBRTC_API_RTPRECEIVER_H_ |
| OLD | NEW |