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

Side by Side Diff: webrtc/modules/video_coding/main/source/generic_encoder.h

Issue 1426953003: Remove redudant encoder rate calls. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove redundant function Created 5 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
13 13
14 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" 14 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
15 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" 15 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
16 16
17 #include <stdio.h> 17 #include <stdio.h>
18 18
19 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
20 #include "webrtc/base/scoped_ptr.h" 20 #include "webrtc/base/scoped_ptr.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 class CriticalSectionWrapper; 23 class CriticalSectionWrapper;
24 24
25 namespace media_optimization { 25 namespace media_optimization {
26 class MediaOptimization; 26 class MediaOptimization;
27 } // namespace media_optimization 27 } // namespace media_optimization
28 28
29 struct EncoderParameters {
30 uint32_t target_bitrate;
31 uint8_t loss_rate;
32 int64_t rtt;
33 uint32_t input_frame_rate;
34 };
35
29 /*************************************/ 36 /*************************************/
30 /* VCMEncodeFrameCallback class */ 37 /* VCMEncodeFrameCallback class */
31 /***********************************/ 38 /***********************************/
32 class VCMEncodedFrameCallback : public EncodedImageCallback 39 class VCMEncodedFrameCallback : public EncodedImageCallback
33 { 40 {
34 public: 41 public:
35 VCMEncodedFrameCallback(EncodedImageCallback* post_encode_callback); 42 VCMEncodedFrameCallback(EncodedImageCallback* post_encode_callback);
36 virtual ~VCMEncodedFrameCallback(); 43 virtual ~VCMEncodedFrameCallback();
37 44
38 /* 45 /*
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 /** 102 /**
96 * Encode raw image 103 * Encode raw image
97 * inputFrame : Frame containing raw image 104 * inputFrame : Frame containing raw image
98 * codecSpecificInfo : Specific codec data 105 * codecSpecificInfo : Specific codec data
99 * cameraFrameRate : Request or information from the remote side 106 * cameraFrameRate : Request or information from the remote side
100 * frameType : The requested frame type to encode 107 * frameType : The requested frame type to encode
101 */ 108 */
102 int32_t Encode(const VideoFrame& inputFrame, 109 int32_t Encode(const VideoFrame& inputFrame,
103 const CodecSpecificInfo* codecSpecificInfo, 110 const CodecSpecificInfo* codecSpecificInfo,
104 const std::vector<FrameType>& frameTypes); 111 const std::vector<FrameType>& frameTypes);
105 /** 112
106 * Set new target bitrate (bits/s) and framerate. 113 void SetEncoderParameters(const EncoderParameters& params);
107 * Return Value: new bit rate if OK, otherwise <0s.
108 */
109 // TODO(tommi): We could replace BitRate and FrameRate below with a GetRates
110 // method that matches SetRates. For fetching current rates, we'd then only
111 // grab the lock once instead of twice.
112 int32_t SetRates(uint32_t target_bitrate, uint32_t frameRate);
113 /**
114 * Set a new packet loss rate and a new round-trip time in milliseconds.
115 */
116 int32_t SetChannelParameters(int32_t packetLoss, int64_t rtt);
117 int32_t CodecConfigParameters(uint8_t* buffer, int32_t size);
118 /** 114 /**
119 * Register a transport callback which will be called to deliver the encoded 115 * Register a transport callback which will be called to deliver the encoded
120 * buffers 116 * buffers
121 */ 117 */
122 int32_t RegisterEncodeCallback( 118 int32_t RegisterEncodeCallback(
123 VCMEncodedFrameCallback* VCMencodedFrameCallback); 119 VCMEncodedFrameCallback* VCMencodedFrameCallback);
124 /** 120
125 * Get encoder bit rate 121 EncoderParameters GetEncoderParameters() const;
126 */
127 uint32_t BitRate() const;
128 /**
129 * Get encoder frame rate
130 */
131 uint32_t FrameRate() const;
132 122
133 int32_t SetPeriodicKeyFrames(bool enable); 123 int32_t SetPeriodicKeyFrames(bool enable);
134 124
135 int32_t RequestFrame(const std::vector<FrameType>& frame_types); 125 int32_t RequestFrame(const std::vector<FrameType>& frame_types);
136 126
137 bool InternalSource() const; 127 bool InternalSource() const;
138 128
139 void OnDroppedFrame(); 129 void OnDroppedFrame();
140 130
141 bool SupportsNativeHandle() const; 131 bool SupportsNativeHandle() const;
142 132
143 int GetTargetFramerate(); 133 int GetTargetFramerate();
144 134
145 private: 135 private:
146 VideoEncoder* const encoder_; 136 VideoEncoder* const encoder_;
147 VideoEncoderRateObserver* const rate_observer_; 137 VideoEncoderRateObserver* const rate_observer_;
148 VCMEncodedFrameCallback* vcm_encoded_frame_callback_; 138 VCMEncodedFrameCallback* vcm_encoded_frame_callback_;
149 uint32_t bit_rate_; 139 EncoderParameters encoder_params_ GUARDED_BY(params_lock_);
150 uint32_t frame_rate_;
151 const bool internal_source_; 140 const bool internal_source_;
152 mutable rtc::CriticalSection rates_lock_; 141 mutable rtc::CriticalSection params_lock_;
153 VideoRotation rotation_; 142 VideoRotation rotation_;
154 bool is_screenshare_; 143 bool is_screenshare_;
155 }; // end of VCMGenericEncoder class 144 }; // end of VCMGenericEncoder class
156 145
157 } // namespace webrtc 146 } // namespace webrtc
158 147
159 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 148 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/main/interface/video_coding.h ('k') | webrtc/modules/video_coding/main/source/generic_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698