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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 virtual bool ProcessFrame(int frame_number) = 0; | 140 virtual bool ProcessFrame(int frame_number) = 0; |
141 | 141 |
142 // Updates the encoder with the target bit rate and the frame rate. | 142 // Updates the encoder with the target bit rate and the frame rate. |
143 virtual void SetRates(int bit_rate, int frame_rate) = 0; | 143 virtual void SetRates(int bit_rate, int frame_rate) = 0; |
144 | 144 |
145 // Return the size of the encoded frame in bytes. Dropped frames by the | 145 // Return the size of the encoded frame in bytes. Dropped frames by the |
146 // encoder are regarded as zero size. | 146 // encoder are regarded as zero size. |
147 virtual size_t EncodedFrameSize() = 0; | 147 virtual size_t EncodedFrameSize() = 0; |
148 | 148 |
149 // Return the encoded frame type (key or delta). | 149 // Return the encoded frame type (key or delta). |
150 virtual VideoFrameType EncodedFrameType() = 0; | 150 virtual FrameType EncodedFrameType() = 0; |
151 | 151 |
152 // Return the number of dropped frames. | 152 // Return the number of dropped frames. |
153 virtual int NumberDroppedFrames() = 0; | 153 virtual int NumberDroppedFrames() = 0; |
154 | 154 |
155 // Return the number of spatial resizes. | 155 // Return the number of spatial resizes. |
156 virtual int NumberSpatialResizes() = 0; | 156 virtual int NumberSpatialResizes() = 0; |
157 }; | 157 }; |
158 | 158 |
159 class VideoProcessorImpl : public VideoProcessor { | 159 class VideoProcessorImpl : public VideoProcessor { |
160 public: | 160 public: |
(...skipping 15 matching lines...) Expand all Loading... |
176 void FrameDecoded(const webrtc::VideoFrame& image); | 176 void FrameDecoded(const webrtc::VideoFrame& image); |
177 // Used for getting a 32-bit integer representing time | 177 // Used for getting a 32-bit integer representing time |
178 // (checks the size is within signed 32-bit bounds before casting it) | 178 // (checks the size is within signed 32-bit bounds before casting it) |
179 int GetElapsedTimeMicroseconds(const webrtc::TickTime& start, | 179 int GetElapsedTimeMicroseconds(const webrtc::TickTime& start, |
180 const webrtc::TickTime& stop); | 180 const webrtc::TickTime& stop); |
181 // Updates the encoder with the target bit rate and the frame rate. | 181 // Updates the encoder with the target bit rate and the frame rate. |
182 void SetRates(int bit_rate, int frame_rate) override; | 182 void SetRates(int bit_rate, int frame_rate) override; |
183 // Return the size of the encoded frame in bytes. | 183 // Return the size of the encoded frame in bytes. |
184 size_t EncodedFrameSize() override; | 184 size_t EncodedFrameSize() override; |
185 // Return the encoded frame type (key or delta). | 185 // Return the encoded frame type (key or delta). |
186 VideoFrameType EncodedFrameType() override; | 186 FrameType EncodedFrameType() override; |
187 // Return the number of dropped frames. | 187 // Return the number of dropped frames. |
188 int NumberDroppedFrames() override; | 188 int NumberDroppedFrames() override; |
189 // Return the number of spatial resizes. | 189 // Return the number of spatial resizes. |
190 int NumberSpatialResizes() override; | 190 int NumberSpatialResizes() override; |
191 | 191 |
192 webrtc::VideoEncoder* encoder_; | 192 webrtc::VideoEncoder* encoder_; |
193 webrtc::VideoDecoder* decoder_; | 193 webrtc::VideoDecoder* decoder_; |
194 FrameReader* frame_reader_; | 194 FrameReader* frame_reader_; |
195 FrameWriter* frame_writer_; | 195 FrameWriter* frame_writer_; |
196 PacketManipulator* packet_manipulator_; | 196 PacketManipulator* packet_manipulator_; |
197 const TestConfig& config_; | 197 const TestConfig& config_; |
198 Stats* stats_; | 198 Stats* stats_; |
199 | 199 |
200 EncodedImageCallback* encode_callback_; | 200 EncodedImageCallback* encode_callback_; |
201 DecodedImageCallback* decode_callback_; | 201 DecodedImageCallback* decode_callback_; |
202 // Buffer used for reading the source video file: | 202 // Buffer used for reading the source video file: |
203 uint8_t* source_buffer_; | 203 uint8_t* source_buffer_; |
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 uint8_t* last_successful_frame_buffer_; |
207 webrtc::VideoFrame source_frame_; | 207 webrtc::VideoFrame source_frame_; |
208 // To keep track of if we have excluded the first key frame from packet loss: | 208 // To keep track of if we have excluded the first key frame from packet loss: |
209 bool first_key_frame_has_been_excluded_; | 209 bool first_key_frame_has_been_excluded_; |
210 // To tell the decoder previous frame have been dropped due to packet loss: | 210 // To tell the decoder previous frame have been dropped due to packet loss: |
211 bool last_frame_missing_; | 211 bool last_frame_missing_; |
212 // If Init() has executed successfully. | 212 // If Init() has executed successfully. |
213 bool initialized_; | 213 bool initialized_; |
214 size_t encoded_frame_size_; | 214 size_t encoded_frame_size_; |
215 VideoFrameType encoded_frame_type_; | 215 FrameType encoded_frame_type_; |
216 int prev_time_stamp_; | 216 int prev_time_stamp_; |
217 int num_dropped_frames_; | 217 int num_dropped_frames_; |
218 int num_spatial_resizes_; | 218 int num_spatial_resizes_; |
219 int last_encoder_frame_width_; | 219 int last_encoder_frame_width_; |
220 int last_encoder_frame_height_; | 220 int last_encoder_frame_height_; |
221 Scaler scaler_; | 221 Scaler scaler_; |
222 | 222 |
223 // Statistics | 223 // Statistics |
224 double bit_rate_factor_; // multiply frame length with this to get bit rate | 224 double bit_rate_factor_; // multiply frame length with this to get bit rate |
225 webrtc::TickTime encode_start_; | 225 webrtc::TickTime encode_start_; |
(...skipping 25 matching lines...) Expand all Loading... |
251 | 251 |
252 private: | 252 private: |
253 VideoProcessorImpl* video_processor_; | 253 VideoProcessorImpl* video_processor_; |
254 }; | 254 }; |
255 }; | 255 }; |
256 | 256 |
257 } // namespace test | 257 } // namespace test |
258 } // namespace webrtc | 258 } // namespace webrtc |
259 | 259 |
260 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 260 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
OLD | NEW |