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

Unified Diff: webrtc/call/rtp_transport_controller_receive.cc

Issue 2886993005: Introduce RtpStreamReceiver and RtpStreamReceiverControllerInterface. (Closed)
Patch Set: Fix FlexFEC. Created 3 years, 7 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
Index: webrtc/call/rtp_transport_controller_receive.cc
diff --git a/webrtc/call/rtp_transport_controller_receive.cc b/webrtc/call/rtp_transport_controller_receive.cc
new file mode 100644
index 0000000000000000000000000000000000000000..377ea008c8a13fe475ff712c1b57baddaa2c571c
--- /dev/null
+++ b/webrtc/call/rtp_transport_controller_receive.cc
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/call/rtp_transport_controller_receive.h"
+#include "webrtc/base/ptr_util.h"
+
+namespace webrtc {
+
+RtpTransportControllerReceive::Receiver::Receiver(
+ RtpTransportControllerReceive* transport,
+ uint32_t ssrc,
+ RtpPacketSinkInterface* sink)
+ : transport_(transport), sink_(sink) {
+ transport_->AddSink(ssrc, sink_);
+}
+
+RtpTransportControllerReceive::Receiver::~Receiver() {
+ // Don't require return value > 0, since for RTX we currently may
+ // have multiple Receiver objects with the same sink.
+ // TODO(nisse): Consider adding a DCHECK when RtxReceiveStream is wired up.
+ transport_->RemoveSink(sink_);
+}
+
+std::unique_ptr<RtpTransportReceiver>
+RtpTransportControllerReceive::CreateReceiver(uint32_t ssrc,
+ RtpPacketSinkInterface* sink) {
+ return rtc::MakeUnique<Receiver>(this, ssrc, sink);
+}
+
+bool RtpTransportControllerReceive::OnRtpPacket(
+ const RtpPacketReceived& packet) {
+ rtc::CritScope cs(&lock_);
+ return demuxer_.OnRtpPacket(packet);
+}
+
+void RtpTransportControllerReceive::AddSink(uint32_t ssrc,
+ RtpPacketSinkInterface* sink) {
+ rtc::CritScope cs(&lock_);
+ return demuxer_.AddSink(ssrc, sink);
+}
+
+size_t RtpTransportControllerReceive::RemoveSink(
+ const RtpPacketSinkInterface* sink) {
+ rtc::CritScope cs(&lock_);
+ return demuxer_.RemoveSink(sink);
+}
+
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698