OLD | NEW |
---|---|
(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<RtpStreamReceiverInterface> | |
32 RtpStreamReceiverController::CreateReceiver( | |
33 uint32_t ssrc, | |
34 RtpPacketSinkInterface* sink) { | |
35 return rtc::MakeUnique<Receiver>(this, ssrc, sink); | |
36 } | |
37 | |
38 bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) { | |
the sun
2017/06/16 13:37:39
Please add thread checkers so we can lock down usa
nisse-webrtc
2017/06/16 14:33:25
I'll try to sort it out. But I kind-of expect that
the sun
2017/06/16 15:00:13
Yes, we just want to document that.
nisse-webrtc
2017/06/20 09:04:35
Added thread checkers, and it seems to pass tests.
| |
39 rtc::CritScope cs(&lock_); | |
40 return demuxer_.OnRtpPacket(packet); | |
41 } | |
42 | |
43 void RtpStreamReceiverController::AddSink(uint32_t ssrc, | |
44 RtpPacketSinkInterface* sink) { | |
45 rtc::CritScope cs(&lock_); | |
46 return demuxer_.AddSink(ssrc, sink); | |
47 } | |
48 | |
49 size_t RtpStreamReceiverController::RemoveSink( | |
50 const RtpPacketSinkInterface* sink) { | |
51 rtc::CritScope cs(&lock_); | |
52 return demuxer_.RemoveSink(sink); | |
53 } | |
54 | |
55 } // namespace webrtc | |
OLD | NEW |