Index: webrtc/api/rtpreceiver.h |
diff --git a/webrtc/api/rtpreceiver.h b/webrtc/api/rtpreceiver.h |
index 3b1fd926cbf33ea67f921e40bbb043cb43f790c9..4b3bd4d4abc431e0412c3b8b2c296e450c0863e6 100644 |
--- a/webrtc/api/rtpreceiver.h |
+++ b/webrtc/api/rtpreceiver.h |
@@ -10,20 +10,21 @@ |
// This file contains classes that implement RtpReceiverInterface. |
// An RtpReceiver associates a MediaStreamTrackInterface with an underlying |
-// transport (provided by AudioProviderInterface/VideoProviderInterface) |
+// transport (provided by cricket::VoiceChannel/cricket::VideoChannel) |
#ifndef WEBRTC_API_RTPRECEIVER_H_ |
#define WEBRTC_API_RTPRECEIVER_H_ |
#include <string> |
-#include "webrtc/api/mediastreamprovider.h" |
+#include "webrtc/api/mediastreaminterface.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 { |
@@ -41,7 +42,7 @@ class AudioRtpReceiver : public ObserverInterface, |
AudioRtpReceiver(MediaStreamInterface* stream, |
const std::string& track_id, |
uint32_t ssrc, |
- AudioProviderInterface* provider); |
+ cricket::VoiceChannel* channel); |
virtual ~AudioRtpReceiver(); |
@@ -60,6 +61,10 @@ class AudioRtpReceiver : public ObserverInterface, |
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; |
@@ -70,17 +75,21 @@ class AudioRtpReceiver : public ObserverInterface, |
void SetObserver(RtpReceiverObserverInterface* observer) override; |
- cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; } |
+ // Does not take ownership. |
+ // Should call SetChannel(nullptr) before |channel| is destroyed. |
+ void SetChannel(cricket::VoiceChannel* channel); |
private: |
void Reconfigure(); |
- void OnFirstAudioPacketReceived(); |
+ void OnFirstPacketReceived(cricket::BaseChannel* channel); |
const std::string id_; |
const uint32_t ssrc_; |
- AudioProviderInterface* provider_; // Set to null in Stop(). |
+ 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; |
}; |
@@ -92,7 +101,7 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
const std::string& track_id, |
rtc::Thread* worker_thread, |
uint32_t ssrc, |
- VideoProviderInterface* provider); |
+ cricket::VideoChannel* channel); |
virtual ~VideoRtpReceiver(); |
@@ -105,6 +114,10 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
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; |
@@ -115,14 +128,16 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
void SetObserver(RtpReceiverObserverInterface* observer) override; |
- cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_VIDEO; } |
+ // Does not take ownership. |
+ // Should call SetChannel(nullptr) before |channel| is destroyed. |
+ void SetChannel(cricket::VideoChannel* channel); |
private: |
- void OnFirstVideoPacketReceived(); |
+ void OnFirstPacketReceived(cricket::BaseChannel* channel); |
std::string id_; |
uint32_t ssrc_; |
- VideoProviderInterface* provider_; |
+ cricket::VideoChannel* channel_; |
// |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. |
@@ -131,6 +146,7 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, |
// 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; |
}; |