2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-06-21 12:11:50 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-06-29 10:05:28 +00:00
|
|
|
#include "modules/utility/interface/process_thread.h"
|
|
|
|
|
#include "system_wrappers/interface/cpu_info.h"
|
|
|
|
|
#include "system_wrappers/interface/trace.h"
|
|
|
|
|
#include "video_engine/vie_channel_manager.h"
|
|
|
|
|
#include "video_engine/vie_defines.h"
|
|
|
|
|
#include "video_engine/vie_input_manager.h"
|
|
|
|
|
#include "video_engine/vie_render_manager.h"
|
|
|
|
|
#include "video_engine/vie_shared_data.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Active instance counter
|
2011-11-24 15:16:00 +00:00
|
|
|
int ViESharedData::instance_counter_ = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
ViESharedData::ViESharedData()
|
2011-11-24 15:16:00 +00:00
|
|
|
: instance_id_(++instance_counter_),
|
|
|
|
|
initialized_(false),
|
|
|
|
|
number_cores_(CpuInfo::DetectNumberOfCores()),
|
2012-06-26 10:47:04 +00:00
|
|
|
over_use_detector_options_(),
|
2011-11-24 15:16:00 +00:00
|
|
|
channel_manager_(*new ViEChannelManager(instance_id_, number_cores_,
|
2012-06-26 10:47:04 +00:00
|
|
|
over_use_detector_options_)),
|
2011-11-24 15:16:00 +00:00
|
|
|
input_manager_(*new ViEInputManager(instance_id_)),
|
|
|
|
|
render_manager_(*new ViERenderManager(instance_id_)),
|
|
|
|
|
module_process_thread_(ProcessThread::CreateProcessThread()),
|
|
|
|
|
last_error_(0) {
|
|
|
|
|
Trace::CreateTrace();
|
2012-06-29 10:05:28 +00:00
|
|
|
channel_manager_.SetModuleProcessThread(module_process_thread_);
|
2012-06-21 12:11:50 +00:00
|
|
|
input_manager_.SetModuleProcessThread(module_process_thread_);
|
2011-11-24 15:16:00 +00:00
|
|
|
module_process_thread_->Start();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
ViESharedData::~ViESharedData() {
|
|
|
|
|
delete &input_manager_;
|
|
|
|
|
delete &channel_manager_;
|
|
|
|
|
delete &render_manager_;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
module_process_thread_->Stop();
|
|
|
|
|
ProcessThread::DestroyProcessThread(module_process_thread_);
|
|
|
|
|
Trace::ReturnTrace();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
bool ViESharedData::Initialized() const {
|
|
|
|
|
return initialized_;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
int ViESharedData::SetInitialized() {
|
|
|
|
|
initialized_ = true;
|
|
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
int ViESharedData::SetUnInitialized() {
|
|
|
|
|
initialized_ = false;
|
|
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
void ViESharedData::SetLastError(const int error) const {
|
|
|
|
|
last_error_ = error;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
int ViESharedData::LastErrorInternal() const {
|
|
|
|
|
int error = last_error_;
|
|
|
|
|
last_error_ = 0;
|
|
|
|
|
return error;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-10 10:14:43 +00:00
|
|
|
void ViESharedData::SetOverUseDetectorOptions(
|
|
|
|
|
const OverUseDetectorOptions& options) {
|
|
|
|
|
over_use_detector_options_ = options;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-24 15:16:00 +00:00
|
|
|
int ViESharedData::NumberOfCores() const {
|
|
|
|
|
return number_cores_;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
2011-11-24 15:16:00 +00:00
|
|
|
|
|
|
|
|
} // namespace webrtc
|