Revert "Removes id parameter in ADM factory method"

This reverts commit cba3d274daaf57b3c6e8bc6cd10b959cf2ec73bf.

Reason for revert: Breaking internal projects

Original change's description:
> 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}

TBR=solenberg@webrtc.org,henrika@webrtc.org

Change-Id: Ie60a44d64df28ec8779305f3c7e3b071100c643f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7306
Reviewed-on: https://webrtc-review.googlesource.com/22200
Reviewed-by: Lu Liu <lliuu@webrtc.org>
Commit-Queue: Lu Liu <lliuu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20637}
This commit is contained in:
Lu Liu
2017-11-10 19:32:09 +00:00
committed by Commit Bot
parent cda2525633
commit cda2562b06
6 changed files with 12 additions and 16 deletions

View File

@ -20,8 +20,10 @@ namespace {
// callback and redirects the PCM data to AudioDeviceDataObserver callback.
class ADMWrapper : public AudioDeviceModule, public AudioTransport {
public:
ADMWrapper(const AudioLayer audio_layer, AudioDeviceDataObserver* observer)
: impl_(AudioDeviceModule::Create(audio_layer)), observer_(observer) {
ADMWrapper(const int32_t id,
const AudioLayer audio_layer,
AudioDeviceDataObserver* observer)
: impl_(AudioDeviceModule::Create(id, 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);
@ -306,10 +308,11 @@ 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>(audio_layer, observer));
new rtc::RefCountedObject<ADMWrapper>(id, audio_layer, observer));
if (!audio_device->IsValid()) {
return nullptr;

View File

@ -65,7 +65,9 @@
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.
@ -91,14 +93,6 @@ 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(AudioDeviceModule::kPlatformDefaultAudio);
AudioDeviceModule::Create(0, AudioDeviceModule::kPlatformDefaultAudio);
EXPECT_NE(audio_device_.get(), nullptr);
AudioDeviceModule::AudioLayer audio_layer;
int got_platform_audio_layer =

View File

@ -50,9 +50,7 @@ class AudioDeviceModule : public rtc::RefCountInterface {
public:
// Create an ADM.
static rtc::scoped_refptr<AudioDeviceModule> Create(
const AudioLayer audio_layer);
// TODO(bugs.webrtc.org/7306): deprecated.
// TODO(henrika): remove |id|.
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(AudioDeviceModule::kPlatformDefaultAudio));
AudioDeviceModule::Create(1, AudioDeviceModule::kPlatformDefaultAudio));
if (!adm.get()) {
fprintf(stderr, "Failed to create Audio Device Module.\n");
return 1;

View File

@ -160,6 +160,7 @@ 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";