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/call/rtp_transport_controller_receive.h" |
19 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h" | 20 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h" |
20 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 21 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
22 #include "webrtc/system_wrappers/include/clock.h" | 23 #include "webrtc/system_wrappers/include/clock.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 | 26 |
26 // Callback interface for packets recovered by FlexFEC. The implementation | 27 // Callback interface for packets recovered by FlexFEC. The implementation |
27 // should be able to demultiplex the recovered RTP packets based on SSRC. | 28 // should be able to demultiplex the recovered RTP packets based on SSRC. |
28 class RecoveredPacketReceiver { | 29 class RecoveredPacketReceiver { |
29 public: | 30 public: |
30 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0; | 31 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0; |
31 | 32 |
32 protected: | 33 protected: |
33 virtual ~RecoveredPacketReceiver() = default; | 34 virtual ~RecoveredPacketReceiver() = default; |
34 }; | 35 }; |
35 | 36 |
36 class FlexfecReceiver { | 37 class FlexfecReceiver : public RtpPacketSinkInterface { |
37 public: | 38 public: |
38 FlexfecReceiver(uint32_t ssrc, | 39 FlexfecReceiver(uint32_t ssrc, |
39 uint32_t protected_media_ssrc, | 40 uint32_t protected_media_ssrc, |
40 RecoveredPacketReceiver* recovered_packet_receiver); | 41 RecoveredPacketReceiver* recovered_packet_receiver); |
41 ~FlexfecReceiver(); | 42 ~FlexfecReceiver(); |
42 | 43 |
| 44 // RtpPacketSink implementation. |
43 // Inserts a received packet (can be either media or FlexFEC) into the | 45 // Inserts a received packet (can be either media or FlexFEC) into the |
44 // internal buffer, and sends the received packets to the erasure code. | 46 // internal buffer, and sends the received packets to the erasure code. |
45 // All newly recovered packets are sent back through the callback. | 47 // All newly recovered packets are sent back through the callback. |
46 void OnRtpPacket(const RtpPacketReceived& packet); | 48 void OnRtpPacket(const RtpPacketReceived& packet) override; |
47 | 49 |
48 // Returns a counter describing the added and recovered packets. | 50 // Returns a counter describing the added and recovered packets. |
49 FecPacketCounter GetPacketCounter() const; | 51 FecPacketCounter GetPacketCounter() const; |
50 | 52 |
51 // Protected to aid testing. | 53 // Protected to aid testing. |
52 protected: | 54 protected: |
53 bool AddReceivedPacket(const RtpPacketReceived& packet); | 55 bool AddReceivedPacket(const RtpPacketReceived& packet); |
54 bool ProcessReceivedPackets(); | 56 bool ProcessReceivedPackets(); |
55 | 57 |
56 private: | 58 private: |
(...skipping 14 matching lines...) Expand all Loading... |
71 Clock* const clock_; | 73 Clock* const clock_; |
72 int64_t last_recovered_packet_ms_ GUARDED_BY(sequence_checker_); | 74 int64_t last_recovered_packet_ms_ GUARDED_BY(sequence_checker_); |
73 FecPacketCounter packet_counter_ GUARDED_BY(sequence_checker_); | 75 FecPacketCounter packet_counter_ GUARDED_BY(sequence_checker_); |
74 | 76 |
75 rtc::SequencedTaskChecker sequence_checker_; | 77 rtc::SequencedTaskChecker sequence_checker_; |
76 }; | 78 }; |
77 | 79 |
78 } // namespace webrtc | 80 } // namespace webrtc |
79 | 81 |
80 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ | 82 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ |
OLD | NEW |