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

Unified Diff: webrtc/modules/utility/source/file_recorder.cc

Issue 2049683003: FileRecorder + FilePlayer: Let Create functions return unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@remove3
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.cc
diff --git a/webrtc/modules/utility/source/file_recorder.cc b/webrtc/modules/utility/source/file_recorder.cc
index 63d2f1be094d6eee8a4f7f079e5f7183254f79f3..3ba7967cdc435b0e301ae0f84dbd975c958a0bc0 100644
--- a/webrtc/modules/utility/source/file_recorder.cc
+++ b/webrtc/modules/utility/source/file_recorder.cc
@@ -40,7 +40,7 @@ class CriticalSectionWrapper;
class FileRecorderImpl : public FileRecorder {
public:
FileRecorderImpl(uint32_t instanceID, FileFormats fileFormat);
- virtual ~FileRecorderImpl();
+ ~FileRecorderImpl() override;
// FileRecorder functions.
int32_t RegisterModuleFileCallback(FileCallback* callback) override;
@@ -56,7 +56,7 @@ class FileRecorderImpl : public FileRecorder {
int32_t codec_info(CodecInst& codecInst) const override;
int32_t RecordAudioToFile(const AudioFrame& frame) override;
- protected:
+ private:
int32_t WriteEncodedAudioData(const int8_t* audioBuffer, size_t bufferLength);
int32_t SetUpAudioEncoder();
@@ -65,7 +65,6 @@ class FileRecorderImpl : public FileRecorder {
FileFormats _fileFormat;
MediaFile* _moduleFile;
- private:
CodecInst codec_info_;
int8_t _audioBuffer[MAX_AUDIO_BUFFER_IN_BYTES];
AudioCoder _audioEncoder;
@@ -255,13 +254,11 @@ int32_t FileRecorderImpl::WriteEncodedAudioData(const int8_t* audioBuffer,
} // namespace
-FileRecorder* FileRecorder::CreateFileRecorder(uint32_t instanceID,
- FileFormats fileFormat) {
- return new FileRecorderImpl(instanceID, fileFormat);
-}
-
-void FileRecorder::DestroyFileRecorder(FileRecorder* recorder) {
- delete recorder;
+std::unique_ptr<FileRecorder> FileRecorder::CreateFileRecorder(
+ uint32_t instanceID,
+ FileFormats fileFormat) {
+ return std::unique_ptr<FileRecorder>(
+ new FileRecorderImpl(instanceID, fileFormat));
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698