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

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: nits Created 6 years, 11 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 | « media/cast/transport/rtcp/rtcp_builder.h ('k') | media/cast/transport/rtcp/rtcp_builder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..eaa5df90bb5b0cce24a523f915611025b9a114bb 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,9 +20,16 @@ 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)
+ uint32 sending_ssrc,
+ const std::string& c_name)
: ssrc_(sending_ssrc),
c_name_(c_name),
transport_(outgoing_transport) {
@@ -33,9 +39,9 @@ RtcpBuilder::RtcpBuilder(PacedPacketSender* outgoing_transport,
RtcpBuilder::~RtcpBuilder() {}
void RtcpBuilder::SendRtcpFromRtpSender(uint32 packet_type_flags,
- const RtcpSenderInfo* sender_info,
- const RtcpDlrrReportBlock* dlrr,
- RtcpSenderLogMessage* sender_log) {
+ const RtcpSenderInfo* sender_info,
+ const RtcpDlrrReportBlock* dlrr,
+ RtcpSenderLogMessage* sender_log) {
if (packet_type_flags & kRtcpRr ||
packet_type_flags & kRtcpPli ||
packet_type_flags & kRtcpRrtr ||
@@ -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);
@@ -66,7 +72,7 @@ void RtcpBuilder::SendRtcpFromRtpSender(uint32 packet_type_flags,
BuildSenderLog(sender_log, &packet);
}
if (packet.empty())
- return; // Sanity don't send empty packets.
+ return; // Sanity - don't send empty packets.
transport_->SendRtcpPacket(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);
@@ -201,10 +207,10 @@ void RtcpBuilder::BuildBye(std::vector<uint8>* packet) const {
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*/
void RtcpBuilder::BuildDlrrRb(const RtcpDlrrReportBlock* dlrr,
- std::vector<uint8>* packet) const {
+ 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);
@@ -222,11 +228,11 @@ void RtcpBuilder::BuildDlrrRb(const RtcpDlrrReportBlock* dlrr,
}
void RtcpBuilder::BuildSenderLog(RtcpSenderLogMessage* sender_log_message,
- std::vector<uint8>* packet) const {
+ std::vector<uint8>* packet) const {
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)
« no previous file with comments | « media/cast/transport/rtcp/rtcp_builder.h ('k') | media/cast/transport/rtcp/rtcp_builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698