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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.h

Issue 1309833002: Send RTCP packets via RtcpPacket callback (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void SendRtcpXrReceiverReferenceTime(bool enable); 142 void SendRtcpXrReceiverReferenceTime(bool enable);
143 143
144 bool RtcpXrReceiverReferenceTime() const; 144 bool RtcpXrReceiverReferenceTime() const;
145 145
146 void SetCsrcs(const std::vector<uint32_t>& csrcs); 146 void SetCsrcs(const std::vector<uint32_t>& csrcs);
147 147
148 void SetTargetBitrate(unsigned int target_bitrate); 148 void SetTargetBitrate(unsigned int target_bitrate);
149 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); 149 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
150 150
151 private: 151 private:
152 struct RtcpContext; 152 class RtcpContext;
153 153
154 // The BuildResult indicates the outcome of a call to a builder method, 154 // Determine which RTCP messages should be sent and setup flags.
155 // constructing a part of an RTCP packet: 155 void PrepareReport(const std::set<RTCPPacketType>& packetTypes,
156 // 156 const FeedbackState& feedback_state)
157 // kError 157 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
158 // Building RTCP packet failed, propagate error out to caller.
159 // kAbort
160 // The (partial) block being build should not be included. Reset current
161 // buffer position to the state before the method call and proceed to the
162 // next packet type.
163 // kTruncated
164 // There is not enough room in the buffer to fit the data being constructed.
165 // (IP packet is full). Proceed to the next packet type, and call this
166 // method again when a new buffer has been allocated.
167 // TODO(sprang): Actually allocate multiple packets if needed.
168 // kSuccess
169 // Data has been successfully placed in the buffer.
170
171 enum class BuildResult { kError, kAborted, kTruncated, kSuccess };
172
173 int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length);
174 158
175 int32_t AddReportBlock(const RTCPReportBlock& report_block) 159 int32_t AddReportBlock(const RTCPReportBlock& report_block)
176 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 160 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
177 161
178 bool PrepareReport(const FeedbackState& feedback_state, 162 bool PrepareReportBlock(const FeedbackState& feedback_state,
179 uint32_t ssrc, 163 uint32_t ssrc,
180 StreamStatistician* statistician, 164 StreamStatistician* statistician,
181 RTCPReportBlock* report_block); 165 RTCPReportBlock* report_block);
182 166
183 int PrepareRTCP(const FeedbackState& feedback_state, 167 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context)
184 const std::set<RTCPPacketType>& packetTypes,
185 int32_t nackSize,
186 const uint16_t* nackList,
187 bool repeat,
188 uint64_t pictureID,
189 uint8_t* rtcp_buffer,
190 int buffer_size);
191
192 BuildResult BuildSR(RtcpContext* context)
193 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 168 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
194 BuildResult BuildRR(RtcpContext* context) 169 rtc::scoped_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context)
195 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 170 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
196 BuildResult BuildSDES(RtcpContext* context) 171 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context)
197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 172 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
198 BuildResult BuildPLI(RtcpContext* context) 173 rtc::scoped_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context)
199 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 174 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
200 BuildResult BuildREMB(RtcpContext* context) 175 rtc::scoped_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context)
201 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 176 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
202 BuildResult BuildTMMBR(RtcpContext* context) 177 rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context)
203 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 178 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
204 BuildResult BuildTMMBN(RtcpContext* context) 179 rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context)
205 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 180 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
206 BuildResult BuildAPP(RtcpContext* context) 181 rtc::scoped_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context)
207 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 182 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
208 BuildResult BuildVoIPMetric(RtcpContext* context) 183 rtc::scoped_ptr<rtcp::RtcpPacket> BuildVoIPMetric(const RtcpContext& context)
209 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 184 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
210 BuildResult BuildBYE(RtcpContext* context) 185 rtc::scoped_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context)
211 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 186 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
212 BuildResult BuildFIR(RtcpContext* context) 187 rtc::scoped_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context)
213 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 188 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
214 BuildResult BuildSLI(RtcpContext* context) 189 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSLI(const RtcpContext& context)
215 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 190 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
216 BuildResult BuildRPSI(RtcpContext* context) 191 rtc::scoped_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context)
217 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
218 BuildResult BuildNACK(RtcpContext* context) 193 rtc::scoped_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context)
219 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 194 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
220 BuildResult BuildReceiverReferenceTime(RtcpContext* context) 195 rtc::scoped_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime(
196 const RtcpContext& context)
221 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
222 BuildResult BuildDlrr(RtcpContext* context) 198 rtc::scoped_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context)
223 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); 199 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
224 200
225 private: 201 private:
226 const bool audio_; 202 const bool audio_;
227 Clock* const clock_; 203 Clock* const clock_;
228 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); 204 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_);
229 205
230 Transport* const transport_; 206 Transport* const transport_;
231 207
232 rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_; 208 rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ReportFlag(RTCPPacketType type, bool is_volatile) 285 ReportFlag(RTCPPacketType type, bool is_volatile)
310 : type(type), is_volatile(is_volatile) {} 286 : type(type), is_volatile(is_volatile) {}
311 bool operator<(const ReportFlag& flag) const { return type < flag.type; } 287 bool operator<(const ReportFlag& flag) const { return type < flag.type; }
312 bool operator==(const ReportFlag& flag) const { return type == flag.type; } 288 bool operator==(const ReportFlag& flag) const { return type == flag.type; }
313 const RTCPPacketType type; 289 const RTCPPacketType type;
314 const bool is_volatile; 290 const bool is_volatile;
315 }; 291 };
316 292
317 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); 293 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_);
318 294
319 typedef BuildResult (RTCPSender::*Builder)(RtcpContext*); 295 typedef rtc::scoped_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)(
320 std::map<RTCPPacketType, Builder> builders_; 296 const RtcpContext&);
321 297 std::map<RTCPPacketType, BuilderFunc> builders_;
322 class PacketBuiltCallback;
323 }; 298 };
324 } // namespace webrtc 299 } // namespace webrtc
325 300
326 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ 301 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698