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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 *video_frame = VideoFrame::WrapExternalYuvData( | 569 *video_frame = VideoFrame::WrapExternalYuvData( |
570 codec_format, | 570 codec_format, |
571 coded_size, gfx::Rect(visible_size), config_.natural_size(), | 571 coded_size, gfx::Rect(visible_size), config_.natural_size(), |
572 vpx_image->stride[VPX_PLANE_Y], | 572 vpx_image->stride[VPX_PLANE_Y], |
573 vpx_image->stride[VPX_PLANE_U], | 573 vpx_image->stride[VPX_PLANE_U], |
574 vpx_image->stride[VPX_PLANE_V], | 574 vpx_image->stride[VPX_PLANE_V], |
575 vpx_image->planes[VPX_PLANE_Y], | 575 vpx_image->planes[VPX_PLANE_Y], |
576 vpx_image->planes[VPX_PLANE_U], | 576 vpx_image->planes[VPX_PLANE_U], |
577 vpx_image->planes[VPX_PLANE_V], | 577 vpx_image->planes[VPX_PLANE_V], |
578 kNoTimestamp()); | 578 kNoTimestamp()); |
579 video_frame->get()->AddDestructionObserver( | 579 if (video_frame->get()) |
580 memory_pool_->CreateFrameCallback(vpx_image->fb_priv)); | 580 video_frame->get()->AddDestructionObserver( |
| 581 memory_pool_->CreateFrameCallback(vpx_image->fb_priv)); |
581 | 582 |
582 UMA_HISTOGRAM_COUNTS("Media.Vpx.VideoDecoderBuffersInUseByDecoder", | 583 UMA_HISTOGRAM_COUNTS("Media.Vpx.VideoDecoderBuffersInUseByDecoder", |
583 memory_pool_->NumberOfFrameBuffersInUseByDecoder()); | 584 memory_pool_->NumberOfFrameBuffersInUseByDecoder()); |
584 UMA_HISTOGRAM_COUNTS( | 585 UMA_HISTOGRAM_COUNTS( |
585 "Media.Vpx.VideoDecoderBuffersInUseByDecoderAndVideoFrame", | 586 "Media.Vpx.VideoDecoderBuffersInUseByDecoderAndVideoFrame", |
586 memory_pool_->NumberOfFrameBuffersInUseByDecoderAndVideoFrame()); | 587 memory_pool_->NumberOfFrameBuffersInUseByDecoderAndVideoFrame()); |
587 | 588 |
588 return; | 589 return; |
589 } | 590 } |
590 | 591 |
591 DCHECK(codec_format == PIXEL_FORMAT_YV12 || | 592 DCHECK(codec_format == PIXEL_FORMAT_YV12 || |
592 codec_format == PIXEL_FORMAT_YV12A); | 593 codec_format == PIXEL_FORMAT_YV12A); |
593 | 594 |
594 *video_frame = frame_pool_.CreateFrame( | 595 *video_frame = frame_pool_.CreateFrame( |
595 codec_format, visible_size, gfx::Rect(visible_size), | 596 codec_format, visible_size, gfx::Rect(visible_size), |
596 config_.natural_size(), kNoTimestamp()); | 597 config_.natural_size(), kNoTimestamp()); |
597 | 598 if (*video_frame) { |
598 libyuv::I420Copy( | 599 libyuv::I420Copy( |
599 vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y], | 600 vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y], |
600 vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U], | 601 vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U], |
601 vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V], | 602 vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V], |
602 (*video_frame)->visible_data(VideoFrame::kYPlane), | 603 (*video_frame)->visible_data(VideoFrame::kYPlane), |
603 (*video_frame)->stride(VideoFrame::kYPlane), | 604 (*video_frame)->stride(VideoFrame::kYPlane), |
604 (*video_frame)->visible_data(VideoFrame::kUPlane), | 605 (*video_frame)->visible_data(VideoFrame::kUPlane), |
605 (*video_frame)->stride(VideoFrame::kUPlane), | 606 (*video_frame)->stride(VideoFrame::kUPlane), |
606 (*video_frame)->visible_data(VideoFrame::kVPlane), | 607 (*video_frame)->visible_data(VideoFrame::kVPlane), |
607 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), | 608 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), |
608 coded_size.height()); | 609 coded_size.height()); |
| 610 } |
609 } | 611 } |
610 | 612 |
611 } // namespace media | 613 } // namespace media |
OLD | NEW |