| 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; |
| 48 | 49 |
| 49 static const char* kImplementationName; | 50 static const char* kImplementationName; |
| 50 | 51 |
| 51 protected: | 52 protected: |
| 52 Clock* const clock_; | 53 Clock* const clock_; |
| 53 VideoCodec config_ GUARDED_BY(crit_sect_); | 54 VideoCodec config_ GUARDED_BY(crit_sect_); |
| 54 EncodedImageCallback* callback_ GUARDED_BY(crit_sect_); | 55 EncodedImageCallback* callback_ GUARDED_BY(crit_sect_); |
| 55 BitrateAllocation target_bitrate_ GUARDED_BY(crit_sect_); | 56 BitrateAllocation target_bitrate_ GUARDED_BY(crit_sect_); |
| 57 int configured_input_framerate_ GUARDED_BY(crit_sect_); |
| 56 int max_target_bitrate_kbps_ GUARDED_BY(crit_sect_); | 58 int max_target_bitrate_kbps_ GUARDED_BY(crit_sect_); |
| 57 int64_t last_encode_time_ms_ GUARDED_BY(crit_sect_); | 59 bool pending_keyframe_ GUARDED_BY(crit_sect_); |
| 58 rtc::CriticalSection crit_sect_; | 60 rtc::CriticalSection crit_sect_; |
| 59 | 61 |
| 60 uint8_t encoded_buffer_[100000]; | 62 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_; |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 class FakeH264Encoder : public FakeEncoder, public EncodedImageCallback { | 69 class FakeH264Encoder : public FakeEncoder, public EncodedImageCallback { |
| 64 public: | 70 public: |
| 65 explicit FakeH264Encoder(Clock* clock); | 71 explicit FakeH264Encoder(Clock* clock); |
| 66 virtual ~FakeH264Encoder() = default; | 72 virtual ~FakeH264Encoder() = default; |
| 67 | 73 |
| 68 int32_t RegisterEncodeCompleteCallback( | 74 int32_t RegisterEncodeCompleteCallback( |
| 69 EncodedImageCallback* callback) override; | 75 EncodedImageCallback* callback) override; |
| 70 | 76 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 int current_queue_ ACCESS_ON(sequence_checker_); | 128 int current_queue_ ACCESS_ON(sequence_checker_); |
| 123 std::unique_ptr<rtc::TaskQueue> queue1_ ACCESS_ON(sequence_checker_); | 129 std::unique_ptr<rtc::TaskQueue> queue1_ ACCESS_ON(sequence_checker_); |
| 124 std::unique_ptr<rtc::TaskQueue> queue2_ ACCESS_ON(sequence_checker_); | 130 std::unique_ptr<rtc::TaskQueue> queue2_ ACCESS_ON(sequence_checker_); |
| 125 rtc::SequencedTaskChecker sequence_checker_; | 131 rtc::SequencedTaskChecker sequence_checker_; |
| 126 }; | 132 }; |
| 127 | 133 |
| 128 } // namespace test | 134 } // namespace test |
| 129 } // namespace webrtc | 135 } // namespace webrtc |
| 130 | 136 |
| 131 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ | 137 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ |
| OLD | NEW |