webrtc_m130/webrtc/video_engine/vie_shared_data.h
tommi@webrtc.org 0c3e12b7bf Revamp the ProcessThreadImpl implementation.
* Add a new WakeUp method that gives a module a chance to be called back right away on the worker thread.
* Wrote unit tests for the class.
* Significantly reduce the amount of locking.
  - ProcessThreadImpl itself does a lot less locking.
  - Reimplemented the way we keep track of when to make calls to Process.
    This reduces the amount of calls to TimeUntilNextProcess and since most implementations of that function grab a lock, this means less locking.
* Renamed ProcessThread::CreateProcessThread to ProcessThread::Create.
* Added thread checks for Start/Stop.  Threading model of other functions is now documented.
* We now log an error if an implementation of TimeUntilNextProcess returns a negative value (some implementations do, but the method should only return a positive nr of ms).
* Removed the DestroyProcessThread method and instead force callers to use scoped_ptr<> to maintain object lifetime.

BUG=2822
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/35999004

Cr-Commit-Position: refs/heads/master@{#8261}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8261 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-06 09:44:45 +00:00

63 lines
1.8 KiB
C++

/*
* Copyright (c) 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.
*/
// ViESharedData contains data and instances common to all interface
// implementations.
#ifndef WEBRTC_VIDEO_ENGINE_VIE_SHARED_DATA_H_
#define WEBRTC_VIDEO_ENGINE_VIE_SHARED_DATA_H_
#include <map>
#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
class Config;
class CpuOveruseObserver;
class ProcessThread;
class ViEChannelManager;
class ViEInputManager;
class ViERenderManager;
class ViESharedData {
public:
explicit ViESharedData(const Config& config);
~ViESharedData();
void SetLastError(const int error) const;
int LastErrorInternal() const;
int NumberOfCores() const;
// TODO(mflodman) Remove all calls to 'instance_id()'.
int instance_id() { return 0;}
ViEChannelManager* channel_manager() { return channel_manager_.get(); }
ViEInputManager* input_manager() { return input_manager_.get(); }
ViERenderManager* render_manager() { return render_manager_.get(); }
std::map<int, CpuOveruseObserver*>* overuse_observers() {
return &overuse_observers_; }
private:
const int number_cores_;
rtc::scoped_ptr<ViEChannelManager> channel_manager_;
rtc::scoped_ptr<ViEInputManager> input_manager_;
rtc::scoped_ptr<ViERenderManager> render_manager_;
rtc::scoped_ptr<ProcessThread> module_process_thread_;
mutable int last_error_;
std::map<int, CpuOveruseObserver*> overuse_observers_;
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_VIE_SHARED_DATA_H_