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

Side by Side Diff: webrtc/call/rtp_stream_receiver_controller.cc

Issue 2886993005: Introduce RtpStreamReceiver and RtpStreamReceiverControllerInterface. (Closed)
Patch Set: Don't pass on packets if the ssrc isn't found in receive_rtp_config_. Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/call/rtp_stream_receiver_controller.h"
12 #include "webrtc/base/ptr_util.h"
13
14 namespace webrtc {
15
16 RtpStreamReceiverController::Receiver::Receiver(
17 RtpStreamReceiverController* controller,
18 uint32_t ssrc,
19 RtpPacketSinkInterface* sink)
20 : controller_(controller), sink_(sink) {
21 controller_->AddSink(ssrc, sink_);
22 }
23
24 RtpStreamReceiverController::Receiver::~Receiver() {
25 // Don't require return value > 0, since for RTX we currently may
26 // have multiple Receiver objects with the same sink.
27 // TODO(nisse): Consider adding a DCHECK when RtxReceiveStream is wired up.
28 controller_->RemoveSink(sink_);
29 }
30
31 std::unique_ptr<RtpStreamReceiver> RtpStreamReceiverController::CreateReceiver(
32 uint32_t ssrc,
33 RtpPacketSinkInterface* sink) {
34 return rtc::MakeUnique<Receiver>(this, ssrc, sink);
35 }
36
37 bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) {
38 rtc::CritScope cs(&lock_);
39 return demuxer_.OnRtpPacket(packet);
40 }
41
42 void RtpStreamReceiverController::AddSink(uint32_t ssrc,
43 RtpPacketSinkInterface* sink) {
44 rtc::CritScope cs(&lock_);
45 return demuxer_.AddSink(ssrc, sink);
46 }
47
48 size_t RtpStreamReceiverController::RemoveSink(
49 const RtpPacketSinkInterface* sink) {
50 rtc::CritScope cs(&lock_);
51 return demuxer_.RemoveSink(sink);
52 }
53
54 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698