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 RtpStreamReceiverController::RtpStreamReceiverController() = default; |
| 32 RtpStreamReceiverController::~RtpStreamReceiverController() = default; |
| 33 |
| 34 std::unique_ptr<RtpStreamReceiverInterface> |
| 35 RtpStreamReceiverController::CreateReceiver( |
| 36 uint32_t ssrc, |
| 37 RtpPacketSinkInterface* sink) { |
| 38 return rtc::MakeUnique<Receiver>(this, ssrc, sink); |
| 39 } |
| 40 |
| 41 bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) { |
| 42 rtc::CritScope cs(&lock_); |
| 43 return demuxer_.OnRtpPacket(packet); |
| 44 } |
| 45 |
| 46 void RtpStreamReceiverController::AddSink(uint32_t ssrc, |
| 47 RtpPacketSinkInterface* sink) { |
| 48 rtc::CritScope cs(&lock_); |
| 49 return demuxer_.AddSink(ssrc, sink); |
| 50 } |
| 51 |
| 52 size_t RtpStreamReceiverController::RemoveSink( |
| 53 const RtpPacketSinkInterface* sink) { |
| 54 rtc::CritScope cs(&lock_); |
| 55 return demuxer_.RemoveSink(sink); |
| 56 } |
| 57 |
| 58 } // namespace webrtc |
OLD | NEW |