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

Side by Side Diff: chromecast/media/cma/pipeline/video_pipeline_impl.cc

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of review feedback Created 5 years, 4 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/media/cma/pipeline/video_pipeline_impl.h" 5 #include "chromecast/media/cma/pipeline/video_pipeline_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chromecast/media/cma/backend/video_pipeline_device.h"
9 #include "chromecast/media/cma/base/buffering_defs.h" 8 #include "chromecast/media/cma/base/buffering_defs.h"
10 #include "chromecast/media/cma/base/cma_logging.h" 9 #include "chromecast/media/cma/base/cma_logging.h"
11 #include "chromecast/media/cma/base/coded_frame_provider.h" 10 #include "chromecast/media/cma/base/coded_frame_provider.h"
12 #include "chromecast/media/cma/base/decoder_config_adapter.h" 11 #include "chromecast/media/cma/base/decoder_config_adapter.h"
13 #include "chromecast/media/cma/pipeline/av_pipeline_impl.h" 12 #include "chromecast/media/cma/pipeline/av_pipeline_impl.h"
13 #include "chromecast/media/cma/pipeline/video_pipeline_device_client_impl.h"
14 #include "chromecast/public/graphics_types.h"
14 #include "chromecast/public/media/decoder_config.h" 15 #include "chromecast/public/media/decoder_config.h"
16 #include "chromecast/public/media/video_pipeline_device.h"
15 #include "media/base/video_decoder_config.h" 17 #include "media/base/video_decoder_config.h"
16 18
17 namespace chromecast { 19 namespace chromecast {
18 namespace media { 20 namespace media {
19 21
20 namespace { 22 namespace {
21 const size_t kMaxVideoFrameSize = 1024 * 1024; 23 const size_t kMaxVideoFrameSize = 1024 * 1024;
22 } 24 }
23 25
24 VideoPipelineImpl::VideoPipelineImpl(VideoPipelineDevice* video_device) 26 VideoPipelineImpl::VideoPipelineImpl(VideoPipelineDevice* video_device)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 104
103 void VideoPipelineImpl::Initialize( 105 void VideoPipelineImpl::Initialize(
104 const std::vector<::media::VideoDecoderConfig>& configs, 106 const std::vector<::media::VideoDecoderConfig>& configs,
105 scoped_ptr<CodedFrameProvider> frame_provider, 107 scoped_ptr<CodedFrameProvider> frame_provider,
106 const ::media::PipelineStatusCB& status_cb) { 108 const ::media::PipelineStatusCB& status_cb) {
107 DCHECK_GT(configs.size(), 0u); 109 DCHECK_GT(configs.size(), 0u);
108 for (const auto& config : configs) { 110 for (const auto& config : configs) {
109 CMALOG(kLogControl) << __FUNCTION__ << " " 111 CMALOG(kLogControl) << __FUNCTION__ << " "
110 << config.AsHumanReadableString(); 112 << config.AsHumanReadableString();
111 } 113 }
112 VideoPipelineDevice::VideoClient client; 114 video_pipeline_client_.reset(new VideoPipelineDeviceClientImpl(
113 client.natural_size_changed_cb = 115 base::Bind(&VideoPipelineImpl::OnNaturalSizeChanged, weak_this_)));
114 base::Bind(&VideoPipelineImpl::OnNaturalSizeChanged, weak_this_); 116 video_device_->SetVideoClient(video_pipeline_client_.get());
115 video_device_->SetVideoClient(client);
116 if (frame_provider) 117 if (frame_provider)
117 SetCodedFrameProvider(frame_provider.Pass()); 118 SetCodedFrameProvider(frame_provider.Pass());
118 119
119 if (configs.empty()) { 120 if (configs.empty()) {
120 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); 121 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED);
121 return; 122 return;
122 } 123 }
123 DCHECK(configs.size() <= 2); 124 DCHECK(configs.size() <= 2);
124 DCHECK(configs[0].IsValidConfig()); 125 DCHECK(configs[0].IsValidConfig());
125 VideoConfig video_config = 126 VideoConfig video_config =
(...skipping 26 matching lines...) Expand all
152 bool success = video_device_->SetConfig( 153 bool success = video_device_->SetConfig(
153 DecoderConfigAdapter::ToCastVideoConfig(id, video_config)); 154 DecoderConfigAdapter::ToCastVideoConfig(id, video_config));
154 if (!success && 155 if (!success &&
155 !video_client_.av_pipeline_client.playback_error_cb.is_null()) { 156 !video_client_.av_pipeline_client.playback_error_cb.is_null()) {
156 video_client_.av_pipeline_client.playback_error_cb.Run( 157 video_client_.av_pipeline_client.playback_error_cb.Run(
157 ::media::PIPELINE_ERROR_DECODE); 158 ::media::PIPELINE_ERROR_DECODE);
158 } 159 }
159 } 160 }
160 } 161 }
161 162
162 void VideoPipelineImpl::OnNaturalSizeChanged(const gfx::Size& size) { 163 void VideoPipelineImpl::OnNaturalSizeChanged(const Size& size) {
163 if (av_pipeline_impl_->GetState() != AvPipelineImpl::kPlaying) 164 if (av_pipeline_impl_->GetState() != AvPipelineImpl::kPlaying)
164 return; 165 return;
165 166
166 if (!video_client_.natural_size_changed_cb.is_null()) 167 if (!video_client_.natural_size_changed_cb.is_null()) {
167 video_client_.natural_size_changed_cb.Run(size); 168 video_client_.natural_size_changed_cb.Run(
169 gfx::Size(size.width, size.height));
170 }
168 } 171 }
169 172
170 void VideoPipelineImpl::UpdateStatistics() { 173 void VideoPipelineImpl::UpdateStatistics() {
171 if (video_client_.av_pipeline_client.statistics_cb.is_null()) 174 if (video_client_.av_pipeline_client.statistics_cb.is_null())
172 return; 175 return;
173 176
174 MediaComponentDevice::Statistics device_stats; 177 MediaComponentDevice::Statistics device_stats;
175 if (!video_device_->GetStatistics(&device_stats)) 178 if (!video_device_->GetStatistics(&device_stats))
176 return; 179 return;
177 180
(...skipping 10 matching lines...) Expand all
188 delta_stats.video_frames_dropped = 191 delta_stats.video_frames_dropped =
189 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped; 192 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped;
190 193
191 previous_stats_ = current_stats; 194 previous_stats_ = current_stats;
192 195
193 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats); 196 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats);
194 } 197 }
195 198
196 } // namespace media 199 } // namespace media
197 } // namespace chromecast 200 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698