FilePlayer: Remove backwards compatibility stuff that we no longer need
This includes renaming NewFilePlayer to CreateFilePlayer. Review-Url: https://codereview.webrtc.org/2319123003 Cr-Commit-Position: refs/heads/master@{#14128}
This commit is contained in:
@ -29,15 +29,10 @@ 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(
|
||||
static std::unique_ptr<FilePlayer> CreateFilePlayer(
|
||||
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|
|
||||
@ -81,28 +76,6 @@ class FilePlayer {
|
||||
|
||||
// Note: scaleFactor is in the range [0.0 - 2.0]
|
||||
virtual int32_t SetAudioScaling(float scaleFactor) = 0;
|
||||
|
||||
// Deprecated functions. Use the functions above with the same name instead.
|
||||
int Get10msAudioFromFile(int16_t* outBuffer,
|
||||
size_t& lengthInSamples,
|
||||
int frequencyInHz) {
|
||||
return Get10msAudioFromFile(outBuffer, &lengthInSamples, frequencyInHz);
|
||||
}
|
||||
int32_t StartPlayingFile(InStream& sourceStream,
|
||||
uint32_t startPosition,
|
||||
float volumeScaling,
|
||||
uint32_t notification,
|
||||
uint32_t stopPosition,
|
||||
const CodecInst* codecInst) {
|
||||
return StartPlayingFile(&sourceStream, startPosition, volumeScaling,
|
||||
notification, stopPosition, codecInst);
|
||||
}
|
||||
int32_t GetPlayoutPosition(uint32_t& durationMs) {
|
||||
return GetPlayoutPosition(&durationMs);
|
||||
}
|
||||
int32_t AudioCodec(CodecInst& audioCodec) const {
|
||||
return AudioCodec(&audioCodec);
|
||||
}
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_
|
||||
|
||||
@ -371,7 +371,7 @@ int32_t FilePlayerImpl::SetUpAudioDecoder() {
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<FilePlayer> FilePlayer::NewFilePlayer(
|
||||
std::unique_ptr<FilePlayer> FilePlayer::CreateFilePlayer(
|
||||
uint32_t instanceID,
|
||||
FileFormats fileFormat) {
|
||||
switch (fileFormat) {
|
||||
@ -390,13 +390,4 @@ std::unique_ptr<FilePlayer> FilePlayer::NewFilePlayer(
|
||||
}
|
||||
}
|
||||
|
||||
FilePlayer* FilePlayer::CreateFilePlayer(uint32_t instanceID,
|
||||
FileFormats fileFormat) {
|
||||
return FilePlayer::NewFilePlayer(instanceID, fileFormat).release();
|
||||
}
|
||||
|
||||
void FilePlayer::DestroyFilePlayer(FilePlayer* player) {
|
||||
delete player;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -34,7 +34,7 @@ class FilePlayerTest : public ::testing::Test {
|
||||
static const int kSampleRateHz = 8000;
|
||||
|
||||
FilePlayerTest()
|
||||
: player_(FilePlayer::NewFilePlayer(kId, kFileFormat)),
|
||||
: player_(FilePlayer::CreateFilePlayer(kId, kFileFormat)),
|
||||
output_file_(NULL) {}
|
||||
|
||||
void SetUp() override {
|
||||
|
||||
@ -1739,7 +1739,7 @@ int Channel::StartPlayingFileLocally(const char* fileName,
|
||||
output_file_player_.reset();
|
||||
}
|
||||
|
||||
output_file_player_ = FilePlayer::NewFilePlayer(
|
||||
output_file_player_ = FilePlayer::CreateFilePlayer(
|
||||
_outputFilePlayerId, (const FileFormats)format);
|
||||
|
||||
if (!output_file_player_) {
|
||||
@ -1806,7 +1806,7 @@ int Channel::StartPlayingFileLocally(InStream* stream,
|
||||
}
|
||||
|
||||
// Create the instance
|
||||
output_file_player_ = FilePlayer::NewFilePlayer(
|
||||
output_file_player_ = FilePlayer::CreateFilePlayer(
|
||||
_outputFilePlayerId, (const FileFormats)format);
|
||||
|
||||
if (!output_file_player_) {
|
||||
@ -1934,7 +1934,7 @@ int Channel::StartPlayingFileAsMicrophone(const char* fileName,
|
||||
}
|
||||
|
||||
// Create the instance
|
||||
input_file_player_ = FilePlayer::NewFilePlayer(_inputFilePlayerId,
|
||||
input_file_player_ = FilePlayer::CreateFilePlayer(_inputFilePlayerId,
|
||||
(const FileFormats)format);
|
||||
|
||||
if (!input_file_player_) {
|
||||
@ -1996,7 +1996,7 @@ int Channel::StartPlayingFileAsMicrophone(InStream* stream,
|
||||
}
|
||||
|
||||
// Create the instance
|
||||
input_file_player_ = FilePlayer::NewFilePlayer(_inputFilePlayerId,
|
||||
input_file_player_ = FilePlayer::CreateFilePlayer(_inputFilePlayerId,
|
||||
(const FileFormats)format);
|
||||
|
||||
if (!input_file_player_) {
|
||||
|
||||
@ -491,7 +491,7 @@ int TransmitMixer::StartPlayingFileAsMicrophone(const char* fileName,
|
||||
|
||||
// Dynamically create the instance
|
||||
file_player_ =
|
||||
FilePlayer::NewFilePlayer(_filePlayerId, (const FileFormats)format);
|
||||
FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
|
||||
|
||||
if (!file_player_) {
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
@ -557,7 +557,7 @@ int TransmitMixer::StartPlayingFileAsMicrophone(InStream* stream,
|
||||
|
||||
// Dynamically create the instance
|
||||
file_player_ =
|
||||
FilePlayer::NewFilePlayer(_filePlayerId, (const FileFormats)format);
|
||||
FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
|
||||
|
||||
if (!file_player_) {
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
|
||||
Reference in New Issue
Block a user