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

Unified Diff: webrtc/modules/utility/include/file_player.h

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/include/file_player.h
diff --git a/webrtc/modules/utility/include/file_player.h b/webrtc/modules/utility/include/file_player.h
index d11261de869733971b291ea9106894ad59dfca1b..5f79fd28e21c5598d5ac835e164c305b65204e6b 100644
--- a/webrtc/modules/utility/include/file_player.h
+++ b/webrtc/modules/utility/include/file_player.h
@@ -11,12 +11,15 @@
#ifndef WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_
#define WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_
+#include <memory>
+
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/typedefs.h"
namespace webrtc {
+
class FileCallback;
class FilePlayer {
@@ -26,11 +29,17 @@ class FilePlayer {
enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 };
// Note: will return NULL for unsupported formats.
+ static std::unique_ptr<FilePlayer> NewFilePlayer(
ossu 2016/08/17 11:09:05 I've a slight issue with the naming here, though I
kwiberg-webrtc 2016/08/17 12:27:39 FilePlayer::CreatePlayer is probably just as rare
ossu 2016/08/17 13:49:13 Alright, I'm fine with that! Just didn't want us t
+ const uint32_t instanceID,
+ const FileFormats fileFormat);
+
+ // Deprecated creation/destruction functions. Use NewFilePlayer instead.
static FilePlayer* CreateFilePlayer(const uint32_t instanceID,
const FileFormats fileFormat);
-
static void DestroyFilePlayer(FilePlayer* player);
+ virtual ~FilePlayer() = default;
+
// 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).
@@ -72,9 +81,6 @@ class FilePlayer {
// Note: scaleFactor is in the range [0.0 - 2.0]
virtual int32_t SetAudioScaling(float scaleFactor) = 0;
-
- protected:
- virtual ~FilePlayer() {}
};
} // namespace webrtc
#endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_

Powered by Google App Engine
This is Rietveld 408576698