summaryrefslogtreecommitdiffstats
path: root/media/cast/net/rtcp/rtcp_sender.h
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-20 07:13:24 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-20 07:13:24 +0000
commitabd5fb257d7dbf92f99b75e3cefad7c58ca485bb (patch)
treeb01cb29d240492a83c2e87453308bcf031cba47f /media/cast/net/rtcp/rtcp_sender.h
parentc5b1db7f8e90e0d118bac3b01484c69f1c4ef5e9 (diff)
downloadchromium_src-abd5fb257d7dbf92f99b75e3cefad7c58ca485bb.zip
chromium_src-abd5fb257d7dbf92f99b75e3cefad7c58ca485bb.tar.gz
chromium_src-abd5fb257d7dbf92f99b75e3cefad7c58ca485bb.tar.bz2
Cast: Refactor RTCP handling
OBJECTIVES This change is to refactor RTCP handling in media/cast such that RTCP message parsing is done in CastTransportSender. This side effect of this refactoring is much cleaner code: RTCP handling code are grouped under one module. VideoSender and AudioSender do not handle packets directly. This also affect the architectutre in Chrome that RTCP message parsing is now done in the browser process. A parsed RTCP message is passed to the renderer instead of raw packets. REATIONALE RTCP is used as a feedback mechanism in Cast Streaming. It used to be parsed and handled by VideoSender and AudioSender in the render process. This was very ineffective because packetization and sending is done in the browser process. This created inefficiencies in packet retransmission. It also made improvement to the transport protocol / algorithm much more difficult. A side effect is very messy code. DETAILS Rtcp - This class is responsibile for maintaining a bi-directional RTCP session. It is now owned by CastTransportSender. CastTransportSender - It now performs packetization and also parsing of incoming RTCP packets. RTCP packets are small UDP packets for signaling only. Eventually retransmission can also be moved to this class. It will handle all packet level send transport. AudioSender / VideoSender - They don't handle packet directly any more. Which means render process doesn't see raw packets. FrameSender - Base class for AudioSender and VideoSender to share code for RTCP message handling. Eventually AudioSender and VideoSender will merge here but it is not the point of this change. RtcpBuilder - Removed and merged with RtcpSender. Net deleted 400 lines of code and simulation shows the same results. BUG=393042 Review URL: https://codereview.chromium.org/387933005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/cast/net/rtcp/rtcp_sender.h')
-rw-r--r--media/cast/net/rtcp/rtcp_sender.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/media/cast/net/rtcp/rtcp_sender.h b/media/cast/net/rtcp/rtcp_sender.h
index fe5af0d..e55d5f4 100644
--- a/media/cast/net/rtcp/rtcp_sender.h
+++ b/media/cast/net/rtcp/rtcp_sender.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MEDIA_CAST_RTCP_RTCP_SENDER_H_
-#define MEDIA_CAST_RTCP_RTCP_SENDER_H_
+#ifndef MEDIA_CAST_NET_RTCP_RTCP_SENDER_H_
+#define MEDIA_CAST_NET_RTCP_RTCP_SENDER_H_
#include <deque>
#include <list>
@@ -13,8 +13,6 @@
#include "media/cast/cast_defines.h"
#include "media/cast/net/cast_transport_defines.h"
#include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
-#include "media/cast/net/rtcp/rtcp.h"
-#include "media/cast/net/rtcp/rtcp_builder.h"
#include "media/cast/net/rtcp/rtcp_defines.h"
namespace media {
@@ -40,16 +38,19 @@ COMPILE_ASSERT(kSecondRedundancyOffset >
kReceiveLogMessageHistorySize,
redundancy_offset_out_of_range);
-// TODO(mikhal): Resolve duplication between this and RtcpBuilder.
+class PacedPacketSender;
+
+// TODO(hclam): This should be renamed to RtcpPacketBuilder. The function
+// of this class is to only to build a RTCP packet but not to send it.
class RtcpSender {
public:
- RtcpSender(scoped_refptr<CastEnvironment> cast_environment,
- PacedPacketSender* outgoing_transport,
+ RtcpSender(PacedPacketSender* outgoing_transport,
uint32 sending_ssrc,
const std::string& c_name);
+ ~RtcpSender();
- virtual ~RtcpSender();
-
+ // TODO(hclam): This method should be to build a packet instead of
+ // sending it.
void SendRtcpFromRtpReceiver(
uint32 packet_type_flags,
const RtcpReportBlock* report_block,
@@ -58,6 +59,12 @@ class RtcpSender {
const ReceiverRtcpEventSubscriber::RtcpEventMultiMap* rtcp_events,
base::TimeDelta target_delay);
+ // TODO(hclam): This method should be to build a packet instead of
+ // sending it.
+ void SendRtcpFromRtpSender(uint32 packet_type_flags,
+ const RtcpSenderInfo& sender_info,
+ const RtcpDlrrReportBlock& dlrr);
+
private:
void BuildRR(const RtcpReportBlock* report_block,
Packet* packet) const;
@@ -84,6 +91,10 @@ class RtcpSender {
base::TimeDelta target_delay,
Packet* packet) const;
+ void BuildSR(const RtcpSenderInfo& sender_info, Packet* packet) const;
+
+ void BuildDlrrRb(const RtcpDlrrReportBlock& dlrr, Packet* packet) const;
+
void BuildReceiverLog(
const ReceiverRtcpEventSubscriber::RtcpEventMultiMap& rtcp_events,
Packet* packet);
@@ -115,7 +126,6 @@ class RtcpSender {
// Not owned by this class.
PacedPacketSender* const transport_;
- scoped_refptr<CastEnvironment> cast_environment_;
std::deque<RtcpReceiverLogMessage> rtcp_events_history_;
@@ -124,4 +134,5 @@ class RtcpSender {
} // namespace cast
} // namespace media
-#endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_
+
+#endif // MEDIA_CAST_NET_RTCP_RTCP_SENDER_H_