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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" | 22 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" |
25 #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h" | 25 #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h" |
26 #include "webrtc/system_wrappers/include/clock.h" | 26 #include "webrtc/system_wrappers/include/clock.h" |
27 | 27 |
28 namespace webrtc { | 28 namespace webrtc { |
29 | 29 |
30 class RtpPacketToSend; | 30 class RtpPacketToSend; |
31 | 31 |
| 32 // Note that this class is not thread safe, and thus requires external |
| 33 // synchronization. |
| 34 |
32 class FlexfecSender { | 35 class FlexfecSender { |
33 public: | 36 public: |
34 FlexfecSender(int payload_type, | 37 FlexfecSender(int payload_type, |
35 uint32_t ssrc, | 38 uint32_t ssrc, |
36 uint32_t protected_media_ssrc, | 39 uint32_t protected_media_ssrc, |
37 const std::vector<RtpExtension>& rtp_header_extensions, | 40 const std::vector<RtpExtension>& rtp_header_extensions, |
38 Clock* clock); | 41 Clock* clock); |
39 ~FlexfecSender(); | 42 ~FlexfecSender(); |
40 | 43 |
41 uint32_t ssrc() const { return ssrc_; } | 44 uint32_t ssrc() const { return ssrc_; } |
(...skipping 13 matching lines...) Expand all Loading... |
55 | 58 |
56 // Returns generated FlexFEC packets. | 59 // Returns generated FlexFEC packets. |
57 std::vector<std::unique_ptr<RtpPacketToSend>> GetFecPackets(); | 60 std::vector<std::unique_ptr<RtpPacketToSend>> GetFecPackets(); |
58 | 61 |
59 // Returns the overhead, per packet, for FlexFEC. | 62 // Returns the overhead, per packet, for FlexFEC. |
60 size_t MaxPacketOverhead() const; | 63 size_t MaxPacketOverhead() const; |
61 | 64 |
62 private: | 65 private: |
63 // Utility. | 66 // Utility. |
64 Clock* const clock_; | 67 Clock* const clock_; |
65 Random random_ GUARDED_BY(sequence_checker_); | 68 Random random_; |
66 int64_t last_generated_packet_ms_ GUARDED_BY(sequence_checker_); | 69 int64_t last_generated_packet_ms_; |
67 rtc::SequencedTaskChecker sequence_checker_; | |
68 | 70 |
69 // Config. | 71 // Config. |
70 const int payload_type_; | 72 const int payload_type_; |
71 const uint32_t timestamp_offset_; | 73 const uint32_t timestamp_offset_; |
72 const uint32_t ssrc_; | 74 const uint32_t ssrc_; |
73 const uint32_t protected_media_ssrc_; | 75 const uint32_t protected_media_ssrc_; |
74 // Sequence number of next packet to generate. | 76 // Sequence number of next packet to generate. |
75 uint16_t seq_num_ GUARDED_BY(sequence_checker_); | 77 uint16_t seq_num_; |
76 | 78 |
77 // Implementation. | 79 // Implementation. |
78 UlpfecGenerator ulpfec_generator_ GUARDED_BY(sequence_checker_); | 80 UlpfecGenerator ulpfec_generator_; |
79 const RtpHeaderExtensionMap rtp_header_extension_map_; | 81 const RtpHeaderExtensionMap rtp_header_extension_map_; |
80 }; | 82 }; |
81 | 83 |
82 } // namespace webrtc | 84 } // namespace webrtc |
83 | 85 |
84 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_SENDER_H_ | 86 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_SENDER_H_ |
OLD | NEW |