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 "api/video/video_frame.h"
15 #include "rtc_base/time_utils.h"
16 
17 namespace cricket {
18 
19 class FakeFrameSource {
20  public:
21   FakeFrameSource(int width,
22                   int height,
23                   int interval_us,
24                   int64_t timestamp_offset_us);
25   FakeFrameSource(int width, int height, int interval_us);
26 
27   webrtc::VideoRotation GetRotation() const;
28   void SetRotation(webrtc::VideoRotation rotation);
29 
30   webrtc::VideoFrame GetFrame();
31   webrtc::VideoFrame GetFrameRotationApplied();
32 
33   // Override configuration.
34   webrtc::VideoFrame GetFrame(int width,
35                               int height,
36                               webrtc::VideoRotation rotation,
37                               int interval_us);
38 
39  private:
40   const int width_;
41   const int height_;
42   const int interval_us_;
43 
44   webrtc::VideoRotation rotation_ = webrtc::kVideoRotation_0;
45   int64_t next_timestamp_us_;
46 };
47 
48 }  // namespace cricket
49 
50 #endif  // MEDIA_BASE_FAKE_FRAME_SOURCE_H_
51