-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMyFrameGeneratorInterface.h
57 lines (42 loc) · 1.66 KB
/
MyFrameGeneratorInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include "pc/test/fake_audio_capture_module.h"
#include "pc/test/fake_periodic_video_track_source.h"
#include "pc/test/frame_generator_capturer_video_track_source.h"
#include "api/video/i420_buffer.h"
class MediaSoupMailbox;
class MyFrameGeneratorInterface : public webrtc::test::FrameGeneratorInterface {
public:
MyFrameGeneratorInterface(int width, int height, OutputType type, std::shared_ptr<MediaSoupMailbox> mailbox);
void ChangeResolution(size_t width, size_t height) override;
Resolution GetResolution() const override;
VideoFrameData NextFrame() override;
absl::optional<int> fps() const override;
private:
const int m_width;
const int m_height;
std::shared_ptr<MediaSoupMailbox> m_mailbox;
rtc::scoped_refptr<webrtc::I420Buffer> m_lastFrame;
};
class FrameGeneratorCapturerVideoTrackSource : public webrtc::VideoTrackSource {
public:
static const int kDefaultFramesPerSecond = 30;
static const int kDefaultWidth = 640;
static const int kDefaultHeight = 480;
static const int kNumSquaresGenerated = 50;
struct Config {
int frames_per_second = kDefaultFramesPerSecond;
int width = kDefaultWidth;
int height = kDefaultHeight;
};
FrameGeneratorCapturerVideoTrackSource(Config config, webrtc::Clock *clock, bool is_screencast, std::shared_ptr<MediaSoupMailbox> mailbox);
~FrameGeneratorCapturerVideoTrackSource();
void Start();
void Stop();
bool is_screencast() const override;
protected:
rtc::VideoSourceInterface<webrtc::VideoFrame> *source() override;
private:
const std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
std::unique_ptr<webrtc::test::FrameGeneratorCapturer> video_capturer_;
const bool is_screencast_;
};