Extract the code to produce a stream of frames to its own class, FakeFrameSource. Use in VideoAdapter unittests, to make the code simpler and not depend on the deprecated cricket::VideoCapturer. Bug: webrtc:6353 Change-Id: Ib5c34c6a0bd7f4338650459873ddc94b12d0c569 Reviewed-on: https://webrtc-review.googlesource.com/49740 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21995}
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef MEDIA_BASE_FAKEFRAMESOURCE_H_
|
|
#define MEDIA_BASE_FAKEFRAMESOURCE_H_
|
|
|
|
#include "api/video/video_frame.h"
|
|
|
|
#include "rtc_base/timeutils.h"
|
|
|
|
namespace cricket {
|
|
|
|
class FakeFrameSource {
|
|
public:
|
|
FakeFrameSource(int width, int height, int interval_us);
|
|
|
|
webrtc::VideoRotation GetRotation();
|
|
void SetRotation(webrtc::VideoRotation rotation);
|
|
|
|
webrtc::VideoFrame GetFrame();
|
|
// Override default size and interval.
|
|
webrtc::VideoFrame GetFrame(int width, int height, int interval_us);
|
|
|
|
private:
|
|
const int width_;
|
|
const int height_;
|
|
const int interval_us_;
|
|
|
|
webrtc::VideoRotation rotation_ = webrtc::kVideoRotation_0;
|
|
int64_t next_timestamp_us_ = rtc::kNumMicrosecsPerMillisec;
|
|
};
|
|
|
|
} // namespace cricket
|
|
|
|
#endif // MEDIA_BASE_FAKEFRAMESOURCE_H_
|