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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.cc

Issue 2477233004: Update VideoFrameBuffer-related methods to not use references to scoped_refptr. (Closed)
Patch Set: Fix memory leak. Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 // Check if codec size is different from native/original size, and if so, 328 // Check if codec size is different from native/original size, and if so,
329 // upsample back to original size: needed for PSNR and SSIM computations. 329 // upsample back to original size: needed for PSNR and SSIM computations.
330 if (image.width() != config_.codec_settings->width || 330 if (image.width() != config_.codec_settings->width ||
331 image.height() != config_.codec_settings->height) { 331 image.height() != config_.codec_settings->height) {
332 rtc::scoped_refptr<I420Buffer> up_image( 332 rtc::scoped_refptr<I420Buffer> up_image(
333 I420Buffer::Create(config_.codec_settings->width, 333 I420Buffer::Create(config_.codec_settings->width,
334 config_.codec_settings->height)); 334 config_.codec_settings->height));
335 335
336 // Should be the same aspect ratio, no cropping needed. 336 // Should be the same aspect ratio, no cropping needed.
337 up_image->ScaleFrom(image.video_frame_buffer()); 337 up_image->ScaleFrom(*image.video_frame_buffer());
338 338
339 // TODO(mikhal): Extracting the buffer for now - need to update test. 339 // TODO(mikhal): Extracting the buffer for now - need to update test.
340 size_t length = 340 size_t length =
341 CalcBufferSize(kI420, up_image->width(), up_image->height()); 341 CalcBufferSize(kI420, up_image->width(), up_image->height());
342 std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]); 342 std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
343 int extracted_length = ExtractBuffer(up_image, length, image_buffer.get()); 343 int extracted_length = ExtractBuffer(up_image, length, image_buffer.get());
344 assert(extracted_length > 0); 344 assert(extracted_length > 0);
345 // Update our copy of the last successful frame: 345 // Update our copy of the last successful frame:
346 memcpy(last_successful_frame_buffer_, image_buffer.get(), extracted_length); 346 memcpy(last_successful_frame_buffer_, image_buffer.get(), extracted_length);
347 bool write_success = frame_writer_->WriteFrame(image_buffer.get()); 347 bool write_success = frame_writer_->WriteFrame(image_buffer.get());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 int32_t VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded( 420 int32_t VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
421 VideoFrame& image) { 421 VideoFrame& image) {
422 // Forward to parent class. 422 // Forward to parent class.
423 video_processor_->FrameDecoded(image); 423 video_processor_->FrameDecoded(image);
424 return 0; 424 return 0;
425 } 425 }
426 426
427 } // namespace test 427 } // namespace test
428 } // namespace webrtc 428 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698