Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
|
åsapersson
2015/11/16 14:54:39
remove comment
sprang_webrtc
2015/12/01 10:23:06
Done.
| |
| 154 // The BuildResult indicates the outcome of a call to a builder method, | 154 // The BuildResult indicates the outcome of a call to a builder method, |
| 155 // constructing a part of an RTCP packet: | 155 // constructing a part of an RTCP packet: |
| 156 // | 156 // |
| 157 // kError | 157 // kError |
| 158 // Building RTCP packet failed, propagate error out to caller. | 158 // Building RTCP packet failed, propagate error out to caller. |
| 159 // kAbort | 159 // kAbort |
| 160 // The (partial) block being build should not be included. Reset current | 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 | 161 // buffer position to the state before the method call and proceed to the |
| 162 // next packet type. | 162 // next packet type. |
| 163 // kTruncated | 163 // kTruncated |
| 164 // There is not enough room in the buffer to fit the data being constructed. | 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 | 165 // (IP packet is full). Proceed to the next packet type, and call this |
| 166 // method again when a new buffer has been allocated. | 166 // method again when a new buffer has been allocated. |
| 167 // TODO(sprang): Actually allocate multiple packets if needed. | 167 // TODO(sprang): Actually allocate multiple packets if needed. |
| 168 // kSuccess | 168 // kSuccess |
| 169 // Data has been successfully placed in the buffer. | 169 // Data has been successfully placed in the buffer. |
| 170 | 170 |
| 171 enum class BuildResult { kError, kAborted, kTruncated, kSuccess }; | 171 // Determine which RTCP messages should be sent and setup flags. |
| 172 | 172 void PrepareReport(const std::set<RTCPPacketType>& packetTypes, |
| 173 int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length); | 173 const FeedbackState& feedback_state) |
| 174 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | |
| 174 | 175 |
| 175 int32_t AddReportBlock(const RTCPReportBlock& report_block) | 176 int32_t AddReportBlock(const RTCPReportBlock& report_block) |
| 176 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 177 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 177 | 178 |
| 178 bool PrepareReport(const FeedbackState& feedback_state, | 179 bool PrepareReportBlock(const FeedbackState& feedback_state, |
| 179 uint32_t ssrc, | 180 uint32_t ssrc, |
| 180 StreamStatistician* statistician, | 181 StreamStatistician* statistician, |
| 181 RTCPReportBlock* report_block); | 182 RTCPReportBlock* report_block) |
| 183 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | |
|
åsapersson
2015/11/16 14:54:39
lock needed?
sprang_webrtc
2015/12/01 10:23:06
To read/update the flags. Problem?
åsapersson
2015/12/01 13:49:20
But not needed for this function, right?
sprang_webrtc
2015/12/02 10:33:26
Done.
| |
| 182 | 184 |
| 183 int PrepareRTCP(const FeedbackState& feedback_state, | 185 bool BuildSR(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_); | 186 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 194 BuildResult BuildRR(RtcpContext* context) | 187 bool BuildRR(RtcpContext* context) |
| 195 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 188 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 196 BuildResult BuildSDES(RtcpContext* context) | 189 bool BuildSDES(RtcpContext* context) |
| 197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 190 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 198 BuildResult BuildPLI(RtcpContext* context) | 191 bool BuildPLI(RtcpContext* context) |
| 199 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 200 BuildResult BuildREMB(RtcpContext* context) | 193 bool BuildREMB(RtcpContext* context) |
| 201 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 194 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 202 BuildResult BuildTMMBR(RtcpContext* context) | 195 bool BuildTMMBR(RtcpContext* context) |
| 203 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 196 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 204 BuildResult BuildTMMBN(RtcpContext* context) | 197 bool BuildTMMBN(RtcpContext* context) |
| 205 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 198 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 206 BuildResult BuildAPP(RtcpContext* context) | 199 bool BuildAPP(RtcpContext* context) |
| 207 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 200 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 208 BuildResult BuildVoIPMetric(RtcpContext* context) | 201 bool BuildVoIPMetric(RtcpContext* context) |
| 209 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 202 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 210 BuildResult BuildBYE(RtcpContext* context) | 203 bool BuildBYE(RtcpContext* context) |
| 211 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 204 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 212 BuildResult BuildFIR(RtcpContext* context) | 205 bool BuildFIR(RtcpContext* context) |
| 213 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 206 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 214 BuildResult BuildSLI(RtcpContext* context) | 207 bool BuildSLI(RtcpContext* context) |
| 215 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 208 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 216 BuildResult BuildRPSI(RtcpContext* context) | 209 bool BuildRPSI(RtcpContext* context) |
| 217 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 210 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 218 BuildResult BuildNACK(RtcpContext* context) | 211 bool BuildNACK(RtcpContext* context) |
| 219 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 212 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 220 BuildResult BuildReceiverReferenceTime(RtcpContext* context) | 213 bool BuildReceiverReferenceTime(RtcpContext* context) |
| 221 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 214 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 222 BuildResult BuildDlrr(RtcpContext* context) | 215 bool BuildDlrr(RtcpContext* context) |
| 223 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 216 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 224 | 217 |
| 225 private: | 218 private: |
| 226 const bool audio_; | 219 const bool audio_; |
| 227 Clock* const clock_; | 220 Clock* const clock_; |
| 228 RTCPMethod method_ GUARDED_BY(critical_section_rtcp_sender_); | 221 RTCPMethod method_ GUARDED_BY(critical_section_rtcp_sender_); |
| 229 | 222 |
| 230 Transport* const transport_; | 223 Transport* const transport_; |
| 231 | 224 |
| 232 rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_; | 225 rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 ReportFlag(RTCPPacketType type, bool is_volatile) | 302 ReportFlag(RTCPPacketType type, bool is_volatile) |
| 310 : type(type), is_volatile(is_volatile) {} | 303 : type(type), is_volatile(is_volatile) {} |
| 311 bool operator<(const ReportFlag& flag) const { return type < flag.type; } | 304 bool operator<(const ReportFlag& flag) const { return type < flag.type; } |
| 312 bool operator==(const ReportFlag& flag) const { return type == flag.type; } | 305 bool operator==(const ReportFlag& flag) const { return type == flag.type; } |
| 313 const RTCPPacketType type; | 306 const RTCPPacketType type; |
| 314 const bool is_volatile; | 307 const bool is_volatile; |
| 315 }; | 308 }; |
| 316 | 309 |
| 317 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); | 310 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); |
| 318 | 311 |
| 319 typedef BuildResult (RTCPSender::*Builder)(RtcpContext*); | 312 typedef bool (RTCPSender::*Builder)(RtcpContext*); |
| 320 std::map<RTCPPacketType, Builder> builders_; | 313 std::map<RTCPPacketType, Builder> builders_; |
| 321 | |
| 322 class PacketBuiltCallback; | |
| 323 }; | 314 }; |
| 324 } // namespace webrtc | 315 } // namespace webrtc |
| 325 | 316 |
| 326 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 317 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| OLD | NEW |