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

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

Issue 2968693002: SSRC and RSID may only refer to one sink each in RtpDemuxer (Closed)
Patch Set: Add expectations to OnlyOneSinkPerSsrcGetsOnRtpPacketTriggered. Created 3 years, 4 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
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/call/rtp_stream_receiver_controller.h" 11 #include "webrtc/call/rtp_stream_receiver_controller.h"
12
13 #include "webrtc/rtc_base/logging.h"
12 #include "webrtc/rtc_base/ptr_util.h" 14 #include "webrtc/rtc_base/ptr_util.h"
13 15
14 namespace webrtc { 16 namespace webrtc {
15 17
16 RtpStreamReceiverController::Receiver::Receiver( 18 RtpStreamReceiverController::Receiver::Receiver(
17 RtpStreamReceiverController* controller, 19 RtpStreamReceiverController* controller,
18 uint32_t ssrc, 20 uint32_t ssrc,
19 RtpPacketSinkInterface* sink) 21 RtpPacketSinkInterface* sink)
20 : controller_(controller), sink_(sink) { 22 : controller_(controller), sink_(sink) {
21 controller_->AddSink(ssrc, sink_); 23 const bool sink_added = controller_->AddSink(ssrc, sink_);
24 if (!sink_added) {
25 LOG(LS_ERROR) << "RtpStreamReceiverController::Receiver::Receiver: Sink "
26 << "could not be added for SSRC=" << ssrc << ".";
27 }
22 } 28 }
23 29
24 RtpStreamReceiverController::Receiver::~Receiver() { 30 RtpStreamReceiverController::Receiver::~Receiver() {
25 // Don't require return value > 0, since for RTX we currently may 31 // Don't require return value > 0, since for RTX we currently may
26 // have multiple Receiver objects with the same sink. 32 // have multiple Receiver objects with the same sink.
27 // TODO(nisse): Consider adding a DCHECK when RtxReceiveStream is wired up. 33 // TODO(nisse): Consider adding a DCHECK when RtxReceiveStream is wired up.
28 controller_->RemoveSink(sink_); 34 controller_->RemoveSink(sink_);
29 } 35 }
30 36
31 RtpStreamReceiverController::RtpStreamReceiverController() = default; 37 RtpStreamReceiverController::RtpStreamReceiverController() = default;
32 RtpStreamReceiverController::~RtpStreamReceiverController() = default; 38 RtpStreamReceiverController::~RtpStreamReceiverController() = default;
33 39
34 std::unique_ptr<RtpStreamReceiverInterface> 40 std::unique_ptr<RtpStreamReceiverInterface>
35 RtpStreamReceiverController::CreateReceiver( 41 RtpStreamReceiverController::CreateReceiver(
36 uint32_t ssrc, 42 uint32_t ssrc,
37 RtpPacketSinkInterface* sink) { 43 RtpPacketSinkInterface* sink) {
38 return rtc::MakeUnique<Receiver>(this, ssrc, sink); 44 return rtc::MakeUnique<Receiver>(this, ssrc, sink);
39 } 45 }
40 46
41 bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) { 47 bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) {
42 rtc::CritScope cs(&lock_); 48 rtc::CritScope cs(&lock_);
43 return demuxer_.OnRtpPacket(packet); 49 return demuxer_.OnRtpPacket(packet);
44 } 50 }
45 51
46 void RtpStreamReceiverController::AddSink(uint32_t ssrc, 52 bool RtpStreamReceiverController::AddSink(uint32_t ssrc,
47 RtpPacketSinkInterface* sink) { 53 RtpPacketSinkInterface* sink) {
48 rtc::CritScope cs(&lock_); 54 rtc::CritScope cs(&lock_);
49 return demuxer_.AddSink(ssrc, sink); 55 return demuxer_.AddSink(ssrc, sink);
50 } 56 }
51 57
52 size_t RtpStreamReceiverController::RemoveSink( 58 size_t RtpStreamReceiverController::RemoveSink(
53 const RtpPacketSinkInterface* sink) { 59 const RtpPacketSinkInterface* sink) {
54 rtc::CritScope cs(&lock_); 60 rtc::CritScope cs(&lock_);
55 return demuxer_.RemoveSink(sink); 61 return demuxer_.RemoveSink(sink);
56 } 62 }
57 63
58 } // namespace webrtc 64 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/rtp_stream_receiver_controller.h ('k') | webrtc/call/rtp_stream_receiver_controller_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698