From 5b356f46bb88ba32c0250de9a75036dc2b114aef Mon Sep 17 00:00:00 2001 From: kwiberg Date: Thu, 8 Sep 2016 04:32:33 -0700 Subject: [PATCH] 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} --- webrtc/modules/utility/include/file_player.h | 29 +------------------ webrtc/modules/utility/source/file_player.cc | 11 +------ .../utility/source/file_player_unittests.cc | 2 +- webrtc/voice_engine/channel.cc | 8 ++--- webrtc/voice_engine/transmit_mixer.cc | 4 +-- 5 files changed, 9 insertions(+), 45 deletions(-) diff --git a/webrtc/modules/utility/include/file_player.h b/webrtc/modules/utility/include/file_player.h index 296b9ea37c..0020514ab3 100644 --- a/webrtc/modules/utility/include/file_player.h +++ b/webrtc/modules/utility/include/file_player.h @@ -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 NewFilePlayer( + static std::unique_ptr 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_ diff --git a/webrtc/modules/utility/source/file_player.cc b/webrtc/modules/utility/source/file_player.cc index 75b7214f5c..bf6d26939f 100644 --- a/webrtc/modules/utility/source/file_player.cc +++ b/webrtc/modules/utility/source/file_player.cc @@ -371,7 +371,7 @@ int32_t FilePlayerImpl::SetUpAudioDecoder() { } // namespace -std::unique_ptr FilePlayer::NewFilePlayer( +std::unique_ptr FilePlayer::CreateFilePlayer( uint32_t instanceID, FileFormats fileFormat) { switch (fileFormat) { @@ -390,13 +390,4 @@ std::unique_ptr 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 diff --git a/webrtc/modules/utility/source/file_player_unittests.cc b/webrtc/modules/utility/source/file_player_unittests.cc index 022bec020a..337c6340b5 100644 --- a/webrtc/modules/utility/source/file_player_unittests.cc +++ b/webrtc/modules/utility/source/file_player_unittests.cc @@ -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 { diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 301b5a6f8b..a1095e3216 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -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_) { diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc index 6fcc64452f..834510d8f6 100644 --- a/webrtc/voice_engine/transmit_mixer.cc +++ b/webrtc/voice_engine/transmit_mixer.cc @@ -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(