Removes id parameter in ADM factory method

Bug: webrtc:7306
Change-Id: I1c9def8c9bcd30da245ecf1894670f4b492547fc
Reviewed-on: https://webrtc-review.googlesource.com/21980
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20630}
This commit is contained in:
henrika
2017-11-10 11:21:03 +01:00
committed by Commit Bot
parent b3a8c980f7
commit cba3d274da
6 changed files with 16 additions and 12 deletions

View File

@ -20,10 +20,8 @@ namespace {
// callback and redirects the PCM data to AudioDeviceDataObserver callback.
class ADMWrapper : public AudioDeviceModule, public AudioTransport {
public:
ADMWrapper(const int32_t id,
const AudioLayer audio_layer,
AudioDeviceDataObserver* observer)
: impl_(AudioDeviceModule::Create(id, audio_layer)), observer_(observer) {
ADMWrapper(const AudioLayer audio_layer, AudioDeviceDataObserver* observer)
: impl_(AudioDeviceModule::Create(audio_layer)), observer_(observer) {
// Register self as the audio transport callback for underlying ADM impl.
auto res = impl_->RegisterAudioCallback(this);
is_valid_ = (impl_.get() != nullptr) && (res == 0);
@ -308,11 +306,10 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
} // namespace
rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
const int32_t id,
const AudioDeviceModule::AudioLayer audio_layer,
AudioDeviceDataObserver* observer) {
rtc::scoped_refptr<ADMWrapper> audio_device(
new rtc::RefCountedObject<ADMWrapper>(id, audio_layer, observer));
new rtc::RefCountedObject<ADMWrapper>(audio_layer, observer));
if (!audio_device->IsValid()) {
return nullptr;

View File

@ -65,9 +65,7 @@
namespace webrtc {
// static
// TODO(henrika): remove id parameter when all clients are updated.
rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
const int32_t id,
const AudioLayer audio_layer) {
RTC_LOG(INFO) << __FUNCTION__;
// Create the generic reference counted (platform independent) implementation.
@ -93,6 +91,14 @@ rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
return audioDevice;
}
// TODO(bugs.webrtc.org/7306): deprecated.
rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
const int32_t id,
const AudioLayer audio_layer) {
RTC_LOG(INFO) << __FUNCTION__;
return AudioDeviceModule::Create(audio_layer);
}
AudioDeviceModuleImpl::AudioDeviceModuleImpl(const AudioLayer audioLayer)
: audio_layer_(audioLayer) {
RTC_LOG(INFO) << __FUNCTION__;

View File

@ -461,7 +461,7 @@ class AudioDeviceTest : public ::testing::Test {
// rtc::LogMessage::LogTimestamps();
// rtc::LogMessage::LogThreads();
audio_device_ =
AudioDeviceModule::Create(0, AudioDeviceModule::kPlatformDefaultAudio);
AudioDeviceModule::Create(AudioDeviceModule::kPlatformDefaultAudio);
EXPECT_NE(audio_device_.get(), nullptr);
AudioDeviceModule::AudioLayer audio_layer;
int got_platform_audio_layer =

View File

@ -50,7 +50,9 @@ class AudioDeviceModule : public rtc::RefCountInterface {
public:
// Create an ADM.
// TODO(henrika): remove |id|.
static rtc::scoped_refptr<AudioDeviceModule> Create(
const AudioLayer audio_layer);
// TODO(bugs.webrtc.org/7306): deprecated.
static rtc::scoped_refptr<AudioDeviceModule> Create(
const int32_t id,
const AudioLayer audio_layer);

View File

@ -25,7 +25,7 @@ using webrtc::AudioDeviceModule;
int main(int /*argc*/, char** /*argv*/) {
// Create and initialize the ADM.
rtc::scoped_refptr<AudioDeviceModule> adm(
AudioDeviceModule::Create(1, AudioDeviceModule::kPlatformDefaultAudio));
AudioDeviceModule::Create(AudioDeviceModule::kPlatformDefaultAudio));
if (!adm.get()) {
fprintf(stderr, "Failed to create Audio Device Module.\n");
return 1;

View File

@ -160,7 +160,6 @@ int VoEBaseImpl::Init(
#else
// Create the internal ADM implementation.
shared_->set_audio_device(AudioDeviceModule::Create(
VoEId(shared_->instance_id(), -1),
AudioDeviceModule::kPlatformDefaultAudio));
if (shared_->audio_device() == nullptr) {
RTC_LOG(LS_ERROR) << "Init() failed to create the ADM";