OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "webrtc/modules/include/module_common_types.h" | 24 #include "webrtc/modules/include/module_common_types.h" |
25 #include "webrtc/modules/media_file/media_file.h" | 25 #include "webrtc/modules/media_file/media_file.h" |
26 #include "webrtc/modules/media_file/media_file_defines.h" | 26 #include "webrtc/modules/media_file/media_file_defines.h" |
27 #include "webrtc/modules/utility/include/file_recorder.h" | 27 #include "webrtc/modules/utility/include/file_recorder.h" |
28 #include "webrtc/modules/utility/source/coder.h" | 28 #include "webrtc/modules/utility/source/coder.h" |
29 #include "webrtc/system_wrappers/include/event_wrapper.h" | 29 #include "webrtc/system_wrappers/include/event_wrapper.h" |
30 #include "webrtc/typedefs.h" | 30 #include "webrtc/typedefs.h" |
31 | 31 |
32 namespace webrtc { | 32 namespace webrtc { |
33 // The largest decoded frame size in samples (60ms with 32kHz sample rate). | 33 // The largest decoded frame size in samples (60ms with 32kHz sample rate). |
34 enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60*32}; | 34 enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 }; |
35 enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES*2}; | 35 enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 }; |
36 enum { kMaxAudioBufferQueueLength = 100 }; | 36 enum { kMaxAudioBufferQueueLength = 100 }; |
37 | 37 |
38 class CriticalSectionWrapper; | 38 class CriticalSectionWrapper; |
39 | 39 |
40 class FileRecorderImpl : public FileRecorder | 40 class FileRecorderImpl : public FileRecorder { |
41 { | 41 public: |
42 public: | 42 FileRecorderImpl(uint32_t instanceID, FileFormats fileFormat); |
43 FileRecorderImpl(uint32_t instanceID, FileFormats fileFormat); | 43 virtual ~FileRecorderImpl(); |
44 virtual ~FileRecorderImpl(); | |
45 | 44 |
46 // FileRecorder functions. | 45 // FileRecorder functions. |
47 int32_t RegisterModuleFileCallback(FileCallback* callback) override; | 46 int32_t RegisterModuleFileCallback(FileCallback* callback) override; |
48 FileFormats RecordingFileFormat() const override; | 47 FileFormats RecordingFileFormat() const override; |
49 int32_t StartRecordingAudioFile( | 48 int32_t StartRecordingAudioFile(const char* fileName, |
50 const char* fileName, | 49 const CodecInst& codecInst, |
51 const CodecInst& codecInst, | 50 uint32_t notificationTimeMs) override; |
52 uint32_t notificationTimeMs) override; | 51 int32_t StartRecordingAudioFile(OutStream& destStream, |
53 int32_t StartRecordingAudioFile( | 52 const CodecInst& codecInst, |
54 OutStream& destStream, | 53 uint32_t notificationTimeMs) override; |
55 const CodecInst& codecInst, | 54 int32_t StopRecording() override; |
56 uint32_t notificationTimeMs) override; | 55 bool IsRecording() const override; |
57 int32_t StopRecording() override; | 56 int32_t codec_info(CodecInst& codecInst) const override; |
58 bool IsRecording() const override; | 57 int32_t RecordAudioToFile(const AudioFrame& frame) override; |
59 int32_t codec_info(CodecInst& codecInst) const override; | |
60 int32_t RecordAudioToFile(const AudioFrame& frame) override; | |
61 | 58 |
62 protected: | 59 protected: |
63 int32_t WriteEncodedAudioData(const int8_t* audioBuffer, | 60 int32_t WriteEncodedAudioData(const int8_t* audioBuffer, size_t bufferLength); |
64 size_t bufferLength); | |
65 | 61 |
66 int32_t SetUpAudioEncoder(); | 62 int32_t SetUpAudioEncoder(); |
67 | 63 |
68 uint32_t _instanceID; | 64 uint32_t _instanceID; |
69 FileFormats _fileFormat; | 65 FileFormats _fileFormat; |
70 MediaFile* _moduleFile; | 66 MediaFile* _moduleFile; |
71 | 67 |
72 private: | 68 private: |
73 CodecInst codec_info_; | 69 CodecInst codec_info_; |
74 int8_t _audioBuffer[MAX_AUDIO_BUFFER_IN_BYTES]; | 70 int8_t _audioBuffer[MAX_AUDIO_BUFFER_IN_BYTES]; |
75 AudioCoder _audioEncoder; | 71 AudioCoder _audioEncoder; |
76 Resampler _audioResampler; | 72 Resampler _audioResampler; |
77 }; | 73 }; |
78 } // namespace webrtc | 74 } // namespace webrtc |
79 #endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_RECORDER_IMPL_H_ | 75 #endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_RECORDER_IMPL_H_ |
OLD | NEW |