| 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   const rtc::scoped_refptr<AudioTrackInterface> track_; | 
| 60   bool cached_track_enabled_; | 66   bool cached_track_enabled_; | 
| 61 }; | 67 }; | 
| 62 | 68 | 
| 63 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { | 69 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { | 
| 64  public: | 70  public: | 
| 65   VideoRtpReceiver(MediaStreamInterface* stream, | 71   VideoRtpReceiver(MediaStreamInterface* stream, | 
| 66                    const std::string& track_id, | 72                    const std::string& track_id, | 
| 67                    rtc::Thread* worker_thread, | 73                    rtc::Thread* worker_thread, | 
| 68                    uint32_t ssrc, | 74                    uint32_t ssrc, | 
| 69                    VideoProviderInterface* provider); | 75                    VideoProviderInterface* provider); | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 93   rtc::VideoBroadcaster broadcaster_; | 99   rtc::VideoBroadcaster broadcaster_; | 
| 94   // |source_| is held here to be able to change the state of the source when | 100   // |source_| is held here to be able to change the state of the source when | 
| 95   // the VideoRtpReceiver is stopped. | 101   // the VideoRtpReceiver is stopped. | 
| 96   rtc::scoped_refptr<VideoTrackSource> source_; | 102   rtc::scoped_refptr<VideoTrackSource> source_; | 
| 97   rtc::scoped_refptr<VideoTrackInterface> track_; | 103   rtc::scoped_refptr<VideoTrackInterface> track_; | 
| 98 }; | 104 }; | 
| 99 | 105 | 
| 100 }  // namespace webrtc | 106 }  // namespace webrtc | 
| 101 | 107 | 
| 102 #endif  // WEBRTC_API_RTPRECEIVER_H_ | 108 #endif  // WEBRTC_API_RTPRECEIVER_H_ | 
| OLD | NEW | 
|---|