Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: webrtc/modules/utility/source/file_recorder_impl.h

Issue 2245153002: Revert of Move FilePlayer and FileRecorder to Voice Engine (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/utility/source/file_recorder_impl.h
diff --git a/webrtc/modules/utility/source/file_recorder_impl.h b/webrtc/modules/utility/source/file_recorder_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9dd3a88633afe44bbd059cba056bcdad58dac61
--- /dev/null
+++ b/webrtc/modules/utility/source/file_recorder_impl.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+// This file contains a class that can write audio to file in
+// multiple file formats. The unencoded input data is written to file in the
+// encoded format specified.
+
+#ifndef WEBRTC_MODULES_UTILITY_SOURCE_FILE_RECORDER_IMPL_H_
+#define WEBRTC_MODULES_UTILITY_SOURCE_FILE_RECORDER_IMPL_H_
+
+#include <list>
+
+#include "webrtc/base/platform_thread.h"
+#include "webrtc/common_audio/resampler/include/resampler.h"
+#include "webrtc/common_types.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/modules/include/module_common_types.h"
+#include "webrtc/modules/media_file/media_file.h"
+#include "webrtc/modules/media_file/media_file_defines.h"
+#include "webrtc/modules/utility/include/file_recorder.h"
+#include "webrtc/modules/utility/source/coder.h"
+#include "webrtc/system_wrappers/include/event_wrapper.h"
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+// 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};
+enum { kMaxAudioBufferQueueLength = 100 };
+
+class CriticalSectionWrapper;
+
+class FileRecorderImpl : public FileRecorder
+{
+public:
+ FileRecorderImpl(uint32_t instanceID, FileFormats fileFormat);
+ virtual ~FileRecorderImpl();
+
+ // FileRecorder functions.
+ int32_t RegisterModuleFileCallback(FileCallback* callback) override;
+ FileFormats RecordingFileFormat() const override;
+ int32_t StartRecordingAudioFile(
+ const char* fileName,
+ const CodecInst& codecInst,
+ uint32_t notificationTimeMs) override;
+ int32_t StartRecordingAudioFile(
+ OutStream& destStream,
+ const CodecInst& codecInst,
+ uint32_t notificationTimeMs) override;
+ int32_t StopRecording() override;
+ bool IsRecording() const override;
+ int32_t codec_info(CodecInst& codecInst) const override;
+ int32_t RecordAudioToFile(const AudioFrame& frame) override;
+
+protected:
+ int32_t WriteEncodedAudioData(const int8_t* audioBuffer,
+ size_t bufferLength);
+
+ int32_t SetUpAudioEncoder();
+
+ uint32_t _instanceID;
+ FileFormats _fileFormat;
+ MediaFile* _moduleFile;
+
+private:
+ CodecInst codec_info_;
+ int8_t _audioBuffer[MAX_AUDIO_BUFFER_IN_BYTES];
+ AudioCoder _audioEncoder;
+ Resampler _audioResampler;
+};
+} // namespace webrtc
+#endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_RECORDER_IMPL_H_
« no previous file with comments | « webrtc/modules/utility/source/file_player_unittests.cc ('k') | webrtc/modules/utility/source/file_recorder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698