Chromium Code Reviews| Index: webrtc/test/fake_encoder.h |
| diff --git a/webrtc/test/fake_encoder.h b/webrtc/test/fake_encoder.h |
| index 6bff00e2a314fd0ca1310f83c5094a93fb266258..bb6eb5bab77dddf1ec3c33d9a0a42a392680f870 100644 |
| --- a/webrtc/test/fake_encoder.h |
| +++ b/webrtc/test/fake_encoder.h |
| @@ -13,6 +13,7 @@ |
| #include <vector> |
| +#include "webrtc/base/platform_thread.h" |
| #include "webrtc/common_types.h" |
| #include "webrtc/system_wrappers/include/clock.h" |
| #include "webrtc/video_encoder.h" |
| @@ -82,6 +83,41 @@ class DelayedEncoder : public test::FakeEncoder { |
| private: |
| const int delay_ms_; |
| }; |
| + |
| +// An encoder that is marked as internal source, so ignores everything but |
|
pbos
2016/04/07 12:20:21
This class just looks like dead code, if it's not
|
| +// keyframe requests in Encode calls, and generates frames (encoded callbacks) |
| +// periodically. |
| +class InternalSourceEncoder : public test::FakeEncoder { |
| + public: |
| + InternalSourceEncoder(Clock* clock, |
| + uint32_t frame_period_ms, |
| + uint32_t first_frame_timestamp_ms); |
| + virtual ~InternalSourceEncoder(){}; |
| + |
| + // Overridden to ignore input. |
| + int32_t Encode(const VideoFrame& input_image, |
| + const CodecSpecificInfo* codec_specific_info, |
| + const std::vector<FrameType>* frame_types) override; |
| + // Overridden to start frame production. |
| + int32_t InitEncode(const VideoCodec* config, |
| + int32_t number_of_cores, |
| + size_t max_payload_size) override; |
| + // Overridden to stop frame production. |
| + int32_t Release() override; |
| + |
| + private: |
| + static bool EncoderProcess(void* encoder); |
| + // Encode a fake frame. Returns true to continue background thread processing. |
| + bool EncodeFrame(); |
| + rtc::PlatformThread thread_; |
| + const uint32_t frame_period_ms_; |
| + // No guard, because it is only modified on |thread_|. |
| + uint32_t current_frame_timestamp_ms_; |
| + rtc::CriticalSection lock_; |
| + bool shutting_down_ GUARDED_BY(lock_); |
| + FrameType next_frame_type_ GUARDED_BY(lock_); |
| +}; |
| + |
| } // namespace test |
| } // namespace webrtc |