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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.h

Issue 2684223002: Use std::unique_ptr in VideoProcessor. (Closed)
Patch Set: address comments Created 3 years, 10 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 | « no previous file | webrtc/modules/video_coding/codecs/test/videoprocessor.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 /* 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
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void SetRates(int bit_rate, int frame_rate) override; 183 void SetRates(int bit_rate, int frame_rate) override;
184 // Return the size of the encoded frame in bytes. 184 // Return the size of the encoded frame in bytes.
185 size_t EncodedFrameSize() override; 185 size_t EncodedFrameSize() override;
186 // Return the encoded frame type (key or delta). 186 // Return the encoded frame type (key or delta).
187 FrameType EncodedFrameType() override; 187 FrameType EncodedFrameType() override;
188 // Return the number of dropped frames. 188 // Return the number of dropped frames.
189 int NumberDroppedFrames() override; 189 int NumberDroppedFrames() override;
190 // Return the number of spatial resizes. 190 // Return the number of spatial resizes.
191 int NumberSpatialResizes() override; 191 int NumberSpatialResizes() override;
192 192
193 webrtc::VideoEncoder* encoder_; 193 webrtc::VideoEncoder* const encoder_;
194 webrtc::VideoDecoder* decoder_; 194 webrtc::VideoDecoder* const decoder_;
195 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; 195 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_;
196 FrameReader* frame_reader_; 196 FrameReader* const frame_reader_;
197 FrameWriter* frame_writer_; 197 FrameWriter* const frame_writer_;
198 PacketManipulator* packet_manipulator_; 198 PacketManipulator* const packet_manipulator_;
199 const TestConfig& config_; 199 const TestConfig& config_;
200 Stats* stats_; 200 Stats* stats_;
201 201
202 EncodedImageCallback* encode_callback_; 202 std::unique_ptr<EncodedImageCallback> encode_callback_;
203 DecodedImageCallback* decode_callback_; 203 std::unique_ptr<DecodedImageCallback> decode_callback_;
204 // Keep track of the last successful frame, since we need to write that 204 // Keep track of the last successful frame, since we need to write that
205 // when decoding fails: 205 // when decoding fails:
206 uint8_t* last_successful_frame_buffer_; 206 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_;
sprang_webrtc 2017/02/09 15:21:19 ..or maybe even an rtc::Buffer? Then we won't have
åsapersson 2017/02/10 08:13:33 Ok will look at it in a separate cl.
207 // To keep track of if we have excluded the first key frame from packet loss: 207 // To keep track of if we have excluded the first key frame from packet loss:
208 bool first_key_frame_has_been_excluded_; 208 bool first_key_frame_has_been_excluded_;
209 // To tell the decoder previous frame have been dropped due to packet loss: 209 // To tell the decoder previous frame have been dropped due to packet loss:
210 bool last_frame_missing_; 210 bool last_frame_missing_;
211 // If Init() has executed successfully. 211 // If Init() has executed successfully.
212 bool initialized_; 212 bool initialized_;
213 size_t encoded_frame_size_; 213 size_t encoded_frame_size_;
214 FrameType encoded_frame_type_; 214 FrameType encoded_frame_type_;
215 int prev_time_stamp_; 215 int prev_time_stamp_;
216 int num_dropped_frames_; 216 int num_dropped_frames_;
(...skipping 11 matching lines...) Expand all
228 : public webrtc::EncodedImageCallback { 228 : public webrtc::EncodedImageCallback {
229 public: 229 public:
230 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) 230 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
231 : video_processor_(vp) {} 231 : video_processor_(vp) {}
232 Result OnEncodedImage( 232 Result OnEncodedImage(
233 const webrtc::EncodedImage& encoded_image, 233 const webrtc::EncodedImage& encoded_image,
234 const webrtc::CodecSpecificInfo* codec_specific_info, 234 const webrtc::CodecSpecificInfo* codec_specific_info,
235 const webrtc::RTPFragmentationHeader* fragmentation) override; 235 const webrtc::RTPFragmentationHeader* fragmentation) override;
236 236
237 private: 237 private:
238 VideoProcessorImpl* video_processor_; 238 VideoProcessorImpl* const video_processor_;
239 }; 239 };
240 240
241 // Callback class required to implement according to the VideoDecoder API. 241 // Callback class required to implement according to the VideoDecoder API.
242 class VideoProcessorDecodeCompleteCallback 242 class VideoProcessorDecodeCompleteCallback
243 : public webrtc::DecodedImageCallback { 243 : public webrtc::DecodedImageCallback {
244 public: 244 public:
245 explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp) 245 explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp)
246 : video_processor_(vp) {} 246 : video_processor_(vp) {}
247 int32_t Decoded(webrtc::VideoFrame& image) override; 247 int32_t Decoded(webrtc::VideoFrame& image) override;
248 int32_t Decoded(webrtc::VideoFrame& image, 248 int32_t Decoded(webrtc::VideoFrame& image,
249 int64_t decode_time_ms) override { 249 int64_t decode_time_ms) override {
250 RTC_NOTREACHED(); 250 RTC_NOTREACHED();
251 return -1; 251 return -1;
252 } 252 }
253 253
254 private: 254 private:
255 VideoProcessorImpl* video_processor_; 255 VideoProcessorImpl* const video_processor_;
256 }; 256 };
257 }; 257 };
258 258
259 } // namespace test 259 } // namespace test
260 } // namespace webrtc 260 } // namespace webrtc
261 261
262 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 262 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/test/videoprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698