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

Unified Diff: media/cast/cast_sender_impl.cc

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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/cast_sender_impl.h ('k') | media/cast/cast_testing.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/cast_sender_impl.cc
diff --git a/media/cast/cast_sender_impl.cc b/media/cast/cast_sender_impl.cc
index a120d3a930df74b7f003891a0a73a1d946767863..c684858775d6c93651899a1f9f26ca8870246433 100644
--- a/media/cast/cast_sender_impl.cc
+++ b/media/cast/cast_sender_impl.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "media/base/video_frame.h"
+#include "media/cast/net/rtcp/rtcp_receiver.h"
namespace media {
namespace cast {
@@ -142,68 +143,6 @@ CastSenderImpl::~CastSenderImpl() {
VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()";
}
-// ReceivedPacket handle the incoming packets to the cast sender
-// it's only expected to receive RTCP feedback packets from the remote cast
-// receiver. The class verifies that that it is a RTCP packet and based on the
-// SSRC of the incoming packet route the packet to the correct sender; audio or
-// video.
-//
-// Definition of SSRC as defined in RFC 3550.
-// Synchronization source (SSRC): The source of a stream of RTP
-// packets, identified by a 32-bit numeric SSRC identifier carried in
-// the RTP header so as not to be dependent upon the network address.
-// All packets from a synchronization source form part of the same
-// timing and sequence number space, so a receiver groups packets by
-// synchronization source for playback. Examples of synchronization
-// sources include the sender of a stream of packets derived from a
-// signal source such as a microphone or a camera, or an RTP mixer
-// (see below). A synchronization source may change its data format,
-// e.g., audio encoding, over time. The SSRC identifier is a
-// randomly chosen value meant to be globally unique within a
-// particular RTP session (see Section 8). A participant need not
-// use the same SSRC identifier for all the RTP sessions in a
-// multimedia session; the binding of the SSRC identifiers is
-// provided through RTCP (see Section 6.5.1). If a participant
-// generates multiple streams in one RTP session, for example from
-// separate video cameras, each MUST be identified as a different
-// SSRC.
-void CastSenderImpl::ReceivedPacket(scoped_ptr<Packet> packet) {
- DCHECK(cast_environment_);
- size_t length = packet->size();
- const uint8_t* data = &packet->front();
- if (!Rtcp::IsRtcpPacket(data, length)) {
- VLOG(1) << "CastSenderImpl@" << this << "::ReceivedPacket() -- "
- << "Received an invalid (non-RTCP?) packet in the cast sender.";
- return;
- }
- uint32 ssrc_of_sender = Rtcp::GetSsrcOfSender(data, length);
- if (ssrc_of_sender == ssrc_of_audio_sender_) {
- if (!audio_sender_) {
- NOTREACHED();
- return;
- }
- cast_environment_->PostTask(CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&AudioSender::IncomingRtcpPacket,
- audio_sender_->AsWeakPtr(),
- base::Passed(&packet)));
- } else if (ssrc_of_sender == ssrc_of_video_sender_) {
- if (!video_sender_) {
- NOTREACHED();
- return;
- }
- cast_environment_->PostTask(CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&VideoSender::IncomingRtcpPacket,
- video_sender_->AsWeakPtr(),
- base::Passed(&packet)));
- } else {
- VLOG(1) << "CastSenderImpl@" << this << "::ReceivedPacket() -- "
- << "Received a RTCP packet with a non matching sender SSRC "
- << ssrc_of_sender;
- }
-}
-
scoped_refptr<AudioFrameInput> CastSenderImpl::audio_frame_input() {
return audio_frame_input_;
}
@@ -212,10 +151,5 @@ scoped_refptr<VideoFrameInput> CastSenderImpl::video_frame_input() {
return video_frame_input_;
}
-PacketReceiverCallback CastSenderImpl::packet_receiver() {
- return base::Bind(&CastSenderImpl::ReceivedPacket,
- weak_factory_.GetWeakPtr());
-}
-
} // namespace cast
} // namespace media
« no previous file with comments | « media/cast/cast_sender_impl.h ('k') | media/cast/cast_testing.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698