Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: webrtc/api/rtpreceiver.cc

Issue 1999853002: Forward the SignalFirstPacketReceived to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Modified the unit test. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/rtpreceiver.h ('k') | webrtc/api/rtpreceiverinterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/rtpreceiver.cc
diff --git a/webrtc/api/rtpreceiver.cc b/webrtc/api/rtpreceiver.cc
index 9df336e1f042ca79afb2814905af52c2840a7753..882bc2be8d4b46e6daf1575af5c34d7d3d9fb650 100644
--- a/webrtc/api/rtpreceiver.cc
+++ b/webrtc/api/rtpreceiver.cc
@@ -35,6 +35,8 @@ AudioRtpReceiver::AudioRtpReceiver(MediaStreamInterface* stream,
track_->GetSource()->RegisterAudioObserver(this);
Reconfigure();
stream->AddTrack(track_);
+ provider_->SignalFirstAudioPacketReceived.connect(
+ this, &AudioRtpReceiver::OnFirstAudioPacketReceived);
}
AudioRtpReceiver::~AudioRtpReceiver() {
@@ -83,6 +85,22 @@ void AudioRtpReceiver::Reconfigure() {
provider_->SetAudioPlayout(ssrc_, track_->enabled());
}
+void AudioRtpReceiver::SetObserver(RtpReceiverObserverInterface* observer) {
+ observer_ = observer;
+ // If received the first packet before setting the observer, call the
+ // observer.
+ if (received_first_packet_) {
+ observer_->OnFirstPacketReceived(media_type());
+ }
+}
+
+void AudioRtpReceiver::OnFirstAudioPacketReceived() {
+ if (observer_) {
+ observer_->OnFirstPacketReceived(media_type());
+ }
+ received_first_packet_ = true;
+}
+
VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream,
const std::string& track_id,
rtc::Thread* worker_thread,
@@ -104,6 +122,8 @@ VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream,
source_->SetState(MediaSourceInterface::kLive);
provider_->SetVideoPlayout(ssrc_, true, &broadcaster_);
stream->AddTrack(track_);
+ provider_->SignalFirstVideoPacketReceived.connect(
+ this, &VideoRtpReceiver::OnFirstVideoPacketReceived);
}
VideoRtpReceiver::~VideoRtpReceiver() {
@@ -132,4 +152,20 @@ void VideoRtpReceiver::Stop() {
provider_ = nullptr;
}
+void VideoRtpReceiver::SetObserver(RtpReceiverObserverInterface* observer) {
+ observer_ = observer;
+ // If received the first packet before setting the observer, call the
+ // observer.
+ if (received_first_packet_) {
+ observer_->OnFirstPacketReceived(media_type());
+ }
+}
+
+void VideoRtpReceiver::OnFirstVideoPacketReceived() {
+ if (observer_) {
+ observer_->OnFirstPacketReceived(media_type());
+ }
+ received_first_packet_ = true;
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/api/rtpreceiver.h ('k') | webrtc/api/rtpreceiverinterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698