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

Side by Side Diff: remoting/codec/video_encoder_vpx.h

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_encoder_verbatim_unittest.cc ('k') | remoting/codec/video_encoder_vpx.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 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ 6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/time/default_tick_clock.h" 12 #include "base/time/default_tick_clock.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "remoting/codec/scoped_vpx_codec.h" 14 #include "remoting/codec/scoped_vpx_codec.h"
15 #include "remoting/codec/video_encoder.h" 15 #include "remoting/codec/video_encoder.h"
16 #include "remoting/codec/video_encoder_helper.h" 16 #include "remoting/codec/video_encoder_helper.h"
17 17
18 typedef struct vpx_image vpx_image_t; 18 typedef struct vpx_image vpx_image_t;
19 19
20 namespace webrtc { 20 namespace webrtc {
21 class DesktopRegion; 21 class DesktopRegion;
22 class DesktopSize; 22 class DesktopSize;
23 } // namespace webrtc 23 } // namespace webrtc
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 class VideoEncoderVpx : public VideoEncoder { 27 class VideoEncoderVpx : public VideoEncoder {
28 public: 28 public:
29 // Create encoder for the specified protocol. 29 // Create encoder for the specified protocol.
30 static scoped_ptr<VideoEncoderVpx> CreateForVP8(); 30 static std::unique_ptr<VideoEncoderVpx> CreateForVP8();
31 static scoped_ptr<VideoEncoderVpx> CreateForVP9(); 31 static std::unique_ptr<VideoEncoderVpx> CreateForVP9();
32 32
33 ~VideoEncoderVpx() override; 33 ~VideoEncoderVpx() override;
34 34
35 void SetTickClockForTests(base::TickClock* tick_clock); 35 void SetTickClockForTests(base::TickClock* tick_clock);
36 36
37 // VideoEncoder interface. 37 // VideoEncoder interface.
38 void SetLosslessEncode(bool want_lossless) override; 38 void SetLosslessEncode(bool want_lossless) override;
39 void SetLosslessColor(bool want_lossless) override; 39 void SetLosslessColor(bool want_lossless) override;
40 scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override; 40 std::unique_ptr<VideoPacket> Encode(
41 const webrtc::DesktopFrame& frame) override;
41 42
42 private: 43 private:
43 explicit VideoEncoderVpx(bool use_vp9); 44 explicit VideoEncoderVpx(bool use_vp9);
44 45
45 // (Re)Configures this instance to encode frames of the specified |size|, 46 // (Re)Configures this instance to encode frames of the specified |size|,
46 // with the configured lossless color & encoding modes. 47 // with the configured lossless color & encoding modes.
47 void Configure(const webrtc::DesktopSize& size); 48 void Configure(const webrtc::DesktopSize& size);
48 49
49 // Prepares |image_| for encoding. Writes updated rectangles into 50 // Prepares |image_| for encoding. Writes updated rectangles into
50 // |updated_region|. 51 // |updated_region|.
(...skipping 16 matching lines...) Expand all
67 bool lossless_encode_ = false; 68 bool lossless_encode_ = false;
68 bool lossless_color_ = false; 69 bool lossless_color_ = false;
69 70
70 // Holds the initialized & configured codec. 71 // Holds the initialized & configured codec.
71 ScopedVpxCodec codec_; 72 ScopedVpxCodec codec_;
72 73
73 // Used to generate zero-based frame timestamps. 74 // Used to generate zero-based frame timestamps.
74 base::TimeTicks timestamp_base_; 75 base::TimeTicks timestamp_base_;
75 76
76 // VPX image and buffer to hold the actual YUV planes. 77 // VPX image and buffer to hold the actual YUV planes.
77 scoped_ptr<vpx_image_t> image_; 78 std::unique_ptr<vpx_image_t> image_;
78 scoped_ptr<uint8_t[]> image_buffer_; 79 std::unique_ptr<uint8_t[]> image_buffer_;
79 80
80 // Active map used to optimize out processing of un-changed macroblocks. 81 // Active map used to optimize out processing of un-changed macroblocks.
81 scoped_ptr<uint8_t[]> active_map_; 82 std::unique_ptr<uint8_t[]> active_map_;
82 webrtc::DesktopSize active_map_size_; 83 webrtc::DesktopSize active_map_size_;
83 84
84 // True if the codec wants unchanged frames to finish topping-off with. 85 // True if the codec wants unchanged frames to finish topping-off with.
85 bool encode_unchanged_frame_; 86 bool encode_unchanged_frame_;
86 87
87 // Used to help initialize VideoPackets from DesktopFrames. 88 // Used to help initialize VideoPackets from DesktopFrames.
88 VideoEncoderHelper helper_; 89 VideoEncoderHelper helper_;
89 90
90 base::DefaultTickClock default_tick_clock_; 91 base::DefaultTickClock default_tick_clock_;
91 base::TickClock* clock_; 92 base::TickClock* clock_;
92 93
93 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx); 94 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx);
94 }; 95 };
95 96
96 } // namespace remoting 97 } // namespace remoting
97 98
98 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ 99 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_
OLDNEW
« no previous file with comments | « remoting/codec/video_encoder_verbatim_unittest.cc ('k') | remoting/codec/video_encoder_vpx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698