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

Side by Side Diff: webrtc/video_encoder.h

Issue 1406903002: Expose codec implementation names in stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: report what we fell back from Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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_VIDEO_ENCODER_H_ 11 #ifndef WEBRTC_VIDEO_ENCODER_H_
12 #define WEBRTC_VIDEO_ENCODER_H_ 12 #define WEBRTC_VIDEO_ENCODER_H_
13 13
14 #include <string>
14 #include <vector> 15 #include <vector>
15 16
16 #include "webrtc/common_types.h" 17 #include "webrtc/common_types.h"
17 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
18 #include "webrtc/video_frame.h" 19 #include "webrtc/video_frame.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 class RTPFragmentationHeader; 23 class RTPFragmentationHeader;
23 // TODO(pbos): Expose these through a public (root) header or change these APIs. 24 // TODO(pbos): Expose these through a public (root) header or change these APIs.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. 121 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
121 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; 122 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0;
122 123
123 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } 124 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; }
124 virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) { 125 virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) {
125 return -1; 126 return -1;
126 } 127 }
127 virtual void OnDroppedFrame() {} 128 virtual void OnDroppedFrame() {}
128 virtual int GetTargetFramerate() { return -1; } 129 virtual int GetTargetFramerate() { return -1; }
129 virtual bool SupportsNativeHandle() const { return false; } 130 virtual bool SupportsNativeHandle() const { return false; }
131 virtual const char* ImplementationName() const { return "unknown"; }
130 }; 132 };
131 133
132 // Class used to wrap external VideoEncoders to provide a fallback option on 134 // Class used to wrap external VideoEncoders to provide a fallback option on
133 // software encoding when a hardware encoder fails to encode a stream due to 135 // software encoding when a hardware encoder fails to encode a stream due to
134 // hardware restrictions, such as max resolution. 136 // hardware restrictions, such as max resolution.
135 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { 137 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
136 public: 138 public:
137 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, 139 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type,
138 webrtc::VideoEncoder* encoder); 140 webrtc::VideoEncoder* encoder);
139 141
140 int32_t InitEncode(const VideoCodec* codec_settings, 142 int32_t InitEncode(const VideoCodec* codec_settings,
141 int32_t number_of_cores, 143 int32_t number_of_cores,
142 size_t max_payload_size) override; 144 size_t max_payload_size) override;
143 145
144 int32_t RegisterEncodeCompleteCallback( 146 int32_t RegisterEncodeCompleteCallback(
145 EncodedImageCallback* callback) override; 147 EncodedImageCallback* callback) override;
146 148
147 int32_t Release() override; 149 int32_t Release() override;
148 int32_t Encode(const VideoFrame& frame, 150 int32_t Encode(const VideoFrame& frame,
149 const CodecSpecificInfo* codec_specific_info, 151 const CodecSpecificInfo* codec_specific_info,
150 const std::vector<FrameType>* frame_types) override; 152 const std::vector<FrameType>* frame_types) override;
151 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; 153 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
152 154
153 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; 155 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override;
154 void OnDroppedFrame() override; 156 void OnDroppedFrame() override;
155 int GetTargetFramerate() override; 157 int GetTargetFramerate() override;
156 bool SupportsNativeHandle() const override; 158 bool SupportsNativeHandle() const override;
159 const char* ImplementationName() const override;
157 160
158 private: 161 private:
159 bool InitFallbackEncoder(); 162 bool InitFallbackEncoder();
160 163
161 // Settings used in the last InitEncode call and used if a dynamic fallback to 164 // Settings used in the last InitEncode call and used if a dynamic fallback to
162 // software is required. 165 // software is required.
163 VideoCodec codec_settings_; 166 VideoCodec codec_settings_;
164 int32_t number_of_cores_; 167 int32_t number_of_cores_;
165 size_t max_payload_size_; 168 size_t max_payload_size_;
166 169
167 // The last bitrate/framerate set, and a flag for noting they are set. 170 // The last bitrate/framerate set, and a flag for noting they are set.
168 bool rates_set_; 171 bool rates_set_;
169 uint32_t bitrate_; 172 uint32_t bitrate_;
170 uint32_t framerate_; 173 uint32_t framerate_;
171 174
172 // The last channel parameters set, and a flag for noting they are set. 175 // The last channel parameters set, and a flag for noting they are set.
173 bool channel_parameters_set_; 176 bool channel_parameters_set_;
174 uint32_t packet_loss_; 177 uint32_t packet_loss_;
175 int64_t rtt_; 178 int64_t rtt_;
176 179
177 const EncoderType encoder_type_; 180 const EncoderType encoder_type_;
178 webrtc::VideoEncoder* const encoder_; 181 webrtc::VideoEncoder* const encoder_;
179 182
180 rtc::scoped_ptr<webrtc::VideoEncoder> fallback_encoder_; 183 rtc::scoped_ptr<webrtc::VideoEncoder> fallback_encoder_;
184 std::string fallback_implementation_name_;
181 EncodedImageCallback* callback_; 185 EncodedImageCallback* callback_;
182 }; 186 };
183 } // namespace webrtc 187 } // namespace webrtc
184 #endif // WEBRTC_VIDEO_ENCODER_H_ 188 #endif // WEBRTC_VIDEO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698