Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/base/basictypes.h" | 16 #include "webrtc/base/basictypes.h" |
| 17 #include "webrtc/base/sequenced_task_checker.h" | 17 #include "webrtc/base/sequenced_task_checker.h" |
| 18 #include "webrtc/call/call.h" | 18 #include "webrtc/call/call.h" |
| 19 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | |
| 20 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h" | 19 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 20 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | |
| 22 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 | 25 |
| 26 class RemoteBitrateEstimator; | |
| 27 | |
| 26 // Callback interface for packets recovered by FlexFEC. The implementation | 28 // Callback interface for packets recovered by FlexFEC. The implementation |
| 27 // should be able to demultiplex the recovered RTP packets based on SSRC. | 29 // should be able to demultiplex the recovered RTP packets based on SSRC. |
| 28 class RecoveredPacketReceiver { | 30 class RecoveredPacketReceiver { |
| 29 public: | 31 public: |
| 30 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0; | 32 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0; |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 virtual ~RecoveredPacketReceiver() = default; | 35 virtual ~RecoveredPacketReceiver() = default; |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 class FlexfecReceiver { | 38 class FlexfecReceiver { |
| 37 public: | 39 public: |
| 38 FlexfecReceiver(uint32_t ssrc, | 40 FlexfecReceiver(uint32_t ssrc, |
| 39 uint32_t protected_media_ssrc, | 41 uint32_t protected_media_ssrc, |
| 40 RecoveredPacketReceiver* callback); | 42 RecoveredPacketReceiver* recovered_packet_receiver, |
| 43 RemoteBitrateEstimator* remote_bitrate_estimator); | |
| 41 ~FlexfecReceiver(); | 44 ~FlexfecReceiver(); |
| 42 | 45 |
| 43 // Inserts a received packet (can be either media or FlexFEC) into the | 46 // Inserts a received packet (can be either media or FlexFEC) into the |
| 44 // internal buffer, and sends the received packets to the erasure code. | 47 // internal buffer, and sends the received packets to the erasure code. |
| 45 // All newly recovered packets are sent back through the callback. | 48 // All newly recovered packets are sent back through the callback. |
| 46 bool AddAndProcessReceivedPacket(const uint8_t* packet, size_t packet_length); | 49 bool AddAndProcessReceivedPacket(RtpPacketReceived packet); |
| 47 | 50 |
| 48 // Returns a counter describing the added and recovered packets. | 51 // Returns a counter describing the added and recovered packets. |
| 49 FecPacketCounter GetPacketCounter() const; | 52 FecPacketCounter GetPacketCounter() const; |
| 50 | 53 |
| 51 private: | 54 private: |
| 52 bool AddReceivedPacket(const uint8_t* packet, size_t packet_length); | 55 bool AddReceivedPacket(RtpPacketReceived packet); |
| 53 bool ProcessReceivedPackets(); | 56 bool ProcessReceivedPackets(); |
| 54 | 57 |
| 55 // Config. | 58 // Config. |
| 56 const uint32_t ssrc_; | 59 const uint32_t ssrc_; |
| 57 const uint32_t protected_media_ssrc_; | 60 const uint32_t protected_media_ssrc_; |
| 58 | 61 |
| 59 // Erasure code interfacing and callback. | 62 // Erasure code interfacing and callback. |
| 60 std::unique_ptr<ForwardErrorCorrection> erasure_code_; | 63 std::unique_ptr<ForwardErrorCorrection> erasure_code_; |
| 61 ForwardErrorCorrection::ReceivedPacketList received_packets_; | 64 ForwardErrorCorrection::ReceivedPacketList received_packets_; |
| 62 ForwardErrorCorrection::RecoveredPacketList recovered_packets_; | 65 ForwardErrorCorrection::RecoveredPacketList recovered_packets_; |
| 63 RecoveredPacketReceiver* const callback_; | 66 RecoveredPacketReceiver* const recovered_packet_receiver_; |
| 67 | |
| 68 // BWE. | |
| 69 RemoteBitrateEstimator* remote_bitrate_estimator_; | |
|
danilchap
2016/12/13 14:11:24
* const
brandtr
2016/12/14 12:55:49
N/A.
| |
| 64 | 70 |
| 65 // Logging and stats. | 71 // Logging and stats. |
| 66 Clock* const clock_; | 72 Clock* const clock_; |
| 67 int64_t last_recovered_packet_ms_; | 73 int64_t last_recovered_packet_ms_; |
| 68 FecPacketCounter packet_counter_; | 74 FecPacketCounter packet_counter_; |
| 69 | 75 |
| 70 rtc::SequencedTaskChecker sequence_checker_; | 76 rtc::SequencedTaskChecker sequence_checker_; |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 } // namespace webrtc | 79 } // namespace webrtc |
| 74 | 80 |
| 75 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ | 81 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ |
| OLD | NEW |