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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 0); | 252 0); |
253 if (status != VPX_CODEC_OK) { | 253 if (status != VPX_CODEC_OK) { |
254 LOG(ERROR) << "vpx_codec_dec_init failed, status=" << status; | 254 LOG(ERROR) << "vpx_codec_dec_init failed, status=" << status; |
255 delete context; | 255 delete context; |
256 return NULL; | 256 return NULL; |
257 } | 257 } |
258 return context; | 258 return context; |
259 } | 259 } |
260 | 260 |
261 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { | 261 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { |
262 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 262 if (config.codec() != kCodecVP8 && config.codec() != kCodecVP9) |
263 bool can_handle = false; | 263 return false; |
264 if (config.codec() == kCodecVP9) | 264 // Only VP8 videos with alpha are handled by VpxVideoDecoder. Everything else |
265 can_handle = true; | 265 // goes to FFmpegVideoDecoder. |
266 if (!cmd_line->HasSwitch(switches::kDisableVp8AlphaPlayback) && | 266 if (config.codec() == kCodecVP8 && config.format() != VideoFrame::YV12A) |
267 config.codec() == kCodecVP8 && config.format() == VideoFrame::YV12A) { | |
268 can_handle = true; | |
269 } | |
270 if (!can_handle) | |
271 return false; | 267 return false; |
272 | 268 |
273 CloseDecoder(); | 269 CloseDecoder(); |
274 | 270 |
275 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); | 271 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); |
276 if (!vpx_codec_) | 272 if (!vpx_codec_) |
277 return false; | 273 return false; |
278 | 274 |
279 // We use our own buffers for VP9 so that there is no need to copy data after | 275 // We use our own buffers for VP9 so that there is no need to copy data after |
280 // decoding. | 276 // decoding. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 527 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
532 return; | 528 return; |
533 } | 529 } |
534 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 530 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
535 vpx_image->stride[VPX_PLANE_Y], | 531 vpx_image->stride[VPX_PLANE_Y], |
536 vpx_image->d_h, | 532 vpx_image->d_h, |
537 video_frame->get()); | 533 video_frame->get()); |
538 } | 534 } |
539 | 535 |
540 } // namespace media | 536 } // namespace media |
OLD | NEW |