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

Unified Diff: media/cast/transport/rtcp/rtcp_builder.cc

Issue 109413004: Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating chrome/renderer Created 7 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/transport/rtcp/rtcp_builder.cc
diff --git a/media/cast/transport/rtcp/rtcp_builder.cc b/media/cast/transport/rtcp/rtcp_builder.cc
index 705582e7affaf12c43038500e5f2b577b265de78..405052aa5ddabedd66bea9b0c1400b8c2a48fd2a 100644
--- a/media/cast/transport/rtcp/rtcp_builder.cc
+++ b/media/cast/transport/rtcp/rtcp_builder.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/logging.h"
-#include "media/cast/rtcp/rtcp_utility.h"
#include "media/cast/transport/cast_transport_defines.h"
#include "media/cast/transport/pacing/paced_sender.h"
#include "net/base/big_endian.h"
@@ -21,6 +20,13 @@ namespace media {
namespace cast {
namespace transport {
+namespace {
+// RFC 3550 page 44, including end null.
+static const size_t kRtcpCnameSize = 256;
+static const uint32 kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T';
+static const uint8 kSenderLogSubtype = 1;
+};
+
RtcpBuilder::RtcpBuilder(PacedPacketSender* outgoing_transport,
uint32 sending_ssrc,
const std::string& c_name)
@@ -48,7 +54,7 @@ void RtcpBuilder::SendRtcpFromRtpSender(uint32 packet_type_flags,
}
std::vector<uint8> packet;
- packet.reserve(kIpPacketSize);
+ packet.reserve(kMaxIpPacketSize);
if (packet_type_flags & kRtcpSr) {
DCHECK(sender_info) << "Invalid argument";
BuildSR(*sender_info, NULL, &packet);
@@ -76,8 +82,8 @@ void RtcpBuilder::BuildSR(const RtcpSenderInfo& sender_info,
std::vector<uint8>* packet) const {
// Sender report.
size_t start_size = packet->size();
- DCHECK_LT(start_size + 52, kIpPacketSize) << "Not enough buffer space";
- if (start_size + 52 > kIpPacketSize) return;
+ DCHECK_LT(start_size + 52, kMaxIpPacketSize) << "Not enough buffer space";
+ if (start_size + 52 > kMaxIpPacketSize) return;
uint16 number_of_rows = (report_block) ? 12 : 6;
packet->resize(start_size + 28);
@@ -101,8 +107,8 @@ void RtcpBuilder::BuildSR(const RtcpSenderInfo& sender_info,
void RtcpBuilder::AddReportBlocks(const RtcpReportBlock& report_block,
std::vector<uint8>* packet) const {
size_t start_size = packet->size();
- DCHECK_LT(start_size + 24, kIpPacketSize) << "Not enough buffer space";
- if (start_size + 24 > kIpPacketSize) return;
+ DCHECK_LT(start_size + 24, kMaxIpPacketSize) << "Not enough buffer space";
+ if (start_size + 24 > kMaxIpPacketSize) return;
packet->resize(start_size + 24);
@@ -128,9 +134,9 @@ void RtcpBuilder::AddReportBlocks(const RtcpReportBlock& report_block,
void RtcpBuilder::BuildSdec(std::vector<uint8>* packet) const {
size_t start_size = packet->size();
- DCHECK_LT(start_size + 12 + c_name_.length(), kIpPacketSize)
+ DCHECK_LT(start_size + 12 + c_name_.length(), kMaxIpPacketSize)
<< "Not enough buffer space";
- if (start_size + 12 > kIpPacketSize) return;
+ if (start_size + 12 > kMaxIpPacketSize) return;
// SDES Source Description.
packet->resize(start_size + 10);
@@ -171,8 +177,8 @@ void RtcpBuilder::BuildSdec(std::vector<uint8>* packet) const {
void RtcpBuilder::BuildBye(std::vector<uint8>* packet) const {
size_t start_size = packet->size();
- DCHECK_LT(start_size + 8, kIpPacketSize) << "Not enough buffer space";
- if (start_size + 8 > kIpPacketSize) return;
+ DCHECK_LT(start_size + 8, kMaxIpPacketSize) << "Not enough buffer space";
+ if (start_size + 8 > kMaxIpPacketSize) return;
packet->resize(start_size + 8);
@@ -203,8 +209,8 @@ void RtcpBuilder::BuildBye(std::vector<uint8>* packet) const {
void RtcpBuilder::BuildDlrrRb(const RtcpDlrrReportBlock* dlrr,
std::vector<uint8>* packet) const {
size_t start_size = packet->size();
- DCHECK_LT(start_size + 24, kIpPacketSize) << "Not enough buffer space";
- if (start_size + 24 > kIpPacketSize) return;
+ DCHECK_LT(start_size + 24, kMaxIpPacketSize) << "Not enough buffer space";
+ if (start_size + 24 > kMaxIpPacketSize) return;
packet->resize(start_size + 24);
@@ -226,7 +232,7 @@ void RtcpBuilder::BuildSenderLog(RtcpSenderLogMessage* sender_log_message,
DCHECK(sender_log_message);
DCHECK(packet);
size_t start_size = packet->size();
- size_t remaining_space = kIpPacketSize - start_size;
+ size_t remaining_space = kMaxIpPacketSize - start_size;
DCHECK_GE(remaining_space, kRtcpCastLogHeaderSize + kRtcpSenderFrameLogSize)
<< "Not enough buffer space";
if (remaining_space < kRtcpCastLogHeaderSize + kRtcpSenderFrameLogSize)

Powered by Google App Engine
This is Rietveld 408576698