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

Side by Side Diff: media/cast/cast_sender_impl.cc

Issue 314593002: [Cast] Cleanup: Remove TransportXXXXXSender, an unnecessary layer of indirection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cast/cast.gyp ('k') | media/cast/transport/cast_transport_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "media/cast/cast_sender_impl.h" 4 #include "media/cast/cast_sender_impl.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void CastSenderImpl::InitializeAudio( 93 void CastSenderImpl::InitializeAudio(
94 const AudioSenderConfig& audio_config, 94 const AudioSenderConfig& audio_config,
95 const CastInitializationCallback& cast_initialization_cb) { 95 const CastInitializationCallback& cast_initialization_cb) {
96 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 96 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
97 CHECK(audio_config.use_external_encoder || 97 CHECK(audio_config.use_external_encoder ||
98 cast_environment_->HasAudioThread()); 98 cast_environment_->HasAudioThread());
99 99
100 audio_sender_.reset( 100 audio_sender_.reset(
101 new AudioSender(cast_environment_, audio_config, transport_sender_)); 101 new AudioSender(cast_environment_, audio_config, transport_sender_));
102 102
103 CastInitializationStatus status = audio_sender_->InitializationResult(); 103 const CastInitializationStatus status = audio_sender_->InitializationResult();
104
105 if (status == STATUS_AUDIO_INITIALIZED) { 104 if (status == STATUS_AUDIO_INITIALIZED) {
106 ssrc_of_audio_sender_ = audio_config.incoming_feedback_ssrc; 105 ssrc_of_audio_sender_ = audio_config.incoming_feedback_ssrc;
107 audio_frame_input_ = 106 audio_frame_input_ =
108 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr()); 107 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr());
109 } 108 }
110 cast_initialization_cb.Run(status); 109 cast_initialization_cb.Run(status);
111 } 110 }
112 111
113 void CastSenderImpl::InitializeVideo( 112 void CastSenderImpl::InitializeVideo(
114 const VideoSenderConfig& video_config, 113 const VideoSenderConfig& video_config,
115 const CastInitializationCallback& cast_initialization_cb, 114 const CastInitializationCallback& cast_initialization_cb,
116 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 115 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
117 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) { 116 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) {
118 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 117 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
119 CHECK(video_config.use_external_encoder || 118 CHECK(video_config.use_external_encoder ||
120 cast_environment_->HasVideoThread()); 119 cast_environment_->HasVideoThread());
121 VLOG(1) << "CastSender::ctor";
Alpha Left Google 2014/06/03 18:48:35 Hey please don't remove this. It's useful for debu
miu 2014/06/03 19:57:50 Done. I also "improved" all the VLOGs so that one
122 120
123 video_sender_.reset(new VideoSender(cast_environment_, 121 video_sender_.reset(new VideoSender(cast_environment_,
124 video_config, 122 video_config,
125 create_vea_cb, 123 create_vea_cb,
126 create_video_encode_mem_cb, 124 create_video_encode_mem_cb,
127 cast_initialization_cb,
128 transport_sender_)); 125 transport_sender_));
129 126
130 ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc; 127 const CastInitializationStatus status = video_sender_->InitializationResult();
131 video_frame_input_ = 128 if (status == STATUS_VIDEO_INITIALIZED) {
132 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); 129 ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc;
130 video_frame_input_ =
131 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
132 }
133 cast_initialization_cb.Run(status);
133 } 134 }
134 135
135 CastSenderImpl::~CastSenderImpl() { 136 CastSenderImpl::~CastSenderImpl() {
136 VLOG(1) << "CastSender::dtor"; 137 VLOG(1) << "CastSender::dtor";
137 } 138 }
138 139
139 // ReceivedPacket handle the incoming packets to the cast sender 140 // ReceivedPacket handle the incoming packets to the cast sender
140 // it's only expected to receive RTCP feedback packets from the remote cast 141 // it's only expected to receive RTCP feedback packets from the remote cast
141 // receiver. The class verifies that that it is a RTCP packet and based on the 142 // receiver. The class verifies that that it is a RTCP packet and based on the
142 // SSRC of the incoming packet route the packet to the correct sender; audio or 143 // SSRC of the incoming packet route the packet to the correct sender; audio or
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return video_frame_input_; 206 return video_frame_input_;
206 } 207 }
207 208
208 transport::PacketReceiverCallback CastSenderImpl::packet_receiver() { 209 transport::PacketReceiverCallback CastSenderImpl::packet_receiver() {
209 return base::Bind(&CastSenderImpl::ReceivedPacket, 210 return base::Bind(&CastSenderImpl::ReceivedPacket,
210 weak_factory_.GetWeakPtr()); 211 weak_factory_.GetWeakPtr());
211 } 212 }
212 213
213 } // namespace cast 214 } // namespace cast
214 } // namespace media 215 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast.gyp ('k') | media/cast/transport/cast_transport_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698