You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2016 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. #include "test/fake_texture_frame.h"
  11. #include "api/video/i420_buffer.h"
  12. #include "rtc_base/ref_counted_object.h"
  13. namespace webrtc {
  14. namespace test {
  15. VideoFrame FakeNativeBuffer::CreateFrame(int width,
  16. int height,
  17. uint32_t timestamp,
  18. int64_t render_time_ms,
  19. VideoRotation rotation) {
  20. return VideoFrame::Builder()
  21. .set_video_frame_buffer(
  22. new rtc::RefCountedObject<FakeNativeBuffer>(width, height))
  23. .set_timestamp_rtp(timestamp)
  24. .set_timestamp_ms(render_time_ms)
  25. .set_rotation(rotation)
  26. .build();
  27. }
  28. VideoFrameBuffer::Type FakeNativeBuffer::type() const {
  29. return Type::kNative;
  30. }
  31. int FakeNativeBuffer::width() const {
  32. return width_;
  33. }
  34. int FakeNativeBuffer::height() const {
  35. return height_;
  36. }
  37. rtc::scoped_refptr<I420BufferInterface> FakeNativeBuffer::ToI420() {
  38. rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
  39. I420Buffer::SetBlack(buffer);
  40. return buffer;
  41. }
  42. } // namespace test
  43. } // namespace webrtc