fake_frame_source.h (1402B)
1 /* 2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MEDIA_BASE_FAKE_FRAME_SOURCE_H_ 12 #define MEDIA_BASE_FAKE_FRAME_SOURCE_H_ 13 14 #include <cstdint> 15 16 #include "api/video/video_frame.h" 17 #include "api/video/video_rotation.h" 18 19 namespace webrtc { 20 21 class FakeFrameSource { 22 public: 23 FakeFrameSource(int width, 24 int height, 25 int interval_us, 26 int64_t timestamp_offset_us); 27 FakeFrameSource(int width, int height, int interval_us); 28 29 VideoRotation GetRotation() const; 30 void SetRotation(VideoRotation rotation); 31 32 VideoFrame GetFrame(); 33 VideoFrame GetFrameRotationApplied(); 34 35 // Override configuration. 36 VideoFrame GetFrame(int width, 37 int height, 38 VideoRotation rotation, 39 int interval_us); 40 41 private: 42 const int width_; 43 const int height_; 44 const int interval_us_; 45 46 VideoRotation rotation_ = kVideoRotation_0; 47 int64_t next_timestamp_us_; 48 }; 49 50 } // namespace webrtc 51 52 53 #endif // MEDIA_BASE_FAKE_FRAME_SOURCE_H_