Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: webrtc/modules/rtp_rtcp/include/flexfec_receiver.h

Issue 2471073003: Make FlexfecReceiver a concrete class. (Closed)
Patch Set: Update fuzzer. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/BUILD.gn ('k') | webrtc/modules/rtp_rtcp/rtp_rtcp.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
18 #include "webrtc/call.h"
19 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
17 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h" 20 #include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h"
21 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
22 #include "webrtc/system_wrappers/include/clock.h"
18 23
19 namespace webrtc { 24 namespace webrtc {
20 25
21 // Callback interface for packets recovered by FlexFEC. The implementation 26 // Callback interface for packets recovered by FlexFEC. The implementation
22 // should be able to demultiplex the recovered RTP packets based on SSRC. 27 // should be able to demultiplex the recovered RTP packets based on SSRC.
23 class RecoveredPacketReceiver { 28 class RecoveredPacketReceiver {
24 public: 29 public:
25 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0; 30 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0;
26 31
27 protected: 32 protected:
28 virtual ~RecoveredPacketReceiver() = default; 33 virtual ~RecoveredPacketReceiver() = default;
29 }; 34 };
30 35
31 class FlexfecReceiver { 36 class FlexfecReceiver {
32 public: 37 public:
33 static std::unique_ptr<FlexfecReceiver> Create( 38 FlexfecReceiver(uint32_t ssrc,
34 uint32_t flexfec_ssrc, 39 uint32_t protected_media_ssrc,
35 uint32_t protected_media_ssrc, 40 RecoveredPacketReceiver* callback);
36 RecoveredPacketReceiver* callback); 41 ~FlexfecReceiver();
37 virtual ~FlexfecReceiver();
38 42
39 // Inserts a received packet (can be either media or FlexFEC) into the 43 // Inserts a received packet (can be either media or FlexFEC) into the
40 // internal buffer, and sends the received packets to the erasure code. 44 // internal buffer, and sends the received packets to the erasure code.
41 // All newly recovered packets are sent back through the callback. 45 // All newly recovered packets are sent back through the callback.
42 virtual bool AddAndProcessReceivedPacket(const uint8_t* packet, 46 bool AddAndProcessReceivedPacket(const uint8_t* packet, size_t packet_length);
43 size_t packet_length) = 0;
44 47
45 // Returns a counter describing the added and recovered packets. 48 // Returns a counter describing the added and recovered packets.
46 virtual FecPacketCounter GetPacketCounter() const = 0; 49 FecPacketCounter GetPacketCounter() const;
50
51 private:
52 bool AddReceivedPacket(const uint8_t* packet, size_t packet_length);
53 bool ProcessReceivedPackets();
54
55 // Config.
56 const uint32_t ssrc_;
57 const uint32_t protected_media_ssrc_;
58
59 // Erasure code interfacing and callback.
60 std::unique_ptr<ForwardErrorCorrection> erasure_code_;
61 ForwardErrorCorrection::ReceivedPacketList received_packets_;
62 ForwardErrorCorrection::RecoveredPacketList recovered_packets_;
63 RecoveredPacketReceiver* const callback_;
64
65 // Logging and stats.
66 Clock* const clock_;
67 int64_t last_recovered_packet_ms_;
68 FecPacketCounter packet_counter_;
69
70 rtc::SequencedTaskChecker sequence_checker_;
47 }; 71 };
48 72
49 } // namespace webrtc 73 } // namespace webrtc
50 74
51 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_ 75 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/BUILD.gn ('k') | webrtc/modules/rtp_rtcp/rtp_rtcp.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698