Index: webrtc/api/rtpreceiver.h |
diff --git a/webrtc/api/rtpreceiver.h b/webrtc/api/rtpreceiver.h |
index 4b3bd4d4abc431e0412c3b8b2c296e450c0863e6..3b1fd926cbf33ea67f921e40bbb043cb43f790c9 100644 |
--- a/webrtc/api/rtpreceiver.h |
+++ b/webrtc/api/rtpreceiver.h |
@@ -10,21 +10,20 @@ |
// This file contains classes that implement RtpReceiverInterface. |
// An RtpReceiver associates a MediaStreamTrackInterface with an underlying |
-// transport (provided by cricket::VoiceChannel/cricket::VideoChannel) |
+// transport (provided by AudioProviderInterface/VideoProviderInterface) |
#ifndef WEBRTC_API_RTPRECEIVER_H_ |
#define WEBRTC_API_RTPRECEIVER_H_ |
#include <string> |
-#include "webrtc/api/mediastreaminterface.h" |
+#include "webrtc/api/mediastreamprovider.h" |
#include "webrtc/api/rtpreceiverinterface.h" |
#include "webrtc/api/remoteaudiosource.h" |
#include "webrtc/api/videotracksource.h" |
#include "webrtc/base/basictypes.h" |
#include "webrtc/base/sigslot.h" |
#include "webrtc/media/base/videobroadcaster.h" |
-#include "webrtc/pc/channel.h" |
namespace webrtc { |
@@ -42,7 +41,7 @@ |
AudioRtpReceiver(MediaStreamInterface* stream, |
const std::string& track_id, |
uint32_t ssrc, |
- cricket::VoiceChannel* channel); |
+ AudioProviderInterface* provider); |
virtual ~AudioRtpReceiver(); |
@@ -61,8 +60,49 @@ |
return track_.get(); |
} |
- cricket::MediaType media_type() const override { |
- return cricket::MEDIA_TYPE_AUDIO; |
+ std::string id() const override { return id_; } |
+ |
+ RtpParameters GetParameters() const override; |
+ bool SetParameters(const RtpParameters& parameters) override; |
+ |
+ // RtpReceiverInternal implementation. |
+ void Stop() override; |
+ |
+ void SetObserver(RtpReceiverObserverInterface* observer) override; |
+ |
+ cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; } |
+ |
+ private: |
+ void Reconfigure(); |
+ void OnFirstAudioPacketReceived(); |
+ |
+ const std::string id_; |
+ const uint32_t ssrc_; |
+ AudioProviderInterface* provider_; // Set to null in Stop(). |
+ const rtc::scoped_refptr<AudioTrackInterface> track_; |
+ bool cached_track_enabled_; |
+ RtpReceiverObserverInterface* observer_ = nullptr; |
+ bool received_first_packet_ = false; |
+}; |
+ |
+class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
+ public sigslot::has_slots<> { |
+ public: |
+ VideoRtpReceiver(MediaStreamInterface* stream, |
+ const std::string& track_id, |
+ rtc::Thread* worker_thread, |
+ uint32_t ssrc, |
+ VideoProviderInterface* provider); |
+ |
+ virtual ~VideoRtpReceiver(); |
+ |
+ rtc::scoped_refptr<VideoTrackInterface> video_track() const { |
+ return track_.get(); |
+ } |
+ |
+ // RtpReceiverInterface implementation |
+ rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
+ return track_.get(); |
} |
std::string id() const override { return id_; } |
@@ -75,69 +115,14 @@ |
void SetObserver(RtpReceiverObserverInterface* observer) override; |
- // Does not take ownership. |
- // Should call SetChannel(nullptr) before |channel| is destroyed. |
- void SetChannel(cricket::VoiceChannel* channel); |
+ cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_VIDEO; } |
private: |
- void Reconfigure(); |
- void OnFirstPacketReceived(cricket::BaseChannel* channel); |
- |
- const std::string id_; |
- const uint32_t ssrc_; |
- cricket::VoiceChannel* channel_; |
- const rtc::scoped_refptr<AudioTrackInterface> track_; |
- bool cached_track_enabled_; |
- double cached_volume_ = 1; |
- bool stopped_ = false; |
- RtpReceiverObserverInterface* observer_ = nullptr; |
- bool received_first_packet_ = false; |
-}; |
- |
-class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
- public sigslot::has_slots<> { |
- public: |
- VideoRtpReceiver(MediaStreamInterface* stream, |
- const std::string& track_id, |
- rtc::Thread* worker_thread, |
- uint32_t ssrc, |
- cricket::VideoChannel* channel); |
- |
- virtual ~VideoRtpReceiver(); |
- |
- rtc::scoped_refptr<VideoTrackInterface> video_track() const { |
- return track_.get(); |
- } |
- |
- // RtpReceiverInterface implementation |
- rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
- return track_.get(); |
- } |
- |
- cricket::MediaType media_type() const override { |
- return cricket::MEDIA_TYPE_VIDEO; |
- } |
- |
- std::string id() const override { return id_; } |
- |
- RtpParameters GetParameters() const override; |
- bool SetParameters(const RtpParameters& parameters) override; |
- |
- // RtpReceiverInternal implementation. |
- void Stop() override; |
- |
- void SetObserver(RtpReceiverObserverInterface* observer) override; |
- |
- // Does not take ownership. |
- // Should call SetChannel(nullptr) before |channel| is destroyed. |
- void SetChannel(cricket::VideoChannel* channel); |
- |
- private: |
- void OnFirstPacketReceived(cricket::BaseChannel* channel); |
+ void OnFirstVideoPacketReceived(); |
std::string id_; |
uint32_t ssrc_; |
- cricket::VideoChannel* channel_; |
+ VideoProviderInterface* provider_; |
// |broadcaster_| is needed since the decoder can only handle one sink. |
// It might be better if the decoder can handle multiple sinks and consider |
// the VideoSinkWants. |
@@ -146,7 +131,6 @@ |
// the VideoRtpReceiver is stopped. |
rtc::scoped_refptr<VideoTrackSource> source_; |
rtc::scoped_refptr<VideoTrackInterface> track_; |
- bool stopped_ = false; |
RtpReceiverObserverInterface* observer_ = nullptr; |
bool received_first_packet_ = false; |
}; |