Delete class FakePeriodicVideoCapturer.
Only use replaced with FakePeriodicVideoTrackSource. Bug: webrtc:6353 Change-Id: Iee38b98a5242a292a848738bde05de18d96de7f4 Reviewed-on: https://webrtc-review.googlesource.com/79441 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23441}
This commit is contained in:
@ -348,7 +348,6 @@ if (rtc_include_tests) {
|
||||
"test/fakedatachannelprovider.h",
|
||||
"test/fakepeerconnectionbase.h",
|
||||
"test/fakepeerconnectionforstats.h",
|
||||
"test/fakeperiodicvideocapturer.h",
|
||||
"test/fakeperiodicvideosource.h",
|
||||
"test/fakeperiodicvideotracksource.h",
|
||||
"test/fakertccertificategenerator.h",
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 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.
|
||||
*/
|
||||
|
||||
// FakePeriodicVideoCapturer implements a fake cricket::VideoCapturer that
|
||||
// creates video frames periodically after it has been started.
|
||||
|
||||
#ifndef PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
|
||||
#define PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "media/base/fakevideocapturer.h"
|
||||
#include "rtc_base/arraysize.h"
|
||||
#include "rtc_base/thread_checker.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class FakePeriodicVideoCapturer
|
||||
: public cricket::FakeVideoCapturerWithTaskQueue {
|
||||
public:
|
||||
FakePeriodicVideoCapturer() {
|
||||
worker_thread_checker_.DetachFromThread();
|
||||
using cricket::VideoFormat;
|
||||
static const VideoFormat formats[] = {
|
||||
{1280, 720, VideoFormat::FpsToInterval(30), cricket::FOURCC_I420},
|
||||
{640, 480, VideoFormat::FpsToInterval(30), cricket::FOURCC_I420},
|
||||
{640, 360, VideoFormat::FpsToInterval(30), cricket::FOURCC_I420},
|
||||
{320, 240, VideoFormat::FpsToInterval(30), cricket::FOURCC_I420},
|
||||
{160, 120, VideoFormat::FpsToInterval(30), cricket::FOURCC_I420},
|
||||
};
|
||||
|
||||
ResetSupportedFormats({&formats[0], &formats[arraysize(formats)]});
|
||||
}
|
||||
|
||||
~FakePeriodicVideoCapturer() override {
|
||||
RTC_DCHECK(main_thread_checker_.CalledOnValidThread());
|
||||
StopFrameDelivery();
|
||||
}
|
||||
|
||||
// Workaround method for tests to allow stopping frame delivery directly.
|
||||
// The |Start()| method expects to be called from the "worker thread" that
|
||||
// is owned by the factory (think OrtcFactoryInterface or
|
||||
// PeerConnectionFactoryInterface). That thread is not directly exposed,
|
||||
// which can make it tricky for tests to inject calls on.
|
||||
// So, in order to allow tests to stop frame delivery directly from the
|
||||
// test thread, we expose this method publicly.
|
||||
void StopFrameDelivery() {
|
||||
task_queue_.SendTask([this]() {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_);
|
||||
deliver_frames_ = false;
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
cricket::CaptureState Start(const cricket::VideoFormat& format) override {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
cricket::CaptureState state = FakeVideoCapturer::Start(format);
|
||||
if (state != cricket::CS_FAILED) {
|
||||
task_queue_.PostTask([this]() {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_);
|
||||
deliver_frames_ = true;
|
||||
DeliverFrame();
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
void Stop() override {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
StopFrameDelivery();
|
||||
}
|
||||
|
||||
void DeliverFrame() {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_);
|
||||
if (IsRunning() && deliver_frames_) {
|
||||
CaptureFrame();
|
||||
task_queue_.PostDelayedTask(
|
||||
[this]() { DeliverFrame(); },
|
||||
static_cast<int>(GetCaptureFormat()->interval /
|
||||
rtc::kNumNanosecsPerMillisec));
|
||||
}
|
||||
}
|
||||
|
||||
rtc::ThreadChecker main_thread_checker_;
|
||||
rtc::ThreadChecker worker_thread_checker_;
|
||||
bool deliver_frames_ RTC_GUARDED_BY(task_queue_) = false;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
|
||||
@ -17,7 +17,7 @@
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "p2p/base/fakeportallocator.h"
|
||||
#include "pc/sdputils.h"
|
||||
#include "pc/test/fakeperiodicvideocapturer.h"
|
||||
#include "pc/test/fakeperiodicvideotracksource.h"
|
||||
#include "pc/test/fakertccertificategenerator.h"
|
||||
#include "pc/test/mockpeerconnectionobservers.h"
|
||||
#include "pc/test/peerconnectiontestwrapper.h"
|
||||
@ -287,14 +287,13 @@ rtc::scoped_refptr<webrtc::MediaStreamInterface>
|
||||
|
||||
if (video) {
|
||||
// Set max frame rate to 10fps to reduce the risk of the tests to be flaky.
|
||||
FakeConstraints constraints = video_constraints;
|
||||
constraints.SetMandatoryMaxFrameRate(10);
|
||||
webrtc::FakePeriodicVideoSource::Config config;
|
||||
config.frame_interval_ms = 100;
|
||||
|
||||
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
|
||||
peer_connection_factory_->CreateVideoSource(
|
||||
std::unique_ptr<cricket::VideoCapturer>(
|
||||
new webrtc::FakePeriodicVideoCapturer()),
|
||||
&constraints);
|
||||
new rtc::RefCountedObject<webrtc::FakePeriodicVideoTrackSource>(
|
||||
config, /* remote */ false);
|
||||
|
||||
std::string videotrack_label = stream_id + kVideoTrackLabelBase;
|
||||
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
|
||||
peer_connection_factory_->CreateVideoTrack(videotrack_label, source));
|
||||
|
||||
Reference in New Issue
Block a user