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

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

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « remoting/codec/video_encoder_verbatim.cc ('k') | remoting/codec/video_encoder_vp8.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 (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 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VP8_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ 6 #define REMOTING_CODEC_VIDEO_ENCODER_VP8_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "remoting/codec/video_encoder.h" 9 #include "remoting/codec/video_encoder.h"
10 #include "third_party/skia/include/core/SkRegion.h" 10 #include "third_party/skia/include/core/SkRegion.h"
11 11
12 typedef struct vpx_codec_ctx vpx_codec_ctx_t; 12 typedef struct vpx_codec_ctx vpx_codec_ctx_t;
13 typedef struct vpx_image vpx_image_t; 13 typedef struct vpx_image vpx_image_t;
14 14
15 namespace webrtc {
16 class DesktopSize;
17 } // namespace webrtc
18
15 namespace remoting { 19 namespace remoting {
16 20
17 // A class that uses VP8 to perform encoding. 21 // A class that uses VP8 to perform encoding.
18 class VideoEncoderVp8 : public VideoEncoder { 22 class VideoEncoderVp8 : public VideoEncoder {
19 public: 23 public:
20 VideoEncoderVp8(); 24 VideoEncoderVp8();
21 virtual ~VideoEncoderVp8(); 25 virtual ~VideoEncoderVp8();
22 26
27 // VideoEncoder interface.
23 virtual void Encode( 28 virtual void Encode(
24 scoped_refptr<media::ScreenCaptureData> capture_data, 29 const webrtc::DesktopFrame* frame,
25 bool key_frame,
26 const DataAvailableCallback& data_available_callback) OVERRIDE; 30 const DataAvailableCallback& data_available_callback) OVERRIDE;
27 31
28 private: 32 private:
29 FRIEND_TEST_ALL_PREFIXES(VideoEncoderVp8Test, AlignAndClipRect); 33 FRIEND_TEST_ALL_PREFIXES(VideoEncoderVp8Test, AlignAndClipRect);
30 34
31 // Initialize the encoder. Returns true if successful. 35 // Initialize the encoder. Returns true if successful.
32 bool Init(const SkISize& size); 36 bool Init(const webrtc::DesktopSize& size);
33 37
34 // Destroy the encoder. 38 // Destroy the encoder.
35 void Destroy(); 39 void Destroy();
36 40
37 // Prepare |image_| for encoding. Write updated rectangles into 41 // Prepare |image_| for encoding. Write updated rectangles into
38 // |updated_region|. 42 // |updated_region|.
39 void PrepareImage(scoped_refptr<media::ScreenCaptureData> capture_data, 43 //
44 // TODO(sergeyu): Update this code to use webrtc::DesktopRegion.
45 void PrepareImage(const webrtc::DesktopFrame* frame,
40 SkRegion* updated_region); 46 SkRegion* updated_region);
41 47
42 // Update the active map according to |updated_region|. Active map is then 48 // Update the active map according to |updated_region|. Active map is then
43 // given to the encoder to speed up encoding. 49 // given to the encoder to speed up encoding.
44 void PrepareActiveMap(const SkRegion& updated_region); 50 void PrepareActiveMap(const SkRegion& updated_region);
45 51
46 // True if the encoder is initialized. 52 // True if the encoder is initialized.
47 bool initialized_; 53 bool initialized_;
48 54
49 scoped_ptr<vpx_codec_ctx_t> codec_; 55 scoped_ptr<vpx_codec_ctx_t> codec_;
50 scoped_ptr<vpx_image_t> image_; 56 scoped_ptr<vpx_image_t> image_;
51 scoped_ptr<uint8[]> active_map_; 57 scoped_ptr<uint8[]> active_map_;
52 int active_map_width_; 58 int active_map_width_;
53 int active_map_height_; 59 int active_map_height_;
54 int last_timestamp_; 60 int last_timestamp_;
55 61
56 // Buffer for storing the yuv image. 62 // Buffer for storing the yuv image.
57 scoped_ptr<uint8[]> yuv_image_; 63 scoped_ptr<uint8[]> yuv_image_;
58 64
59 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVp8); 65 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVp8);
60 }; 66 };
61 67
62 } // namespace remoting 68 } // namespace remoting
63 69
64 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ 70 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_
OLDNEW
« no previous file with comments | « remoting/codec/video_encoder_verbatim.cc ('k') | remoting/codec/video_encoder_vp8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698