brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | #ifndef WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_ |
| 12 | #define WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_ |
| 13 | |
| 14 | #include <memory> |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 15 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 16 | #include "webrtc/base/criticalsection.h" |
| 17 | #include "webrtc/call/flexfec_receive_stream.h" |
nisse | e4bcd6d | 2017-05-16 04:47:04 -0700 | [diff] [blame] | 18 | #include "webrtc/call/rtp_demuxer.h" |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | |
brandtr | fa5a368 | 2017-01-17 01:33:54 -0800 | [diff] [blame] | 22 | class FlexfecReceiver; |
| 23 | class ProcessThread; |
| 24 | class ReceiveStatistics; |
| 25 | class RecoveredPacketReceiver; |
| 26 | class RtcpRttStats; |
| 27 | class RtpPacketReceived; |
| 28 | class RtpRtcp; |
| 29 | |
nisse | e4bcd6d | 2017-05-16 04:47:04 -0700 | [diff] [blame] | 30 | class FlexfecReceiveStreamImpl : public FlexfecReceiveStream, |
| 31 | public RtpPacketSinkInterface { |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 32 | public: |
| 33 | FlexfecReceiveStreamImpl(const Config& config, |
brandtr | fa5a368 | 2017-01-17 01:33:54 -0800 | [diff] [blame] | 34 | RecoveredPacketReceiver* recovered_packet_receiver, |
| 35 | RtcpRttStats* rtt_stats, |
| 36 | ProcessThread* process_thread); |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 37 | ~FlexfecReceiveStreamImpl() override; |
| 38 | |
brandtr | b29e652 | 2016-12-21 06:37:18 -0800 | [diff] [blame] | 39 | const Config& GetConfig() const { return config_; } |
| 40 | |
nisse | e4bcd6d | 2017-05-16 04:47:04 -0700 | [diff] [blame] | 41 | // RtpPacketSinkInterface. |
| 42 | void OnRtpPacket(const RtpPacketReceived& packet) override; |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 43 | |
| 44 | // Implements FlexfecReceiveStream. |
| 45 | void Start() override; |
| 46 | void Stop() override; |
| 47 | Stats GetStats() const override; |
| 48 | |
| 49 | private: |
brandtr | fa5a368 | 2017-01-17 01:33:54 -0800 | [diff] [blame] | 50 | // Config. |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 51 | const Config config_; |
brandtr | fa5a368 | 2017-01-17 01:33:54 -0800 | [diff] [blame] | 52 | bool started_ GUARDED_BY(crit_); |
| 53 | rtc::CriticalSection crit_; |
| 54 | |
| 55 | // Erasure code interfacing. |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 56 | const std::unique_ptr<FlexfecReceiver> receiver_; |
brandtr | fa5a368 | 2017-01-17 01:33:54 -0800 | [diff] [blame] | 57 | |
| 58 | // RTCP reporting. |
| 59 | const std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; |
| 60 | const std::unique_ptr<RtpRtcp> rtp_rtcp_; |
| 61 | ProcessThread* process_thread_; |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace webrtc |
| 65 | |
| 66 | #endif // WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_ |