FrameGenerator.h 1016 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <queue>
  3. #include "api/test/frame_generator_interface.h"
  4. #include "rtc_base/synchronization/mutex.h"
  5. namespace unity
  6. {
  7. namespace webrtc
  8. {
  9. using namespace ::webrtc;
  10. using namespace ::webrtc::test;
  11. class IGraphicsDevice;
  12. std::unique_ptr<FrameGeneratorInterface> CreateVideoFrameGenerator(
  13. IGraphicsDevice* device,
  14. int width,
  15. int height,
  16. absl::optional<FrameGeneratorInterface::OutputType> type,
  17. absl::optional<int> numFrames);
  18. class ITexture2D;
  19. class VideoFrameGenerator : public FrameGeneratorInterface
  20. {
  21. public:
  22. VideoFrameGenerator(IGraphicsDevice* device, int width, int height, OutputType type, int num_squares);
  23. void ChangeResolution(size_t width, size_t height) override;
  24. VideoFrameData NextFrame() override;
  25. private:
  26. IGraphicsDevice* device_;
  27. Mutex mutex_;
  28. int width_;
  29. int height_;
  30. std::queue<std::unique_ptr<ITexture2D>> queue_;
  31. };
  32. }
  33. }