diff options
Diffstat (limited to 'webrtc/modules/utility/interface')
-rw-r--r-- | webrtc/modules/utility/interface/audio_frame_operations.h | 58 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/file_player.h | 111 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/file_recorder.h | 84 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/helpers_android.h | 87 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/helpers_ios.h | 59 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/jvm_android.h | 185 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/mock/mock_process_thread.h | 38 | ||||
-rw-r--r-- | webrtc/modules/utility/interface/process_thread.h | 66 |
8 files changed, 0 insertions, 688 deletions
diff --git a/webrtc/modules/utility/interface/audio_frame_operations.h b/webrtc/modules/utility/interface/audio_frame_operations.h deleted file mode 100644 index c2af68ab1b..0000000000 --- a/webrtc/modules/utility/interface/audio_frame_operations.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#ifndef WEBRTC_VOICE_ENGINE_AUDIO_FRAME_OPERATIONS_H_ -#define WEBRTC_VOICE_ENGINE_AUDIO_FRAME_OPERATIONS_H_ - -#include "webrtc/typedefs.h" - -namespace webrtc { - -class AudioFrame; - -// TODO(andrew): consolidate this with utility.h and audio_frame_manipulator.h. -// Change reference parameters to pointers. Consider using a namespace rather -// than a class. -class AudioFrameOperations { - public: - // Upmixes mono |src_audio| to stereo |dst_audio|. This is an out-of-place - // operation, meaning src_audio and dst_audio must point to different - // buffers. It is the caller's responsibility to ensure that |dst_audio| is - // sufficiently large. - static void MonoToStereo(const int16_t* src_audio, size_t samples_per_channel, - int16_t* dst_audio); - // |frame.num_channels_| will be updated. This version checks for sufficient - // buffer size and that |num_channels_| is mono. - static int MonoToStereo(AudioFrame* frame); - - // Downmixes stereo |src_audio| to mono |dst_audio|. This is an in-place - // operation, meaning |src_audio| and |dst_audio| may point to the same - // buffer. - static void StereoToMono(const int16_t* src_audio, size_t samples_per_channel, - int16_t* dst_audio); - // |frame.num_channels_| will be updated. This version checks that - // |num_channels_| is stereo. - static int StereoToMono(AudioFrame* frame); - - // Swap the left and right channels of |frame|. Fails silently if |frame| is - // not stereo. - static void SwapStereoChannels(AudioFrame* frame); - - // Zeros out the audio and sets |frame.energy| to zero. - static void Mute(AudioFrame& frame); - - static int Scale(float left, float right, AudioFrame& frame); - - static int ScaleWithSat(float scale, AudioFrame& frame); -}; - -} // namespace webrtc - -#endif // #ifndef WEBRTC_VOICE_ENGINE_AUDIO_FRAME_OPERATIONS_H_ diff --git a/webrtc/modules/utility/interface/file_player.h b/webrtc/modules/utility/interface/file_player.h deleted file mode 100644 index 44f03e475a..0000000000 --- a/webrtc/modules/utility/interface/file_player.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_FILE_PLAYER_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_FILE_PLAYER_H_ - -#include "webrtc/common_types.h" -#include "webrtc/engine_configurations.h" -#include "webrtc/modules/interface/module_common_types.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { -class FileCallback; - -class FilePlayer -{ -public: - // The largest decoded frame size in samples (60ms with 32kHz sample rate). - enum {MAX_AUDIO_BUFFER_IN_SAMPLES = 60*32}; - enum {MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES*2}; - - // Note: will return NULL for unsupported formats. - static FilePlayer* CreateFilePlayer(const uint32_t instanceID, - const FileFormats fileFormat); - - static void DestroyFilePlayer(FilePlayer* player); - - // Read 10 ms of audio at |frequencyInHz| to |outBuffer|. |lengthInSamples| - // will be set to the number of samples read (not the number of samples per - // channel). - virtual int Get10msAudioFromFile( - int16_t* outBuffer, - size_t& lengthInSamples, - int frequencyInHz) = 0; - - // Register callback for receiving file playing notifications. - virtual int32_t RegisterModuleFileCallback( - FileCallback* callback) = 0; - - // API for playing audio from fileName to channel. - // Note: codecInst is used for pre-encoded files. - virtual int32_t StartPlayingFile( - const char* fileName, - bool loop, - uint32_t startPosition, - float volumeScaling, - uint32_t notification, - uint32_t stopPosition = 0, - const CodecInst* codecInst = NULL) = 0; - - // Note: codecInst is used for pre-encoded files. - virtual int32_t StartPlayingFile( - InStream& sourceStream, - uint32_t startPosition, - float volumeScaling, - uint32_t notification, - uint32_t stopPosition = 0, - const CodecInst* codecInst = NULL) = 0; - - virtual int32_t StopPlayingFile() = 0; - - virtual bool IsPlayingFile() const = 0; - - virtual int32_t GetPlayoutPosition(uint32_t& durationMs) = 0; - - // Set audioCodec to the currently used audio codec. - virtual int32_t AudioCodec(CodecInst& audioCodec) const = 0; - - virtual int32_t Frequency() const = 0; - - // Note: scaleFactor is in the range [0.0 - 2.0] - virtual int32_t SetAudioScaling(float scaleFactor) = 0; - - // Return the time in ms until next video frame should be pulled (by - // calling GetVideoFromFile(..)). - // Note: this API reads one video frame from file. This means that it should - // be called exactly once per GetVideoFromFile(..) API call. - virtual int32_t TimeUntilNextVideoFrame() { return -1;} - - virtual int32_t StartPlayingVideoFile( - const char* /*fileName*/, - bool /*loop*/, - bool /*videoOnly*/) { return -1;} - - virtual int32_t video_codec_info(VideoCodec& /*videoCodec*/) const - {return -1;} - - virtual int32_t GetVideoFromFile(VideoFrame& /*videoFrame*/) { return -1; } - - // Same as GetVideoFromFile(). videoFrame will have the resolution specified - // by the width outWidth and height outHeight in pixels. - virtual int32_t GetVideoFromFile(VideoFrame& /*videoFrame*/, - const uint32_t /*outWidth*/, - const uint32_t /*outHeight*/) { - return -1; - } - -protected: - virtual ~FilePlayer() {} - -}; -} // namespace webrtc -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_FILE_PLAYER_H_ diff --git a/webrtc/modules/utility/interface/file_recorder.h b/webrtc/modules/utility/interface/file_recorder.h deleted file mode 100644 index f2ce785368..0000000000 --- a/webrtc/modules/utility/interface/file_recorder.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ - -#include "webrtc/common_types.h" -#include "webrtc/engine_configurations.h" -#include "webrtc/modules/interface/module_common_types.h" -#include "webrtc/modules/media_file/interface/media_file_defines.h" -#include "webrtc/system_wrappers/include/tick_util.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -class FileRecorder -{ -public: - - // Note: will return NULL for unsupported formats. - static FileRecorder* CreateFileRecorder(const uint32_t instanceID, - const FileFormats fileFormat); - - static void DestroyFileRecorder(FileRecorder* recorder); - - virtual int32_t RegisterModuleFileCallback( - FileCallback* callback) = 0; - - virtual FileFormats RecordingFileFormat() const = 0; - - virtual int32_t StartRecordingAudioFile( - const char* fileName, - const CodecInst& codecInst, - uint32_t notification) = 0; - - virtual int32_t StartRecordingAudioFile( - OutStream& destStream, - const CodecInst& codecInst, - uint32_t notification) = 0; - - // Stop recording. - // Note: this API is for both audio and video. - virtual int32_t StopRecording() = 0; - - // Return true if recording. - // Note: this API is for both audio and video. - virtual bool IsRecording() const = 0; - - virtual int32_t codec_info(CodecInst& codecInst) const = 0; - - // Write frame to file. Frame should contain 10ms of un-ecoded audio data. - virtual int32_t RecordAudioToFile( - const AudioFrame& frame, - const TickTime* playoutTS = NULL) = 0; - - // Open/create the file specified by fileName for writing audio/video data - // (relative path is allowed). audioCodecInst specifies the encoding of the - // audio data. videoCodecInst specifies the encoding of the video data. - // Only video data will be recorded if videoOnly is true. amrFormat - // specifies the amr/amrwb storage format. - // Note: the file format is AVI. - virtual int32_t StartRecordingVideoFile( - const char* fileName, - const CodecInst& audioCodecInst, - const VideoCodec& videoCodecInst, - bool videoOnly = false) = 0; - - // Record the video frame in videoFrame to AVI file. - virtual int32_t RecordVideoToFile(const VideoFrame& videoFrame) = 0; - -protected: - virtual ~FileRecorder() {} - -}; -} // namespace webrtc -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ diff --git a/webrtc/modules/utility/interface/helpers_android.h b/webrtc/modules/utility/interface/helpers_android.h deleted file mode 100644 index 5c73fe4566..0000000000 --- a/webrtc/modules/utility/interface/helpers_android.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_ANDROID_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_ANDROID_H_ - -#include <jni.h> -#include <string> - -// Abort the process if |jni| has a Java exception pending. -// TODO(henrika): merge with CHECK_JNI_EXCEPTION() in jni_helpers.h. -#define CHECK_EXCEPTION(jni) \ - RTC_CHECK(!jni->ExceptionCheck()) \ - << (jni->ExceptionDescribe(), jni->ExceptionClear(), "") - -namespace webrtc { - -// Return a |JNIEnv*| usable on this thread or NULL if this thread is detached. -JNIEnv* GetEnv(JavaVM* jvm); - -// Return a |jlong| that will correctly convert back to |ptr|. This is needed -// because the alternative (of silently passing a 32-bit pointer to a vararg -// function expecting a 64-bit param) picks up garbage in the high 32 bits. -jlong PointerTojlong(void* ptr); - -// JNIEnv-helper methods that wraps the API which uses the JNI interface -// pointer (JNIEnv*). It allows us to RTC_CHECK success and that no Java -// exception is thrown while calling the method. -jmethodID GetMethodID( - JNIEnv* jni, jclass c, const char* name, const char* signature); - -jmethodID GetStaticMethodID( - JNIEnv* jni, jclass c, const char* name, const char* signature); - -jclass FindClass(JNIEnv* jni, const char* name); - -jobject NewGlobalRef(JNIEnv* jni, jobject o); - -void DeleteGlobalRef(JNIEnv* jni, jobject o); - -// Return thread ID as a string. -std::string GetThreadId(); - -// Return thread ID as string suitable for debug logging. -std::string GetThreadInfo(); - -// Attach thread to JVM if necessary and detach at scope end if originally -// attached. -class AttachThreadScoped { - public: - explicit AttachThreadScoped(JavaVM* jvm); - ~AttachThreadScoped(); - JNIEnv* env(); - - private: - bool attached_; - JavaVM* jvm_; - JNIEnv* env_; -}; - -// Scoped holder for global Java refs. -template<class T> // T is jclass, jobject, jintArray, etc. -class ScopedGlobalRef { - public: - ScopedGlobalRef(JNIEnv* jni, T obj) - : jni_(jni), obj_(static_cast<T>(NewGlobalRef(jni, obj))) {} - ~ScopedGlobalRef() { - DeleteGlobalRef(jni_, obj_); - } - T operator*() const { - return obj_; - } - private: - JNIEnv* jni_; - T obj_; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_ANDROID_H_ diff --git a/webrtc/modules/utility/interface/helpers_ios.h b/webrtc/modules/utility/interface/helpers_ios.h deleted file mode 100644 index a5edee0279..0000000000 --- a/webrtc/modules/utility/interface/helpers_ios.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_IOS_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_IOS_H_ - -#if defined(WEBRTC_IOS) - -#include <string> - -namespace webrtc { -namespace ios { - -bool CheckAndLogError(BOOL success, NSError* error); - -std::string StdStringFromNSString(NSString* nsString); - -// Return thread ID as a string. -std::string GetThreadId(); - -// Return thread ID as string suitable for debug logging. -std::string GetThreadInfo(); - -// Returns [NSThread currentThread] description as string. -// Example: <NSThread: 0x170066d80>{number = 1, name = main} -std::string GetCurrentThreadDescription(); - -std::string GetAudioSessionCategory(); - -// Returns the current name of the operating system. -std::string GetSystemName(); - -// Returns the current version of the operating system. -std::string GetSystemVersion(); - -// Returns the version of the operating system as a floating point value. -float GetSystemVersionAsFloat(); - -// Returns the device type. -// Examples: ”iPhone” and ”iPod touch”. -std::string GetDeviceType(); - -// Returns a more detailed device name. -// Examples: "iPhone 5s (GSM)" and "iPhone 6 Plus". -std::string GetDeviceName(); - -} // namespace ios -} // namespace webrtc - -#endif // defined(WEBRTC_IOS) - -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_HELPERS_IOS_H_ diff --git a/webrtc/modules/utility/interface/jvm_android.h b/webrtc/modules/utility/interface/jvm_android.h deleted file mode 100644 index 0744fdbf12..0000000000 --- a/webrtc/modules/utility/interface/jvm_android.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ -#define WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ - -#include <jni.h> -#include <string> - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread_checker.h" -#include "webrtc/modules/utility/interface/helpers_android.h" - -namespace webrtc { - -// The JNI interface pointer (JNIEnv) is valid only in the current thread. -// Should another thread need to access the Java VM, it must first call -// AttachCurrentThread() to attach itself to the VM and obtain a JNI interface -// pointer. The native thread remains attached to the VM until it calls -// DetachCurrentThread() to detach. -class AttachCurrentThreadIfNeeded { - public: - AttachCurrentThreadIfNeeded(); - ~AttachCurrentThreadIfNeeded(); - - private: - rtc::ThreadChecker thread_checker_; - bool attached_; -}; - -// This class is created by the NativeRegistration class and is used to wrap -// the actual Java object handle (jobject) on which we can call methods from -// C++ in to Java. See example in JVM for more details. -// TODO(henrika): extend support for type of function calls. -class GlobalRef { - public: - GlobalRef(JNIEnv* jni, jobject object); - ~GlobalRef(); - - jboolean CallBooleanMethod(jmethodID methodID, ...); - jint CallIntMethod(jmethodID methodID, ...); - void CallVoidMethod(jmethodID methodID, ...); - - private: - JNIEnv* const jni_; - const jobject j_object_; -}; - -// Wraps the jclass object on which we can call GetMethodId() functions to -// query method IDs. -class JavaClass { - public: - JavaClass(JNIEnv* jni, jclass clazz) : jni_(jni), j_class_(clazz) {} - ~JavaClass() {} - - jmethodID GetMethodId(const char* name, const char* signature); - jmethodID GetStaticMethodId(const char* name, const char* signature); - jobject CallStaticObjectMethod(jmethodID methodID, ...); - - protected: - JNIEnv* const jni_; - jclass const j_class_; -}; - -// Adds support of the NewObject factory method to the JavaClass class. -// See example in JVM for more details on how to use it. -class NativeRegistration : public JavaClass { - public: - NativeRegistration(JNIEnv* jni, jclass clazz); - ~NativeRegistration(); - - rtc::scoped_ptr<GlobalRef> NewObject( - const char* name, const char* signature, ...); - - private: - JNIEnv* const jni_; -}; - -// This class is created by the JVM class and is used to expose methods that -// needs the JNI interface pointer but its main purpose is to create a -// NativeRegistration object given name of a Java class and a list of native -// methods. See example in JVM for more details. -class JNIEnvironment { - public: - explicit JNIEnvironment(JNIEnv* jni); - ~JNIEnvironment(); - - // Registers native methods with the Java class specified by |name|. - // Note that the class name must be one of the names in the static - // |loaded_classes| array defined in jvm_android.cc. - // This method must be called on the construction thread. - rtc::scoped_ptr<NativeRegistration> RegisterNatives( - const char* name, const JNINativeMethod *methods, int num_methods); - - // Converts from Java string to std::string. - // This method must be called on the construction thread. - std::string JavaToStdString(const jstring& j_string); - - private: - rtc::ThreadChecker thread_checker_; - JNIEnv* const jni_; -}; - -// Main class for working with Java from C++ using JNI in WebRTC. -// -// Example usage: -// -// // At initialization (e.g. in JNI_OnLoad), call JVM::Initialize. -// JNIEnv* jni = ::base::android::AttachCurrentThread(); -// JavaVM* jvm = NULL; -// jni->GetJavaVM(&jvm); -// jobject context = ::base::android::GetApplicationContext(); -// webrtc::JVM::Initialize(jvm, context); -// -// // Header (.h) file of example class called User. -// rtc::scoped_ptr<JNIEnvironment> env; -// rtc::scoped_ptr<NativeRegistration> reg; -// rtc::scoped_ptr<GlobalRef> obj; -// -// // Construction (in .cc file) of User class. -// User::User() { -// // Calling thread must be attached to the JVM. -// env = JVM::GetInstance()->environment(); -// reg = env->RegisterNatives("org/webrtc/WebRtcTest", ,); -// obj = reg->NewObject("<init>", ,); -// } -// -// // Each User method can now use |reg| and |obj| and call Java functions -// // in WebRtcTest.java, e.g. boolean init() {}. -// bool User::Foo() { -// jmethodID id = reg->GetMethodId("init", "()Z"); -// return obj->CallBooleanMethod(id); -// } -// -// // And finally, e.g. in JNI_OnUnLoad, call JVM::Uninitialize. -// JVM::Uninitialize(); -class JVM { - public: - // Stores global handles to the Java VM interface and the application context. - // Should be called once on a thread that is attached to the JVM. - static void Initialize(JavaVM* jvm, jobject context); - // Clears handles stored in Initialize(). Must be called on same thread as - // Initialize(). - static void Uninitialize(); - // Gives access to the global Java VM interface pointer, which then can be - // used to create a valid JNIEnvironment object or to get a JavaClass object. - static JVM* GetInstance(); - - // Creates a JNIEnvironment object. - // This method returns a NULL pointer if AttachCurrentThread() has not been - // called successfully. Use the AttachCurrentThreadIfNeeded class if needed. - rtc::scoped_ptr<JNIEnvironment> environment(); - - // Returns a JavaClass object given class |name|. - // Note that the class name must be one of the names in the static - // |loaded_classes| array defined in jvm_android.cc. - // This method must be called on the construction thread. - JavaClass GetClass(const char* name); - - // TODO(henrika): can we make these private? - JavaVM* jvm() const { return jvm_; } - jobject context() const { return context_; } - - protected: - JVM(JavaVM* jvm, jobject context); - ~JVM(); - - private: - JNIEnv* jni() const { return GetEnv(jvm_); } - - rtc::ThreadChecker thread_checker_; - JavaVM* const jvm_; - jobject context_; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ diff --git a/webrtc/modules/utility/interface/mock/mock_process_thread.h b/webrtc/modules/utility/interface/mock/mock_process_thread.h deleted file mode 100644 index fd108a8354..0000000000 --- a/webrtc/modules/utility/interface/mock/mock_process_thread.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_MOCK_PROCESS_THREAD_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_MOCK_PROCESS_THREAD_H_ - -#include "webrtc/modules/utility/interface/process_thread.h" - -#include "testing/gmock/include/gmock/gmock.h" - -namespace webrtc { - -class MockProcessThread : public ProcessThread { - public: - MOCK_METHOD0(Start, void()); - MOCK_METHOD0(Stop, void()); - MOCK_METHOD1(WakeUp, void(Module* module)); - MOCK_METHOD1(PostTask, void(ProcessTask* task)); - MOCK_METHOD1(RegisterModule, void(Module* module)); - MOCK_METHOD1(DeRegisterModule, void(Module* module)); - - // MOCK_METHOD1 gets confused with mocking this method, so we work around it - // by overriding the method from the interface and forwarding the call to a - // mocked, simpler method. - void PostTask(rtc::scoped_ptr<ProcessTask> task) override { - PostTask(task.get()); - } -}; - -} // namespace webrtc -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_MOCK_PROCESS_THREAD_H_ diff --git a/webrtc/modules/utility/interface/process_thread.h b/webrtc/modules/utility/interface/process_thread.h deleted file mode 100644 index 451a5a301b..0000000000 --- a/webrtc/modules/utility/interface/process_thread.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 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. - */ - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_ - -#include "webrtc/typedefs.h" -#include "webrtc/base/scoped_ptr.h" - -namespace webrtc { -class Module; - -class ProcessTask { - public: - ProcessTask() {} - virtual ~ProcessTask() {} - - virtual void Run() = 0; -}; - -class ProcessThread { - public: - virtual ~ProcessThread(); - - static rtc::scoped_ptr<ProcessThread> Create(const char* thread_name); - - // Starts the worker thread. Must be called from the construction thread. - virtual void Start() = 0; - - // Stops the worker thread. Must be called from the construction thread. - virtual void Stop() = 0; - - // Wakes the thread up to give a module a chance to do processing right - // away. This causes the worker thread to wake up and requery the specified - // module for when it should be called back. (Typically the module should - // return 0 from TimeUntilNextProcess on the worker thread at that point). - // Can be called on any thread. - virtual void WakeUp(Module* module) = 0; - - // Queues a task object to run on the worker thread. Ownership of the - // task object is transferred to the ProcessThread and the object will - // either be deleted after running on the worker thread, or on the - // construction thread of the ProcessThread instance, if the task did not - // get a chance to run (e.g. posting the task while shutting down or when - // the thread never runs). - virtual void PostTask(rtc::scoped_ptr<ProcessTask> task) = 0; - - // Adds a module that will start to receive callbacks on the worker thread. - // Can be called from any thread. - virtual void RegisterModule(Module* module) = 0; - - // Removes a previously registered module. - // Can be called from any thread. - virtual void DeRegisterModule(Module* module) = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_ |