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; |
} |