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.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-17 13:44:48 +00:00
|
|
|
#include "webrtc/modules/utility/interface/process_thread.h"
|
|
|
|
|
#include "webrtc/system_wrappers/interface/cpu_info.h"
|
|
|
|
|
#include "webrtc/system_wrappers/interface/trace.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_channel_manager.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_defines.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_input_manager.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_render_manager.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_shared_data.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2013-05-13 10:50:50 +00:00
|
|
|
ViESharedData::ViESharedData(const Config& config)
|
2013-05-16 11:13:18 +00:00
|
|
|
: number_cores_(CpuInfo::DetectNumberOfCores()),
|
|
|
|
|
channel_manager_(new ViEChannelManager(0, number_cores_, config)),
|
|
|
|
|
input_manager_(new ViEInputManager(0, config)),
|
|
|
|
|
render_manager_(new ViERenderManager(0)),
|
2011-11-24 15:16:00 +00:00
|
|
|
module_process_thread_(ProcessThread::CreateProcessThread()),
|
|
|
|
|
last_error_(0) {
|
|
|
|
|
Trace::CreateTrace();
|
2013-05-16 11:13:18 +00:00
|
|
|
channel_manager_->SetModuleProcessThread(module_process_thread_);
|
|
|
|
|
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() {
|
2013-05-16 11:13:18 +00:00
|
|
|
// Release these ones before the process thread and the trace.
|
|
|
|
|
input_manager_.reset();
|
|
|
|
|
channel_manager_.reset();
|
|
|
|
|
render_manager_.reset();
|
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
|
|
|
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
|
|
|
}
|
|
|
|
|
|
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
|