From 0cca05d01025503c426cec132fa8957379a00858 Mon Sep 17 00:00:00 2001 From: "miu@chromium.org" Date: Wed, 4 Jun 2014 11:19:16 +0000 Subject: [Cast] Cleanup: Remove TransportXXXXXSender, an unnecessary layer of indirection. In src/media/cast/transport, both TransportAudioSender and TransportVideoSender were identical classes/implementations. In addition, they did nothing but wrap RtpSender, passing EncodedFrame data through the encryption library. Instead of merging them into one class, both have been deleted, with the encryption calls moved into AudioSender/VideoSender. Testing: Confirmed all unit tests continue to pass. Also, manually tested with a browser build, with DVLOG output to confirm encryption was successfully enabled for a cast session. Review URL: https://codereview.chromium.org/314593002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274769 0039d316-1c4b-4281-b951-d872f2087c98 --- media/cast/cast_sender_impl.cc | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'media/cast/cast_sender_impl.cc') diff --git a/media/cast/cast_sender_impl.cc b/media/cast/cast_sender_impl.cc index 2bcad36..361e4d8 100644 --- a/media/cast/cast_sender_impl.cc +++ b/media/cast/cast_sender_impl.cc @@ -97,11 +97,12 @@ void CastSenderImpl::InitializeAudio( CHECK(audio_config.use_external_encoder || cast_environment_->HasAudioThread()); + VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()"; + audio_sender_.reset( new AudioSender(cast_environment_, audio_config, transport_sender_)); - CastInitializationStatus status = audio_sender_->InitializationResult(); - + const CastInitializationStatus status = audio_sender_->InitializationResult(); if (status == STATUS_AUDIO_INITIALIZED) { ssrc_of_audio_sender_ = audio_config.incoming_feedback_ssrc; audio_frame_input_ = @@ -118,22 +119,26 @@ void CastSenderImpl::InitializeVideo( DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); CHECK(video_config.use_external_encoder || cast_environment_->HasVideoThread()); - VLOG(1) << "CastSender::ctor"; + + VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()"; video_sender_.reset(new VideoSender(cast_environment_, video_config, create_vea_cb, create_video_encode_mem_cb, - cast_initialization_cb, transport_sender_)); - ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc; - video_frame_input_ = - new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); + const CastInitializationStatus status = video_sender_->InitializationResult(); + if (status == STATUS_VIDEO_INITIALIZED) { + ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc; + video_frame_input_ = + new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); + } + cast_initialization_cb.Run(status); } CastSenderImpl::~CastSenderImpl() { - VLOG(1) << "CastSender::dtor"; + VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()"; } // ReceivedPacket handle the incoming packets to the cast sender @@ -166,8 +171,8 @@ void CastSenderImpl::ReceivedPacket(scoped_ptr packet) { size_t length = packet->size(); const uint8_t* data = &packet->front(); if (!Rtcp::IsRtcpPacket(data, length)) { - // We should have no incoming RTP packets. - VLOG(1) << "Unexpectedly received a RTP packet in the cast sender"; + VLOG(1) << "CastSenderImpl@" << this << "::ReceivedPacket() -- " + << "Received an invalid (non-RTCP?) packet in the cast sender."; return; } uint32 ssrc_of_sender = Rtcp::GetSsrcOfSender(data, length); @@ -192,7 +197,8 @@ void CastSenderImpl::ReceivedPacket(scoped_ptr packet) { video_sender_->AsWeakPtr(), base::Passed(&packet))); } else { - VLOG(1) << "Received a RTCP packet with a non matching sender SSRC " + VLOG(1) << "CastSenderImpl@" << this << "::ReceivedPacket() -- " + << "Received a RTCP packet with a non matching sender SSRC " << ssrc_of_sender; } } -- cgit v1.1