OLD | NEW |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // packet loss in key non-first keyframes, which is why only the first is | 125 // packet loss in key non-first keyframes, which is why only the first is |
126 // excluded by default. | 126 // excluded by default. |
127 // Packet loss in such important frames is handled on a higher level in the | 127 // Packet loss in such important frames is handled on a higher level in the |
128 // Video Engine, where signaling would request a retransmit of the lost packets, | 128 // Video Engine, where signaling would request a retransmit of the lost packets, |
129 // since they're so important. | 129 // since they're so important. |
130 // | 130 // |
131 // Note this class is not thread safe in any way and is meant for simple testing | 131 // Note this class is not thread safe in any way and is meant for simple testing |
132 // purposes. | 132 // purposes. |
133 class VideoProcessor { | 133 class VideoProcessor { |
134 public: | 134 public: |
135 virtual ~VideoProcessor() {} | 135 virtual ~VideoProcessor() = default; |
136 | 136 |
137 // Performs initial calculations about frame size, sets up callbacks etc. | 137 // Performs initial calculations about frame size, sets up callbacks etc. |
138 // Returns false if an error has occurred, in addition to printing to stderr. | 138 // Returns false if an error has occurred, in addition to printing to stderr. |
139 virtual bool Init() = 0; | 139 virtual bool Init() = 0; |
140 | 140 |
| 141 virtual void DeregisterCallbacks() = 0; |
| 142 |
141 // Processes a single frame. Returns true as long as there's more frames | 143 // Processes a single frame. Returns true as long as there's more frames |
142 // available in the source clip. | 144 // available in the source clip. |
143 // Frame number must be an integer >= 0. | 145 // Frame number must be an integer >= 0. |
144 virtual bool ProcessFrame(int frame_number) = 0; | 146 virtual bool ProcessFrame(int frame_number) = 0; |
145 | 147 |
146 // Updates the encoder with the target bit rate and the frame rate. | 148 // Updates the encoder with the target bit rate and the frame rate. |
147 virtual void SetRates(int bit_rate, int frame_rate) = 0; | 149 virtual void SetRates(int bit_rate, int frame_rate) = 0; |
148 | 150 |
149 // Return the size of the encoded frame in bytes. Dropped frames by the | 151 // Return the size of the encoded frame in bytes. Dropped frames by the |
150 // encoder are regarded as zero size. | 152 // encoder are regarded as zero size. |
(...skipping 14 matching lines...) Expand all Loading... |
165 VideoProcessorImpl(webrtc::VideoEncoder* encoder, | 167 VideoProcessorImpl(webrtc::VideoEncoder* encoder, |
166 webrtc::VideoDecoder* decoder, | 168 webrtc::VideoDecoder* decoder, |
167 FrameReader* analysis_frame_reader, | 169 FrameReader* analysis_frame_reader, |
168 FrameWriter* analysis_frame_writer, | 170 FrameWriter* analysis_frame_writer, |
169 PacketManipulator* packet_manipulator, | 171 PacketManipulator* packet_manipulator, |
170 const TestConfig& config, | 172 const TestConfig& config, |
171 Stats* stats, | 173 Stats* stats, |
172 FrameWriter* source_frame_writer, | 174 FrameWriter* source_frame_writer, |
173 IvfFileWriter* encoded_frame_writer, | 175 IvfFileWriter* encoded_frame_writer, |
174 FrameWriter* decoded_frame_writer); | 176 FrameWriter* decoded_frame_writer); |
175 virtual ~VideoProcessorImpl(); | 177 ~VideoProcessorImpl() override; |
176 bool Init() override; | 178 bool Init() override; |
| 179 void DeregisterCallbacks() override; |
177 bool ProcessFrame(int frame_number) override; | 180 bool ProcessFrame(int frame_number) override; |
178 | 181 |
179 private: | 182 private: |
180 // Container that holds per-frame information that needs to be stored between | 183 // Container that holds per-frame information that needs to be stored between |
181 // calls to Encode and Decode, as well as the corresponding callbacks. It is | 184 // calls to Encode and Decode, as well as the corresponding callbacks. It is |
182 // not directly used for statistics -- for that, test::FrameStatistic is used. | 185 // not directly used for statistics -- for that, test::FrameStatistic is used. |
183 struct FrameInfo { | 186 struct FrameInfo { |
184 FrameInfo() | 187 FrameInfo() |
185 : timestamp(0), | 188 : timestamp(0), |
186 encode_start_ns(0), | 189 encode_start_ns(0), |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 Stats* stats_; | 321 Stats* stats_; |
319 int num_dropped_frames_; | 322 int num_dropped_frames_; |
320 int num_spatial_resizes_; | 323 int num_spatial_resizes_; |
321 double bit_rate_factor_; // Multiply frame length with this to get bit rate. | 324 double bit_rate_factor_; // Multiply frame length with this to get bit rate. |
322 }; | 325 }; |
323 | 326 |
324 } // namespace test | 327 } // namespace test |
325 } // namespace webrtc | 328 } // namespace webrtc |
326 | 329 |
327 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 330 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
OLD | NEW |