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

Side by Side Diff: media/cast/sender/vp8_encoder.h

Issue 2113783002: Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mek's comment. Created 4 years, 5 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 | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/sender/vp8_encoder.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MEDIA_CAST_SENDER_VP8_ENCODER_H_ 5 #ifndef MEDIA_CAST_SENDER_VP8_ENCODER_H_
6 #define MEDIA_CAST_SENDER_VP8_ENCODER_H_ 6 #define MEDIA_CAST_SENDER_VP8_ENCODER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "media/capture/content/feedback_signal_accumulator.h" 14 #include "media/capture/content/feedback_signal_accumulator.h"
15 #include "media/cast/cast_config.h" 15 #include "media/cast/cast_config.h"
16 #include "media/cast/sender/software_video_encoder.h" 16 #include "media/cast/sender/software_video_encoder.h"
17 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" 17 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h"
18 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
19 19
20 namespace media { 20 namespace media {
21 class VideoFrame; 21 class VideoFrame;
22 } 22 }
23 23
24 namespace media { 24 namespace media {
25 namespace cast { 25 namespace cast {
26 26
27 class Vp8Encoder : public SoftwareVideoEncoder { 27 class Vp8Encoder : public SoftwareVideoEncoder {
28 public: 28 public:
29 explicit Vp8Encoder(const VideoSenderConfig& video_config); 29 explicit Vp8Encoder(const FrameSenderConfig& video_config);
30 30
31 ~Vp8Encoder() final; 31 ~Vp8Encoder() final;
32 32
33 // SoftwareVideoEncoder implementations. 33 // SoftwareVideoEncoder implementations.
34 void Initialize() final; 34 void Initialize() final;
35 void Encode(const scoped_refptr<media::VideoFrame>& video_frame, 35 void Encode(const scoped_refptr<media::VideoFrame>& video_frame,
36 const base::TimeTicks& reference_time, 36 const base::TimeTicks& reference_time,
37 SenderEncodedFrame* encoded_frame) final; 37 SenderEncodedFrame* encoded_frame) final;
38 void UpdateRates(uint32_t new_bitrate) final; 38 void UpdateRates(uint32_t new_bitrate) final;
39 void GenerateKeyFrame() final; 39 void GenerateKeyFrame() final;
40 40
41 private: 41 private:
42 bool is_initialized() const { 42 bool is_initialized() const {
43 // ConfigureForNewFrameSize() sets the timebase denominator value to 43 // ConfigureForNewFrameSize() sets the timebase denominator value to
44 // non-zero if the encoder is successfully initialized, and it is zero 44 // non-zero if the encoder is successfully initialized, and it is zero
45 // otherwise. 45 // otherwise.
46 return config_.g_timebase.den != 0; 46 return config_.g_timebase.den != 0;
47 } 47 }
48 48
49 // If the |encoder_| is live, attempt reconfiguration to allow it to encode 49 // If the |encoder_| is live, attempt reconfiguration to allow it to encode
50 // frames at a new |frame_size|. Otherwise, tear it down and re-create a new 50 // frames at a new |frame_size|. Otherwise, tear it down and re-create a new
51 // |encoder_| instance. 51 // |encoder_| instance.
52 void ConfigureForNewFrameSize(const gfx::Size& frame_size); 52 void ConfigureForNewFrameSize(const gfx::Size& frame_size);
53 53
54 const VideoSenderConfig cast_config_; 54 const FrameSenderConfig cast_config_;
55 55
56 const double target_encoder_utilization_; 56 const double target_encoder_utilization_;
57 57
58 // VP8 internal objects. These are valid for use only while is_initialized() 58 // VP8 internal objects. These are valid for use only while is_initialized()
59 // returns true. 59 // returns true.
60 vpx_codec_enc_cfg_t config_; 60 vpx_codec_enc_cfg_t config_;
61 vpx_codec_ctx_t encoder_; 61 vpx_codec_ctx_t encoder_;
62 62
63 // Set to true to request the next frame emitted by Vp8Encoder be a key frame. 63 // Set to true to request the next frame emitted by Vp8Encoder be a key frame.
64 bool key_frame_requested_; 64 bool key_frame_requested_;
(...skipping 23 matching lines...) Expand all
88 // The higher the speed, the less CPU usage, and the lower quality. 88 // The higher the speed, the less CPU usage, and the lower quality.
89 int encoding_speed_; 89 int encoding_speed_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder); 91 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder);
92 }; 92 };
93 93
94 } // namespace cast 94 } // namespace cast
95 } // namespace media 95 } // namespace media
96 96
97 #endif // MEDIA_CAST_SENDER_VP8_ENCODER_H_ 97 #endif // MEDIA_CAST_SENDER_VP8_ENCODER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/sender/vp8_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698