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

Side by Side Diff: media/filters/vpx_video_decoder.cc

Issue 1143223007: media: Reland "Simplify {Audio|Video}Decoder initialization callback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « media/filters/vpx_video_decoder.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/vpx_video_decoder.h" 5 #include "media/filters/vpx_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 DCHECK(task_runner_->BelongsToCurrentThread()); 202 DCHECK(task_runner_->BelongsToCurrentThread());
203 CloseDecoder(); 203 CloseDecoder();
204 } 204 }
205 205
206 std::string VpxVideoDecoder::GetDisplayName() const { 206 std::string VpxVideoDecoder::GetDisplayName() const {
207 return "VpxVideoDecoder"; 207 return "VpxVideoDecoder";
208 } 208 }
209 209
210 void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config, 210 void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config,
211 bool low_delay, 211 bool low_delay,
212 const PipelineStatusCB& status_cb, 212 const InitCB& init_cb,
213 const OutputCB& output_cb) { 213 const OutputCB& output_cb) {
214 DCHECK(task_runner_->BelongsToCurrentThread()); 214 DCHECK(task_runner_->BelongsToCurrentThread());
215 DCHECK(config.IsValidConfig()); 215 DCHECK(config.IsValidConfig());
216 DCHECK(!config.is_encrypted()); 216 DCHECK(!config.is_encrypted());
217 DCHECK(decode_cb_.is_null()); 217 DCHECK(decode_cb_.is_null());
218 218
219 InitCB bound_init_cb = BindToCurrentLoop(init_cb);
220
219 if (!ConfigureDecoder(config)) { 221 if (!ConfigureDecoder(config)) {
220 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); 222 bound_init_cb.Run(false);
221 return; 223 return;
222 } 224 }
223 225
224 // Success! 226 // Success!
225 config_ = config; 227 config_ = config;
226 state_ = kNormal; 228 state_ = kNormal;
227 output_cb_ = BindToCurrentLoop(output_cb); 229 output_cb_ = BindToCurrentLoop(output_cb);
228 status_cb.Run(PIPELINE_OK); 230 bound_init_cb.Run(true);
229 } 231 }
230 232
231 static vpx_codec_ctx* InitializeVpxContext(vpx_codec_ctx* context, 233 static vpx_codec_ctx* InitializeVpxContext(vpx_codec_ctx* context,
232 const VideoDecoderConfig& config) { 234 const VideoDecoderConfig& config) {
233 context = new vpx_codec_ctx(); 235 context = new vpx_codec_ctx();
234 vpx_codec_dec_cfg_t vpx_config = {0}; 236 vpx_codec_dec_cfg_t vpx_config = {0};
235 vpx_config.w = config.coded_size().width(); 237 vpx_config.w = config.coded_size().width();
236 vpx_config.h = config.coded_size().height(); 238 vpx_config.h = config.coded_size().height();
237 vpx_config.threads = GetThreadCount(config); 239 vpx_config.threads = GetThreadCount(config);
238 240
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 526 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
525 return; 527 return;
526 } 528 }
527 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 529 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
528 vpx_image_alpha->stride[VPX_PLANE_Y], 530 vpx_image_alpha->stride[VPX_PLANE_Y],
529 vpx_image_alpha->d_h, 531 vpx_image_alpha->d_h,
530 video_frame->get()); 532 video_frame->get());
531 } 533 }
532 534
533 } // namespace media 535 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/vpx_video_decoder.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698