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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 if (!vpx_image_alpha) { | 425 if (!vpx_image_alpha) { |
426 *video_frame = NULL; | 426 *video_frame = NULL; |
427 return true; | 427 return true; |
428 } | 428 } |
429 | 429 |
430 if (vpx_image_alpha->user_priv != | 430 if (vpx_image_alpha->user_priv != |
431 reinterpret_cast<void*>(×tamp_alpha)) { | 431 reinterpret_cast<void*>(×tamp_alpha)) { |
432 LOG(ERROR) << "Invalid output timestamp on alpha."; | 432 LOG(ERROR) << "Invalid output timestamp on alpha."; |
433 return false; | 433 return false; |
434 } | 434 } |
| 435 |
| 436 if (vpx_image_alpha->d_h != vpx_image->d_h || |
| 437 vpx_image_alpha->d_w != vpx_image->d_w) { |
| 438 LOG(ERROR) << "The alpha plane dimensions are not the same as the " |
| 439 "image dimensions."; |
| 440 return false; |
| 441 } |
435 } | 442 } |
436 } | 443 } |
437 | 444 |
438 CopyVpxImageTo(vpx_image, vpx_image_alpha, video_frame); | 445 CopyVpxImageTo(vpx_image, vpx_image_alpha, video_frame); |
439 (*video_frame)->set_timestamp(base::TimeDelta::FromMicroseconds(timestamp)); | 446 (*video_frame)->set_timestamp(base::TimeDelta::FromMicroseconds(timestamp)); |
440 return true; | 447 return true; |
441 } | 448 } |
442 | 449 |
443 void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image, | 450 void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image, |
444 const struct vpx_image* vpx_image_alpha, | 451 const struct vpx_image* vpx_image_alpha, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 uv_rows, | 503 uv_rows, |
497 video_frame->get()); | 504 video_frame->get()); |
498 if (!vpx_codec_alpha_) | 505 if (!vpx_codec_alpha_) |
499 return; | 506 return; |
500 if (!vpx_image_alpha) { | 507 if (!vpx_image_alpha) { |
501 MakeOpaqueAPlane( | 508 MakeOpaqueAPlane( |
502 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 509 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
503 return; | 510 return; |
504 } | 511 } |
505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 512 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
506 vpx_image->stride[VPX_PLANE_Y], | 513 vpx_image_alpha->stride[VPX_PLANE_Y], |
507 vpx_image->d_h, | 514 vpx_image_alpha->d_h, |
508 video_frame->get()); | 515 video_frame->get()); |
509 } | 516 } |
510 | 517 |
511 } // namespace media | 518 } // namespace media |
OLD | NEW |