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

Side by Side Diff: chromecast/browser/media/cast_renderer.cc

Issue 1841273002: [chromecast] Fix build with enable_mojo_media=true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/browser/media/cast_renderer.h" 5 #include "chromecast/browser/media/cast_renderer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "chromecast/base/task_runner_impl.h" 9 #include "chromecast/base/task_runner_impl.h"
10 #include "chromecast/browser/media/cma_media_pipeline_client.h"
11 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" 10 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h"
12 #include "chromecast/media/cma/base/cma_logging.h" 11 #include "chromecast/media/cma/base/cma_logging.h"
13 #include "chromecast/media/cma/base/demuxer_stream_adapter.h" 12 #include "chromecast/media/cma/base/demuxer_stream_adapter.h"
14 #include "chromecast/media/cma/pipeline/media_pipeline_impl.h" 13 #include "chromecast/media/cma/pipeline/media_pipeline_impl.h"
15 #include "chromecast/media/cma/pipeline/video_pipeline_client.h" 14 #include "chromecast/media/cma/pipeline/video_pipeline_client.h"
16 #include "chromecast/public/media/media_pipeline_backend.h" 15 #include "chromecast/public/media/media_pipeline_backend.h"
17 #include "chromecast/public/media/media_pipeline_device_params.h" 16 #include "chromecast/public/media/media_pipeline_device_params.h"
18 #include "media/base/audio_decoder_config.h" 17 #include "media/base/audio_decoder_config.h"
19 #include "media/base/demuxer_stream.h" 18 #include "media/base/demuxer_stream.h"
20 #include "media/base/media_log.h" 19 #include "media/base/media_log.h"
21 20
22 namespace chromecast { 21 namespace chromecast {
23 namespace media { 22 namespace media {
24 23
25 namespace { 24 namespace {
26 // Maximum difference between audio frame PTS and video frame PTS 25 // Maximum difference between audio frame PTS and video frame PTS
27 // for frames read from the DemuxerStream. 26 // for frames read from the DemuxerStream.
28 const base::TimeDelta kMaxDeltaFetcher(base::TimeDelta::FromMilliseconds(2000)); 27 const base::TimeDelta kMaxDeltaFetcher(base::TimeDelta::FromMilliseconds(2000));
29 } // namespace 28 } // namespace
30 29
31 CastRenderer::CastRenderer( 30 CastRenderer::CastRenderer(
32 const scoped_refptr<CmaMediaPipelineClient> pipeline_client, 31 const CreateMediaPipelineBackendCB& create_backend_cb,
33 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
34 : pipeline_client_(pipeline_client), 33 : create_backend_cb_(create_backend_cb),
35 task_runner_(task_runner), 34 task_runner_(task_runner),
36 media_task_runner_factory_( 35 media_task_runner_factory_(
37 new BalancedMediaTaskRunnerFactory(kMaxDeltaFetcher)) { 36 new BalancedMediaTaskRunnerFactory(kMaxDeltaFetcher)) {
38 CMALOG(kLogControl) << __FUNCTION__ << ": " << this; 37 CMALOG(kLogControl) << __FUNCTION__ << ": " << this;
39 } 38 }
40 39
41 CastRenderer::~CastRenderer() { 40 CastRenderer::~CastRenderer() {
42 CMALOG(kLogControl) << __FUNCTION__ << ": " << this; 41 CMALOG(kLogControl) << __FUNCTION__ << ": " << this;
43 DCHECK(task_runner_->BelongsToCurrentThread()); 42 DCHECK(task_runner_->BelongsToCurrentThread());
44 } 43 }
(...skipping 11 matching lines...) Expand all
56 55
57 // Create pipeline backend. 56 // Create pipeline backend.
58 backend_task_runner_.reset(new TaskRunnerImpl()); 57 backend_task_runner_.reset(new TaskRunnerImpl());
59 // TODO(erickung): crbug.com/443956. Need to provide right LoadType. 58 // TODO(erickung): crbug.com/443956. Need to provide right LoadType.
60 LoadType load_type = kLoadTypeMediaSource; 59 LoadType load_type = kLoadTypeMediaSource;
61 MediaPipelineDeviceParams::MediaSyncType sync_type = 60 MediaPipelineDeviceParams::MediaSyncType sync_type =
62 (load_type == kLoadTypeMediaStream) 61 (load_type == kLoadTypeMediaStream)
63 ? MediaPipelineDeviceParams::kModeIgnorePts 62 ? MediaPipelineDeviceParams::kModeIgnorePts
64 : MediaPipelineDeviceParams::kModeSyncPts; 63 : MediaPipelineDeviceParams::kModeSyncPts;
65 MediaPipelineDeviceParams params(sync_type, backend_task_runner_.get()); 64 MediaPipelineDeviceParams params(sync_type, backend_task_runner_.get());
66 scoped_ptr<MediaPipelineBackend> backend( 65 scoped_ptr<MediaPipelineBackend> backend = create_backend_cb_.Run(params);
67 pipeline_client_->CreateMediaPipelineBackend(params));
68 66
69 // Create pipeline. 67 // Create pipeline.
70 MediaPipelineClient pipeline_client; 68 MediaPipelineClient pipeline_client;
71 pipeline_client.error_cb = error_cb; 69 pipeline_client.error_cb = error_cb;
72 pipeline_client.buffering_state_cb = buffering_state_cb; 70 pipeline_client.buffering_state_cb = buffering_state_cb;
73 pipeline_client.pipeline_backend_created_cb = base::Bind(
74 &CmaMediaPipelineClient::OnMediaPipelineBackendCreated, pipeline_client_);
75 pipeline_client.pipeline_backend_destroyed_cb =
76 base::Bind(&CmaMediaPipelineClient::OnMediaPipelineBackendDestroyed,
77 pipeline_client_);
78 pipeline_.reset(new MediaPipelineImpl); 71 pipeline_.reset(new MediaPipelineImpl);
79 pipeline_->SetClient(pipeline_client); 72 pipeline_->SetClient(pipeline_client);
80 pipeline_->Initialize(load_type, std::move(backend)); 73 pipeline_->Initialize(load_type, std::move(backend));
81 74
82 // Initialize audio. 75 // Initialize audio.
83 ::media::DemuxerStream* audio_stream = 76 ::media::DemuxerStream* audio_stream =
84 demuxer_stream_provider->GetStream(::media::DemuxerStream::AUDIO); 77 demuxer_stream_provider->GetStream(::media::DemuxerStream::AUDIO);
85 if (audio_stream) { 78 if (audio_stream) {
86 AvPipelineClient audio_client; 79 AvPipelineClient audio_client;
87 audio_client.wait_for_key_cb = waiting_for_decryption_key_cb; 80 audio_client.wait_for_key_cb = waiting_for_decryption_key_cb;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 DCHECK(!eos_[stream]); 173 DCHECK(!eos_[stream]);
181 eos_[stream] = true; 174 eos_[stream] = true;
182 CMALOG(kLogControl) << __FUNCTION__ << ": eos_audio=" << eos_[STREAM_AUDIO] 175 CMALOG(kLogControl) << __FUNCTION__ << ": eos_audio=" << eos_[STREAM_AUDIO]
183 << " eos_video=" << eos_[STREAM_VIDEO]; 176 << " eos_video=" << eos_[STREAM_VIDEO];
184 if (eos_[STREAM_AUDIO] && eos_[STREAM_VIDEO]) 177 if (eos_[STREAM_AUDIO] && eos_[STREAM_VIDEO])
185 ended_cb_.Run(); 178 ended_cb_.Run();
186 } 179 }
187 180
188 } // namespace media 181 } // namespace media
189 } // namespace chromecast 182 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/media/cast_renderer.h ('k') | chromecast/browser/media/cma_message_filter_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698