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

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

Issue 2441613002: Add FlexfecSender. (Closed)
Patch Set: Rebase. 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
(Empty)
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_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_SENDER_H_
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_SENDER_H_
13
14 #include <memory>
15 #include <vector>
16
17 #include "webrtc/base/basictypes.h"
18 #include "webrtc/base/random.h"
19 #include "webrtc/base/sequenced_task_checker.h"
20 #include "webrtc/config.h"
21 #include "webrtc/modules/include/module_common_types.h"
22 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
25 #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h"
26 #include "webrtc/system_wrappers/include/clock.h"
27
28 namespace webrtc {
29
30 class RtpPacketToSend;
31
32 class FlexfecSender {
33 public:
34 FlexfecSender(int payload_type,
35 uint32_t ssrc,
36 uint32_t protected_media_ssrc,
37 const std::vector<RtpExtension>& rtp_header_extensions,
38 Clock* clock);
39 ~FlexfecSender();
40
41 // Sets the FEC rate, max frames sent before FEC packets are sent,
42 // and what type of generator matrices are used.
43 void SetFecParameters(const FecProtectionParams& params);
44
45 // Adds a media packet to the internal buffer. When enough media packets
46 // have been added, the FEC packets are generated and stored internally.
47 // These FEC packets are then obtained by calling GetFecPackets().
48 // Returns true if the media packet was successfully added.
49 bool AddRtpPacketAndGenerateFec(const RtpPacketToSend& packet);
50
51 // Returns true if there are generated FEC packets available.
52 bool FecAvailable() const;
53
54 // Returns generated FlexFEC packets.
55 std::vector<std::unique_ptr<RtpPacketToSend>> GetFecPackets();
56
57 // Returns the overhead, per packet, for FlexFEC.
58 size_t MaxPacketOverhead() const;
59
60 private:
61 // Utility.
62 Clock* const clock_;
63 Random random_ GUARDED_BY(sequence_checker_);
64 int64_t last_generated_packet_ms_ GUARDED_BY(sequence_checker_);
65 rtc::SequencedTaskChecker sequence_checker_;
66
67 // Config.
68 const int payload_type_;
69 const uint32_t timestamp_offset_;
70 const uint32_t ssrc_;
71 const uint32_t protected_media_ssrc_;
72 // Sequence number of next packet to generate.
73 uint16_t seq_num_ GUARDED_BY(sequence_checker_);
74
75 // Implementation.
76 UlpfecGenerator ulpfec_generator_ GUARDED_BY(sequence_checker_);
77 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(sequence_checker_);
78 };
79
80 } // namespace webrtc
81
82 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_SENDER_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