| OLD | NEW |
| 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 Loading... |
| 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 InitCB& init_cb, | 212 const PipelineStatusCB& status_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 | |
| 221 if (!ConfigureDecoder(config)) { | 219 if (!ConfigureDecoder(config)) { |
| 222 bound_init_cb.Run(false); | 220 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
| 223 return; | 221 return; |
| 224 } | 222 } |
| 225 | 223 |
| 226 // Success! | 224 // Success! |
| 227 config_ = config; | 225 config_ = config; |
| 228 state_ = kNormal; | 226 state_ = kNormal; |
| 229 output_cb_ = BindToCurrentLoop(output_cb); | 227 output_cb_ = BindToCurrentLoop(output_cb); |
| 230 bound_init_cb.Run(true); | 228 status_cb.Run(PIPELINE_OK); |
| 231 } | 229 } |
| 232 | 230 |
| 233 static vpx_codec_ctx* InitializeVpxContext(vpx_codec_ctx* context, | 231 static vpx_codec_ctx* InitializeVpxContext(vpx_codec_ctx* context, |
| 234 const VideoDecoderConfig& config) { | 232 const VideoDecoderConfig& config) { |
| 235 context = new vpx_codec_ctx(); | 233 context = new vpx_codec_ctx(); |
| 236 vpx_codec_dec_cfg_t vpx_config = {0}; | 234 vpx_codec_dec_cfg_t vpx_config = {0}; |
| 237 vpx_config.w = config.coded_size().width(); | 235 vpx_config.w = config.coded_size().width(); |
| 238 vpx_config.h = config.coded_size().height(); | 236 vpx_config.h = config.coded_size().height(); |
| 239 vpx_config.threads = GetThreadCount(config); | 237 vpx_config.threads = GetThreadCount(config); |
| 240 | 238 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 524 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
| 527 return; | 525 return; |
| 528 } | 526 } |
| 529 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 527 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
| 530 vpx_image_alpha->stride[VPX_PLANE_Y], | 528 vpx_image_alpha->stride[VPX_PLANE_Y], |
| 531 vpx_image_alpha->d_h, | 529 vpx_image_alpha->d_h, |
| 532 video_frame->get()); | 530 video_frame->get()); |
| 533 } | 531 } |
| 534 | 532 |
| 535 } // namespace media | 533 } // namespace media |
| OLD | NEW |