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

Side by Side Diff: remoting/codec/video_decoder_vpx.cc

Issue 609923004: Cleanup usage of scoped_ptr<> in remoting for C++11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/codec/video_decoder_vpx.h" 5 #include "remoting/codec/video_decoder_vpx.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // TODO(hclam): Scale the number of threads with number of cores of the 49 // TODO(hclam): Scale the number of threads with number of cores of the
50 // machine. 50 // machine.
51 vpx_codec_dec_cfg config; 51 vpx_codec_dec_cfg config;
52 config.w = 0; 52 config.w = 0;
53 config.h = 0; 53 config.h = 0;
54 config.threads = 2; 54 config.threads = 2;
55 vpx_codec_err_t ret = 55 vpx_codec_err_t ret =
56 vpx_codec_dec_init(codec.get(), vpx_codec_vp8_dx(), &config, 0); 56 vpx_codec_dec_init(codec.get(), vpx_codec_vp8_dx(), &config, 0);
57 if (ret != VPX_CODEC_OK) { 57 if (ret != VPX_CODEC_OK) {
58 LOG(ERROR) << "Cannot initialize codec."; 58 LOG(ERROR) << "Cannot initialize codec.";
59 return scoped_ptr<VideoDecoderVpx>(); 59 return nullptr;
60 } 60 }
61 61
62 return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass())); 62 return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
63 } 63 }
64 64
65 // static 65 // static
66 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() { 66 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
67 ScopedVpxCodec codec(new vpx_codec_ctx_t); 67 ScopedVpxCodec codec(new vpx_codec_ctx_t);
68 68
69 // TODO(hclam): Scale the number of threads with number of cores of the 69 // TODO(hclam): Scale the number of threads with number of cores of the
70 // machine. 70 // machine.
71 vpx_codec_dec_cfg config; 71 vpx_codec_dec_cfg config;
72 config.w = 0; 72 config.w = 0;
73 config.h = 0; 73 config.h = 0;
74 config.threads = 2; 74 config.threads = 2;
75 vpx_codec_err_t ret = 75 vpx_codec_err_t ret =
76 vpx_codec_dec_init(codec.get(), vpx_codec_vp9_dx(), &config, 0); 76 vpx_codec_dec_init(codec.get(), vpx_codec_vp9_dx(), &config, 0);
77 if (ret != VPX_CODEC_OK) { 77 if (ret != VPX_CODEC_OK) {
78 LOG(ERROR) << "Cannot initialize codec."; 78 LOG(ERROR) << "Cannot initialize codec.";
79 return scoped_ptr<VideoDecoderVpx>(); 79 return nullptr;
80 } 80 }
81 81
82 return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass())); 82 return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
83 } 83 }
84 84
85 VideoDecoderVpx::~VideoDecoderVpx() {} 85 VideoDecoderVpx::~VideoDecoderVpx() {}
86 86
87 void VideoDecoderVpx::Initialize(const webrtc::DesktopSize& screen_size) { 87 void VideoDecoderVpx::Initialize(const webrtc::DesktopSize& screen_size) {
88 DCHECK(!screen_size.is_empty()); 88 DCHECK(!screen_size.is_empty());
89 89
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 webrtc::DesktopRegion difference = *new_desktop_shape; 346 webrtc::DesktopRegion difference = *new_desktop_shape;
347 difference.Subtract(desktop_shape_); 347 difference.Subtract(desktop_shape_);
348 updated_region_.AddRegion(difference); 348 updated_region_.AddRegion(difference);
349 updated_region_.IntersectWith(*new_desktop_shape); 349 updated_region_.IntersectWith(*new_desktop_shape);
350 350
351 // Set the new desktop shape region. 351 // Set the new desktop shape region.
352 desktop_shape_.Swap(new_desktop_shape); 352 desktop_shape_.Swap(new_desktop_shape);
353 } 353 }
354 354
355 } // namespace remoting 355 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698