| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 27 matching lines...) Expand all Loading... |
| 38 int32_t Encode(const VideoFrame& input_image, | 38 int32_t Encode(const VideoFrame& input_image, |
| 39 const CodecSpecificInfo* codec_specific_info, | 39 const CodecSpecificInfo* codec_specific_info, |
| 40 const std::vector<FrameType>* frame_types) override; | 40 const std::vector<FrameType>* frame_types) override; |
| 41 int32_t RegisterEncodeCompleteCallback( | 41 int32_t RegisterEncodeCompleteCallback( |
| 42 EncodedImageCallback* callback) override; | 42 EncodedImageCallback* callback) override; |
| 43 int32_t Release() override; | 43 int32_t Release() override; |
| 44 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 44 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
| 45 int32_t SetRateAllocation(const BitrateAllocation& rate_allocation, | 45 int32_t SetRateAllocation(const BitrateAllocation& rate_allocation, |
| 46 uint32_t framerate) override; | 46 uint32_t framerate) override; |
| 47 const char* ImplementationName() const override; | 47 const char* ImplementationName() const override; |
| 48 int GetConfiguredInputFramerate() const; | |
| 49 | 48 |
| 50 static const char* kImplementationName; | 49 static const char* kImplementationName; |
| 51 | 50 |
| 52 protected: | 51 protected: |
| 53 Clock* const clock_; | 52 Clock* const clock_; |
| 54 VideoCodec config_ GUARDED_BY(crit_sect_); | 53 VideoCodec config_ GUARDED_BY(crit_sect_); |
| 55 EncodedImageCallback* callback_ GUARDED_BY(crit_sect_); | 54 EncodedImageCallback* callback_ GUARDED_BY(crit_sect_); |
| 56 BitrateAllocation target_bitrate_ GUARDED_BY(crit_sect_); | 55 BitrateAllocation target_bitrate_ GUARDED_BY(crit_sect_); |
| 57 int configured_input_framerate_ GUARDED_BY(crit_sect_); | |
| 58 int max_target_bitrate_kbps_ GUARDED_BY(crit_sect_); | 56 int max_target_bitrate_kbps_ GUARDED_BY(crit_sect_); |
| 59 bool pending_keyframe_ GUARDED_BY(crit_sect_); | 57 int64_t last_encode_time_ms_ GUARDED_BY(crit_sect_); |
| 60 rtc::CriticalSection crit_sect_; | 58 rtc::CriticalSection crit_sect_; |
| 61 | 59 |
| 62 uint8_t encoded_buffer_[100000]; | 60 uint8_t encoded_buffer_[100000]; |
| 63 | |
| 64 // Current byte debt to be payed over a number of frames. | |
| 65 // The debt is acquired by keyframes overshooting the bitrate target. | |
| 66 size_t debt_bytes_; | |
| 67 }; | 61 }; |
| 68 | 62 |
| 69 class FakeH264Encoder : public FakeEncoder, public EncodedImageCallback { | 63 class FakeH264Encoder : public FakeEncoder, public EncodedImageCallback { |
| 70 public: | 64 public: |
| 71 explicit FakeH264Encoder(Clock* clock); | 65 explicit FakeH264Encoder(Clock* clock); |
| 72 virtual ~FakeH264Encoder() = default; | 66 virtual ~FakeH264Encoder() = default; |
| 73 | 67 |
| 74 int32_t RegisterEncodeCompleteCallback( | 68 int32_t RegisterEncodeCompleteCallback( |
| 75 EncodedImageCallback* callback) override; | 69 EncodedImageCallback* callback) override; |
| 76 | 70 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 int current_queue_ ACCESS_ON(sequence_checker_); | 122 int current_queue_ ACCESS_ON(sequence_checker_); |
| 129 std::unique_ptr<rtc::TaskQueue> queue1_ ACCESS_ON(sequence_checker_); | 123 std::unique_ptr<rtc::TaskQueue> queue1_ ACCESS_ON(sequence_checker_); |
| 130 std::unique_ptr<rtc::TaskQueue> queue2_ ACCESS_ON(sequence_checker_); | 124 std::unique_ptr<rtc::TaskQueue> queue2_ ACCESS_ON(sequence_checker_); |
| 131 rtc::SequencedTaskChecker sequence_checker_; | 125 rtc::SequencedTaskChecker sequence_checker_; |
| 132 }; | 126 }; |
| 133 | 127 |
| 134 } // namespace test | 128 } // namespace test |
| 135 } // namespace webrtc | 129 } // namespace webrtc |
| 136 | 130 |
| 137 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ | 131 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ |
| OLD | NEW |