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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 1311453002: Use RtcpPacket to send APP in RtcpSender (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index 4c840372f56295dcf521d7d3ff1a79be3e218b82..38841b26ec097755f749a1639ce158aab046aa9c 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -782,32 +782,15 @@ RTCPSender::BuildResult RTCPSender::BuildTMMBN(RtcpContext* ctx) {
}
RTCPSender::BuildResult RTCPSender::BuildAPP(RtcpContext* ctx) {
- // sanity
- if (app_data_ == NULL) {
- LOG(LS_WARNING) << "Failed to build app specific.";
- return BuildResult::kError;
- }
- if (ctx->position + 12 + app_length_ >= IP_PACKET_SIZE) {
- LOG(LS_WARNING) << "Failed to build app specific.";
- return BuildResult::kTruncated;
- }
- *ctx->AllocateData(1) = 0x80 + app_sub_type_;
-
- // Add APP ID
- *ctx->AllocateData(1) = 204;
-
- uint16_t length = (app_length_ >> 2) + 2; // include SSRC and name
- *ctx->AllocateData(1) = static_cast<uint8_t>(length >> 8);
- *ctx->AllocateData(1) = static_cast<uint8_t>(length);
+ rtcp::App app;
+ app.From(ssrc_);
+ app.WithSubType(app_sub_type_);
+ app.WithName(app_name_);
+ app.WithData(app_data_.get(), app_length_);
- // Add our own SSRC
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
-
- // Add our application name
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), app_name_);
-
- // Add the data
- memcpy(ctx->AllocateData(app_length_), app_data_.get(), app_length_);
+ PacketBuiltCallback callback(ctx);
+ if (!callback.BuildPacket(app))
+ return BuildResult::kTruncated;
return BuildResult::kSuccess;
}
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698