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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
« no previous file with comments | « remoting/codec/video_decoder_vpx.h ('k') | remoting/codec/video_decoder_vpx_unittest.cc » ('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 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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h"
11 #include "remoting/base/util.h" 12 #include "remoting/base/util.h"
12 #include "remoting/proto/video.pb.h" 13 #include "remoting/proto/video.pb.h"
13 #include "third_party/libyuv/include/libyuv/convert_argb.h" 14 #include "third_party/libyuv/include/libyuv/convert_argb.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 15 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 16 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
16 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" 17 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
17 18
18 extern "C" { 19 extern "C" {
19 #define VPX_CODEC_DISABLE_COMPAT 1 20 #define VPX_CODEC_DISABLE_COMPAT 1
20 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" 21 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 default: { 62 default: {
62 LOG(ERROR) << "Unsupported image format:" << image->fmt; 63 LOG(ERROR) << "Unsupported image format:" << image->fmt;
63 return; 64 return;
64 } 65 }
65 } 66 }
66 } 67 }
67 68
68 } // namespace 69 } // namespace
69 70
70 // static 71 // static
71 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() { 72 std::unique_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() {
72 return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp8_dx())); 73 return base::WrapUnique(new VideoDecoderVpx(vpx_codec_vp8_dx()));
73 } 74 }
74 75
75 // static 76 // static
76 scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() { 77 std::unique_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
77 return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp9_dx())); 78 return base::WrapUnique(new VideoDecoderVpx(vpx_codec_vp9_dx()));
78 } 79 }
79 80
80 VideoDecoderVpx::~VideoDecoderVpx() {} 81 VideoDecoderVpx::~VideoDecoderVpx() {}
81 82
82 bool VideoDecoderVpx::DecodePacket(const VideoPacket& packet, 83 bool VideoDecoderVpx::DecodePacket(const VideoPacket& packet,
83 webrtc::DesktopFrame* frame) { 84 webrtc::DesktopFrame* frame) {
84 // Pass the packet to the codec to process. 85 // Pass the packet to the codec to process.
85 vpx_codec_err_t ret = vpx_codec_decode( 86 vpx_codec_err_t ret = vpx_codec_decode(
86 codec_.get(), reinterpret_cast<const uint8_t*>(packet.data().data()), 87 codec_.get(), reinterpret_cast<const uint8_t*>(packet.data().data()),
87 packet.data().size(), nullptr, 0); 88 packet.data().size(), nullptr, 0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 vpx_codec_dec_cfg config; 127 vpx_codec_dec_cfg config;
127 config.w = 0; 128 config.w = 0;
128 config.h = 0; 129 config.h = 0;
129 config.threads = 2; 130 config.threads = 2;
130 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0); 131 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0);
131 CHECK_EQ(VPX_CODEC_OK, ret); 132 CHECK_EQ(VPX_CODEC_OK, ret);
132 } 133 }
133 134
134 } // namespace remoting 135 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/codec/video_decoder_vpx.h ('k') | remoting/codec/video_decoder_vpx_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698