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

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

Issue 101623006: Created VideoFramePool to avoid unnecessary VideoFrame alloc/free. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change SimpleFormatChange test so it can pass on Android. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/vpx_video_decoder.h ('k') | media/media.gyp » ('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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image, 336 void VpxVideoDecoder::CopyVpxImageTo(const vpx_image* vpx_image,
337 const struct vpx_image* vpx_image_alpha, 337 const struct vpx_image* vpx_image_alpha,
338 scoped_refptr<VideoFrame>* video_frame) { 338 scoped_refptr<VideoFrame>* video_frame) {
339 CHECK(vpx_image); 339 CHECK(vpx_image);
340 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 || 340 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 ||
341 vpx_image->fmt == VPX_IMG_FMT_YV12); 341 vpx_image->fmt == VPX_IMG_FMT_YV12);
342 342
343 gfx::Size size(vpx_image->d_w, vpx_image->d_h); 343 gfx::Size size(vpx_image->d_w, vpx_image->d_h);
344 344
345 *video_frame = VideoFrame::CreateFrame( 345 *video_frame = frame_pool_.CreateFrame(
346 vpx_codec_alpha_ ? VideoFrame::YV12A : VideoFrame::YV12, 346 vpx_codec_alpha_ ? VideoFrame::YV12A : VideoFrame::YV12,
347 size, 347 size,
348 gfx::Rect(size), 348 gfx::Rect(size),
349 config_.natural_size(), 349 config_.natural_size(),
350 kNoTimestamp()); 350 kNoTimestamp());
351 351
352 CopyYPlane(vpx_image->planes[VPX_PLANE_Y], 352 CopyYPlane(vpx_image->planes[VPX_PLANE_Y],
353 vpx_image->stride[VPX_PLANE_Y], 353 vpx_image->stride[VPX_PLANE_Y],
354 vpx_image->d_h, 354 vpx_image->d_h,
355 video_frame->get()); 355 video_frame->get());
(...skipping 12 matching lines...) Expand all
368 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 368 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
369 return; 369 return;
370 } 370 }
371 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 371 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
372 vpx_image->stride[VPX_PLANE_Y], 372 vpx_image->stride[VPX_PLANE_Y],
373 vpx_image->d_h, 373 vpx_image->d_h,
374 video_frame->get()); 374 video_frame->get());
375 } 375 }
376 376
377 } // namespace media 377 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/vpx_video_decoder.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698