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

Side by Side Diff: chromecast/renderer/media/audio_pipeline_proxy.cc

Issue 1553503002: Convert Pass()→std::move() in //chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 4
5 #include "chromecast/renderer/media/audio_pipeline_proxy.h" 5 #include "chromecast/renderer/media/audio_pipeline_proxy.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
12 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
13 #include "chromecast/common/media/cma_messages.h" 15 #include "chromecast/common/media/cma_messages.h"
14 #include "chromecast/common/media/shared_memory_chunk.h" 16 #include "chromecast/common/media/shared_memory_chunk.h"
15 #include "chromecast/media/cma/base/buffering_defs.h" 17 #include "chromecast/media/cma/base/buffering_defs.h"
16 #include "chromecast/media/cma/base/cma_logging.h" 18 #include "chromecast/media/cma/base/cma_logging.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 base::Bind(&AudioPipelineProxy::OnPipeRead, weak_this_)); 229 base::Bind(&AudioPipelineProxy::OnPipeRead, weak_this_));
228 FORWARD_ON_IO_THREAD(SetClient, pipe_read_cb, client); 230 FORWARD_ON_IO_THREAD(SetClient, pipe_read_cb, client);
229 } 231 }
230 232
231 void AudioPipelineProxy::Initialize( 233 void AudioPipelineProxy::Initialize(
232 const ::media::AudioDecoderConfig& config, 234 const ::media::AudioDecoderConfig& config,
233 scoped_ptr<CodedFrameProvider> frame_provider, 235 scoped_ptr<CodedFrameProvider> frame_provider,
234 const ::media::PipelineStatusCB& status_cb) { 236 const ::media::PipelineStatusCB& status_cb) {
235 CMALOG(kLogControl) << "AudioPipelineProxy::Initialize"; 237 CMALOG(kLogControl) << "AudioPipelineProxy::Initialize";
236 DCHECK(thread_checker_.CalledOnValidThread()); 238 DCHECK(thread_checker_.CalledOnValidThread());
237 audio_streamer_->SetCodedFrameProvider(frame_provider.Pass()); 239 audio_streamer_->SetCodedFrameProvider(std::move(frame_provider));
238 240
239 AudioPipelineProxyInternal::SharedMemCB shared_mem_cb = 241 AudioPipelineProxyInternal::SharedMemCB shared_mem_cb =
240 ::media::BindToCurrentLoop(base::Bind( 242 ::media::BindToCurrentLoop(base::Bind(
241 &AudioPipelineProxy::OnAvPipeCreated, weak_this_, 243 &AudioPipelineProxy::OnAvPipeCreated, weak_this_,
242 config, status_cb)); 244 config, status_cb));
243 FORWARD_ON_IO_THREAD(CreateAvPipe, shared_mem_cb); 245 FORWARD_ON_IO_THREAD(CreateAvPipe, shared_mem_cb);
244 } 246 }
245 247
246 void AudioPipelineProxy::OnAvPipeCreated( 248 void AudioPipelineProxy::OnAvPipeCreated(
247 const ::media::AudioDecoderConfig& config, 249 const ::media::AudioDecoderConfig& config,
248 const ::media::PipelineStatusCB& status_cb, 250 const ::media::PipelineStatusCB& status_cb,
249 scoped_ptr<base::SharedMemory> shared_memory) { 251 scoped_ptr<base::SharedMemory> shared_memory) {
250 CMALOG(kLogControl) << "AudioPipelineProxy::OnAvPipeCreated"; 252 CMALOG(kLogControl) << "AudioPipelineProxy::OnAvPipeCreated";
251 DCHECK(thread_checker_.CalledOnValidThread()); 253 DCHECK(thread_checker_.CalledOnValidThread());
252 if (!shared_memory || 254 if (!shared_memory ||
253 !shared_memory->Map(kAppAudioBufferSize)) { 255 !shared_memory->Map(kAppAudioBufferSize)) {
254 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); 256 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED);
255 return; 257 return;
256 } 258 }
257 CHECK(shared_memory->memory()); 259 CHECK(shared_memory->memory());
258 260
259 scoped_ptr<MediaMemoryChunk> shared_memory_chunk( 261 scoped_ptr<MediaMemoryChunk> shared_memory_chunk(
260 new SharedMemoryChunk(shared_memory.Pass(), kAppAudioBufferSize)); 262 new SharedMemoryChunk(std::move(shared_memory), kAppAudioBufferSize));
261 scoped_ptr<MediaMessageFifo> audio_pipe( 263 scoped_ptr<MediaMessageFifo> audio_pipe(
262 new MediaMessageFifo(shared_memory_chunk.Pass(), false)); 264 new MediaMessageFifo(std::move(shared_memory_chunk), false));
263 audio_pipe->ObserveWriteActivity( 265 audio_pipe->ObserveWriteActivity(
264 base::Bind(&AudioPipelineProxy::OnPipeWrite, weak_this_)); 266 base::Bind(&AudioPipelineProxy::OnPipeWrite, weak_this_));
265 267
266 audio_streamer_->SetMediaMessageFifo(audio_pipe.Pass()); 268 audio_streamer_->SetMediaMessageFifo(std::move(audio_pipe));
267 269
268 // Now proceed to the decoder/renderer initialization. 270 // Now proceed to the decoder/renderer initialization.
269 FORWARD_ON_IO_THREAD(Initialize, config, status_cb); 271 FORWARD_ON_IO_THREAD(Initialize, config, status_cb);
270 } 272 }
271 273
272 void AudioPipelineProxy::StartFeeding() { 274 void AudioPipelineProxy::StartFeeding() {
273 DCHECK(thread_checker_.CalledOnValidThread()); 275 DCHECK(thread_checker_.CalledOnValidThread());
274 DCHECK(audio_streamer_); 276 DCHECK(audio_streamer_);
275 audio_streamer_->Start(); 277 audio_streamer_->Start();
276 } 278 }
(...skipping 22 matching lines...) Expand all
299 } 301 }
300 302
301 void AudioPipelineProxy::OnPipeRead() { 303 void AudioPipelineProxy::OnPipeRead() {
302 DCHECK(thread_checker_.CalledOnValidThread()); 304 DCHECK(thread_checker_.CalledOnValidThread());
303 if (audio_streamer_) 305 if (audio_streamer_)
304 audio_streamer_->OnFifoReadEvent(); 306 audio_streamer_->OnFifoReadEvent();
305 } 307 }
306 308
307 } // namespace cma 309 } // namespace cma
308 } // namespace chromecast 310 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/net/connectivity_checker_impl.cc ('k') | chromecast/renderer/media/chromecast_media_renderer_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698