blob: d1c19ffc701c3949f82d99f5266579ebdfac22c7 [file] [log] [blame]
brandtr7250b392016-12-19 01:13:46 -08001/*
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
eladalon3d4c2872017-08-02 07:17:04 -070014#include <atomic>
brandtr7250b392016-12-19 01:13:46 -080015#include <memory>
brandtr7250b392016-12-19 01:13:46 -080016
brandtr7250b392016-12-19 01:13:46 -080017#include "webrtc/call/flexfec_receive_stream.h"
nissed76b7b22017-06-01 04:02:35 -070018#include "webrtc/call/rtp_packet_sink_interface.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020019#include "webrtc/rtc_base/criticalsection.h"
brandtr7250b392016-12-19 01:13:46 -080020
21namespace webrtc {
22
brandtrfa5a3682017-01-17 01:33:54 -080023class FlexfecReceiver;
24class ProcessThread;
25class ReceiveStatistics;
26class RecoveredPacketReceiver;
27class RtcpRttStats;
28class RtpPacketReceived;
29class RtpRtcp;
nisse0f15f922017-06-21 01:05:22 -070030class RtpStreamReceiverControllerInterface;
31class RtpStreamReceiverInterface;
brandtrfa5a3682017-01-17 01:33:54 -080032
nissee4bcd6d2017-05-16 04:47:04 -070033class FlexfecReceiveStreamImpl : public FlexfecReceiveStream,
34 public RtpPacketSinkInterface {
brandtr7250b392016-12-19 01:13:46 -080035 public:
nisse0f15f922017-06-21 01:05:22 -070036 FlexfecReceiveStreamImpl(
37 RtpStreamReceiverControllerInterface* receiver_controller,
38 const Config& config,
39 RecoveredPacketReceiver* recovered_packet_receiver,
40 RtcpRttStats* rtt_stats,
41 ProcessThread* process_thread);
brandtr7250b392016-12-19 01:13:46 -080042 ~FlexfecReceiveStreamImpl() override;
43
nissee4bcd6d2017-05-16 04:47:04 -070044 // RtpPacketSinkInterface.
45 void OnRtpPacket(const RtpPacketReceived& packet) override;
brandtr7250b392016-12-19 01:13:46 -080046
47 // Implements FlexfecReceiveStream.
48 void Start() override;
49 void Stop() override;
50 Stats GetStats() const override;
eladalon42f44f92017-07-25 06:40:06 -070051 const Config& GetConfig() const override;
brandtr7250b392016-12-19 01:13:46 -080052
53 private:
brandtrfa5a3682017-01-17 01:33:54 -080054 // Config.
brandtr7250b392016-12-19 01:13:46 -080055 const Config config_;
eladalon3d4c2872017-08-02 07:17:04 -070056 std::atomic<bool> started_;
brandtrfa5a3682017-01-17 01:33:54 -080057
58 // Erasure code interfacing.
brandtr7250b392016-12-19 01:13:46 -080059 const std::unique_ptr<FlexfecReceiver> receiver_;
brandtrfa5a3682017-01-17 01:33:54 -080060
61 // RTCP reporting.
62 const std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
63 const std::unique_ptr<RtpRtcp> rtp_rtcp_;
64 ProcessThread* process_thread_;
nisse0f15f922017-06-21 01:05:22 -070065
66 std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_;
brandtr7250b392016-12-19 01:13:46 -080067};
68
69} // namespace webrtc
70
71#endif // WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_