Remove id from VideoProcessingModule.
Also converts CriticalSectionWrapper to rtc::CriticalSection as a bonus. BUG=webrtc:1695 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/1346643002 . Cr-Commit-Position: refs/heads/master@{#9986}
This commit is contained in:
@ -76,7 +76,7 @@ class VideoProcessingModule : public Module {
|
||||
|
||||
\return Pointer to a VPM object.
|
||||
*/
|
||||
static VideoProcessingModule* Create(int32_t id);
|
||||
static VideoProcessingModule* Create();
|
||||
|
||||
/**
|
||||
Destroys a VPM object.
|
||||
|
||||
@ -37,8 +37,8 @@ void SetSubSampling(VideoProcessingModule::FrameStats* stats,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
VideoProcessingModule* VideoProcessingModule::Create(const int32_t id) {
|
||||
return new VideoProcessingModuleImpl(id);
|
||||
VideoProcessingModule* VideoProcessingModule::Create() {
|
||||
return new VideoProcessingModuleImpl();
|
||||
}
|
||||
|
||||
void VideoProcessingModule::Destroy(VideoProcessingModule* module) {
|
||||
@ -46,16 +46,11 @@ void VideoProcessingModule::Destroy(VideoProcessingModule* module) {
|
||||
delete static_cast<VideoProcessingModuleImpl*>(module);
|
||||
}
|
||||
|
||||
VideoProcessingModuleImpl::VideoProcessingModuleImpl(const int32_t id)
|
||||
: mutex_(*CriticalSectionWrapper::CreateCriticalSection()) {
|
||||
}
|
||||
|
||||
VideoProcessingModuleImpl::~VideoProcessingModuleImpl() {
|
||||
delete &mutex_;
|
||||
}
|
||||
VideoProcessingModuleImpl::VideoProcessingModuleImpl() {}
|
||||
VideoProcessingModuleImpl::~VideoProcessingModuleImpl() {}
|
||||
|
||||
void VideoProcessingModuleImpl::Reset() {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
deflickering_.Reset();
|
||||
brightness_detection_.Reset();
|
||||
frame_pre_processor_.Reset();
|
||||
@ -117,71 +112,71 @@ int32_t VideoProcessingModule::Brighten(VideoFrame* frame, int delta) {
|
||||
|
||||
int32_t VideoProcessingModuleImpl::Deflickering(VideoFrame* frame,
|
||||
FrameStats* stats) {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
return deflickering_.ProcessFrame(frame, stats);
|
||||
}
|
||||
|
||||
int32_t VideoProcessingModuleImpl::BrightnessDetection(
|
||||
const VideoFrame& frame,
|
||||
const FrameStats& stats) {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
return brightness_detection_.ProcessFrame(frame, stats);
|
||||
}
|
||||
|
||||
|
||||
void VideoProcessingModuleImpl::EnableTemporalDecimation(bool enable) {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
frame_pre_processor_.EnableTemporalDecimation(enable);
|
||||
}
|
||||
|
||||
|
||||
void VideoProcessingModuleImpl::SetInputFrameResampleMode(VideoFrameResampling
|
||||
resampling_mode) {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
frame_pre_processor_.SetInputFrameResampleMode(resampling_mode);
|
||||
}
|
||||
|
||||
int32_t VideoProcessingModuleImpl::SetTargetResolution(uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t frame_rate) {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
return frame_pre_processor_.SetTargetResolution(width, height, frame_rate);
|
||||
}
|
||||
|
||||
void VideoProcessingModuleImpl::SetTargetFramerate(int frame_rate) {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
frame_pre_processor_.SetTargetFramerate(frame_rate);
|
||||
}
|
||||
|
||||
uint32_t VideoProcessingModuleImpl::Decimatedframe_rate() {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
return frame_pre_processor_.Decimatedframe_rate();
|
||||
}
|
||||
|
||||
uint32_t VideoProcessingModuleImpl::DecimatedWidth() const {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
return frame_pre_processor_.DecimatedWidth();
|
||||
}
|
||||
|
||||
uint32_t VideoProcessingModuleImpl::DecimatedHeight() const {
|
||||
CriticalSectionScoped cs(&mutex_);
|
||||
rtc::CritScope cs(&mutex_);
|
||||
return frame_pre_processor_.DecimatedHeight();
|
||||
}
|
||||
|
||||
int32_t VideoProcessingModuleImpl::PreprocessFrame(
|
||||
const VideoFrame& frame,
|
||||
VideoFrame** processed_frame) {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
return frame_pre_processor_.PreprocessFrame(frame, processed_frame);
|
||||
}
|
||||
|
||||
VideoContentMetrics* VideoProcessingModuleImpl::ContentMetrics() const {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
return frame_pre_processor_.ContentMetrics();
|
||||
}
|
||||
|
||||
void VideoProcessingModuleImpl::EnableContentAnalysis(bool enable) {
|
||||
CriticalSectionScoped mutex(&mutex_);
|
||||
rtc::CritScope mutex(&mutex_);
|
||||
frame_pre_processor_.EnableContentAnalysis(enable);
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_MODULE_VIDEO_PROCESSING_IMPL_H
|
||||
#define WEBRTC_MODULE_VIDEO_PROCESSING_IMPL_H
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/modules/video_processing/main/interface/video_processing.h"
|
||||
#include "webrtc/modules/video_processing/main/source/brighten.h"
|
||||
#include "webrtc/modules/video_processing/main/source/brightness_detection.h"
|
||||
@ -22,9 +23,8 @@ class CriticalSectionWrapper;
|
||||
|
||||
class VideoProcessingModuleImpl : public VideoProcessingModule {
|
||||
public:
|
||||
VideoProcessingModuleImpl(int32_t id);
|
||||
|
||||
virtual ~VideoProcessingModuleImpl();
|
||||
VideoProcessingModuleImpl();
|
||||
~VideoProcessingModuleImpl() override;
|
||||
|
||||
void Reset() override;
|
||||
|
||||
@ -64,8 +64,8 @@ class VideoProcessingModuleImpl : public VideoProcessingModule {
|
||||
VideoContentMetrics* ContentMetrics() const override;
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper& mutex_;
|
||||
VPMDeflickering deflickering_;
|
||||
mutable rtc::CriticalSection mutex_;
|
||||
VPMDeflickering deflickering_ GUARDED_BY(mutex_);
|
||||
VPMBrightnessDetection brightness_detection_;
|
||||
VPMFramePreprocessor frame_pre_processor_;
|
||||
};
|
||||
|
||||
@ -66,7 +66,7 @@ VideoProcessingModuleTest::VideoProcessingModuleTest()
|
||||
frame_length_(CalcBufferSize(kI420, width_, height_)) {}
|
||||
|
||||
void VideoProcessingModuleTest::SetUp() {
|
||||
vpm_ = VideoProcessingModule::Create(0);
|
||||
vpm_ = VideoProcessingModule::Create();
|
||||
ASSERT_TRUE(vpm_ != NULL);
|
||||
|
||||
ASSERT_EQ(0, video_frame_.CreateEmptyFrame(width_, height_, width_,
|
||||
|
||||
@ -109,7 +109,7 @@ ViEEncoder::ViEEncoder(int32_t channel_id,
|
||||
BitrateAllocator* bitrate_allocator)
|
||||
: channel_id_(channel_id),
|
||||
number_of_cores_(number_of_cores),
|
||||
vpm_(VideoProcessingModule::Create(ViEModuleId(-1, channel_id))),
|
||||
vpm_(VideoProcessingModule::Create()),
|
||||
qm_callback_(new QMVideoSettingsCallback(vpm_.get())),
|
||||
vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(),
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user