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/remoteaudiosource.h" | |
| 22 #include "webrtc/api/videotracksource.h" | 23 #include "webrtc/api/videotracksource.h" |
| 23 #include "webrtc/base/basictypes.h" | 24 #include "webrtc/base/basictypes.h" |
| 24 #include "webrtc/media/base/videobroadcaster.h" | 25 #include "webrtc/media/base/videobroadcaster.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 | 28 |
| 28 class AudioRtpReceiver : public ObserverInterface, | 29 class AudioRtpReceiver : public ObserverInterface, |
| 29 public AudioSourceInterface::AudioObserver, | 30 public AudioSourceInterface::AudioObserver, |
| 30 public rtc::RefCountedObject<RtpReceiverInterface> { | 31 public rtc::RefCountedObject<RtpReceiverInterface> { |
| 31 public: | 32 public: |
| 32 AudioRtpReceiver(AudioTrackInterface* track, | 33 AudioRtpReceiver(MediaStreamInterface* stream, |
| 34 const std::string& track_id, | |
| 33 uint32_t ssrc, | 35 uint32_t ssrc, |
| 34 AudioProviderInterface* provider); | 36 AudioProviderInterface* provider); |
| 35 | 37 |
| 36 virtual ~AudioRtpReceiver(); | 38 virtual ~AudioRtpReceiver(); |
| 37 | 39 |
| 38 // ObserverInterface implementation | 40 // ObserverInterface implementation |
| 39 void OnChanged() override; | 41 void OnChanged() override; |
| 40 | 42 |
| 41 // AudioSourceInterface::AudioObserver implementation | 43 // AudioSourceInterface::AudioObserver implementation |
| 42 void OnSetVolume(double volume) override; | 44 void OnSetVolume(double volume) override; |
| 43 | 45 |
| 46 rtc::scoped_refptr<AudioTrackInterface> audio_track() const { | |
| 47 return track_.get(); | |
| 48 } | |
| 49 | |
| 44 // RtpReceiverInterface implementation | 50 // RtpReceiverInterface implementation |
| 45 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { | 51 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
| 46 return track_.get(); | 52 return track_.get(); |
| 47 } | 53 } |
| 48 | 54 |
| 49 std::string id() const override { return id_; } | 55 std::string id() const override { return id_; } |
| 50 | 56 |
| 51 void Stop() override; | 57 void Stop() override; |
| 52 | 58 |
| 53 private: | 59 private: |
| 54 void Reconfigure(); | 60 void Reconfigure(); |
| 55 | 61 |
| 56 const std::string id_; | 62 const std::string id_; |
| 57 const rtc::scoped_refptr<AudioTrackInterface> track_; | |
| 58 const uint32_t ssrc_; | 63 const uint32_t ssrc_; |
| 59 AudioProviderInterface* provider_; // Set to null in Stop(). | 64 AudioProviderInterface* provider_; // Set to null in Stop(). |
| 65 // |source_| is held here to be able to change the state of the source when | |
| 66 // the VideoRtpReceiver is stopped. | |
|
Taylor Brandstetter
2016/03/21 18:49:54
Is this comment still valid? Also, change "Video"
perkj_webrtc
2016/03/22 16:59:54
actually no.
| |
| 67 rtc::scoped_refptr<RemoteAudioSource> source_; | |
| 68 const rtc::scoped_refptr<AudioTrackInterface> track_; | |
| 60 bool cached_track_enabled_; | 69 bool cached_track_enabled_; |
| 61 }; | 70 }; |
| 62 | 71 |
| 63 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { | 72 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { |
| 64 public: | 73 public: |
| 65 VideoRtpReceiver(MediaStreamInterface* stream, | 74 VideoRtpReceiver(MediaStreamInterface* stream, |
| 66 const std::string& track_id, | 75 const std::string& track_id, |
| 67 rtc::Thread* worker_thread, | 76 rtc::Thread* worker_thread, |
| 68 uint32_t ssrc, | 77 uint32_t ssrc, |
| 69 VideoProviderInterface* provider); | 78 VideoProviderInterface* provider); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 93 rtc::VideoBroadcaster broadcaster_; | 102 rtc::VideoBroadcaster broadcaster_; |
| 94 // |source_| is held here to be able to change the state of the source when | 103 // |source_| is held here to be able to change the state of the source when |
| 95 // the VideoRtpReceiver is stopped. | 104 // the VideoRtpReceiver is stopped. |
| 96 rtc::scoped_refptr<VideoTrackSource> source_; | 105 rtc::scoped_refptr<VideoTrackSource> source_; |
| 97 rtc::scoped_refptr<VideoTrackInterface> track_; | 106 rtc::scoped_refptr<VideoTrackInterface> track_; |
| 98 }; | 107 }; |
| 99 | 108 |
| 100 } // namespace webrtc | 109 } // namespace webrtc |
| 101 | 110 |
| 102 #endif // WEBRTC_API_RTPRECEIVER_H_ | 111 #endif // WEBRTC_API_RTPRECEIVER_H_ |
| OLD | NEW |