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:
@ -20,10 +20,8 @@ namespace {
|
|||||||
// callback and redirects the PCM data to AudioDeviceDataObserver callback.
|
// callback and redirects the PCM data to AudioDeviceDataObserver callback.
|
||||||
class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||||
public:
|
public:
|
||||||
ADMWrapper(const int32_t id,
|
ADMWrapper(const AudioLayer audio_layer, AudioDeviceDataObserver* observer)
|
||||||
const AudioLayer audio_layer,
|
: impl_(AudioDeviceModule::Create(audio_layer)), observer_(observer) {
|
||||||
AudioDeviceDataObserver* observer)
|
|
||||||
: impl_(AudioDeviceModule::Create(id, audio_layer)), observer_(observer) {
|
|
||||||
// Register self as the audio transport callback for underlying ADM impl.
|
// Register self as the audio transport callback for underlying ADM impl.
|
||||||
auto res = impl_->RegisterAudioCallback(this);
|
auto res = impl_->RegisterAudioCallback(this);
|
||||||
is_valid_ = (impl_.get() != nullptr) && (res == 0);
|
is_valid_ = (impl_.get() != nullptr) && (res == 0);
|
||||||
@ -308,11 +306,10 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
|
rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
|
||||||
const int32_t id,
|
|
||||||
const AudioDeviceModule::AudioLayer audio_layer,
|
const AudioDeviceModule::AudioLayer audio_layer,
|
||||||
AudioDeviceDataObserver* observer) {
|
AudioDeviceDataObserver* observer) {
|
||||||
rtc::scoped_refptr<ADMWrapper> audio_device(
|
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()) {
|
if (!audio_device->IsValid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -65,9 +65,7 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
// TODO(henrika): remove id parameter when all clients are updated.
|
|
||||||
rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
|
rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
|
||||||
const int32_t id,
|
|
||||||
const AudioLayer audio_layer) {
|
const AudioLayer audio_layer) {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
// Create the generic reference counted (platform independent) implementation.
|
// Create the generic reference counted (platform independent) implementation.
|
||||||
@ -93,6 +91,14 @@ rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
|
|||||||
return audioDevice;
|
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)
|
AudioDeviceModuleImpl::AudioDeviceModuleImpl(const AudioLayer audioLayer)
|
||||||
: audio_layer_(audioLayer) {
|
: audio_layer_(audioLayer) {
|
||||||
RTC_LOG(INFO) << __FUNCTION__;
|
RTC_LOG(INFO) << __FUNCTION__;
|
||||||
|
@ -461,7 +461,7 @@ class AudioDeviceTest : public ::testing::Test {
|
|||||||
// rtc::LogMessage::LogTimestamps();
|
// rtc::LogMessage::LogTimestamps();
|
||||||
// rtc::LogMessage::LogThreads();
|
// rtc::LogMessage::LogThreads();
|
||||||
audio_device_ =
|
audio_device_ =
|
||||||
AudioDeviceModule::Create(0, AudioDeviceModule::kPlatformDefaultAudio);
|
AudioDeviceModule::Create(AudioDeviceModule::kPlatformDefaultAudio);
|
||||||
EXPECT_NE(audio_device_.get(), nullptr);
|
EXPECT_NE(audio_device_.get(), nullptr);
|
||||||
AudioDeviceModule::AudioLayer audio_layer;
|
AudioDeviceModule::AudioLayer audio_layer;
|
||||||
int got_platform_audio_layer =
|
int got_platform_audio_layer =
|
||||||
|
@ -50,7 +50,9 @@ class AudioDeviceModule : public rtc::RefCountInterface {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Create an ADM.
|
// 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(
|
static rtc::scoped_refptr<AudioDeviceModule> Create(
|
||||||
const int32_t id,
|
const int32_t id,
|
||||||
const AudioLayer audio_layer);
|
const AudioLayer audio_layer);
|
||||||
|
@ -25,7 +25,7 @@ using webrtc::AudioDeviceModule;
|
|||||||
int main(int /*argc*/, char** /*argv*/) {
|
int main(int /*argc*/, char** /*argv*/) {
|
||||||
// Create and initialize the ADM.
|
// Create and initialize the ADM.
|
||||||
rtc::scoped_refptr<AudioDeviceModule> adm(
|
rtc::scoped_refptr<AudioDeviceModule> adm(
|
||||||
AudioDeviceModule::Create(1, AudioDeviceModule::kPlatformDefaultAudio));
|
AudioDeviceModule::Create(AudioDeviceModule::kPlatformDefaultAudio));
|
||||||
if (!adm.get()) {
|
if (!adm.get()) {
|
||||||
fprintf(stderr, "Failed to create Audio Device Module.\n");
|
fprintf(stderr, "Failed to create Audio Device Module.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -160,7 +160,6 @@ int VoEBaseImpl::Init(
|
|||||||
#else
|
#else
|
||||||
// Create the internal ADM implementation.
|
// Create the internal ADM implementation.
|
||||||
shared_->set_audio_device(AudioDeviceModule::Create(
|
shared_->set_audio_device(AudioDeviceModule::Create(
|
||||||
VoEId(shared_->instance_id(), -1),
|
|
||||||
AudioDeviceModule::kPlatformDefaultAudio));
|
AudioDeviceModule::kPlatformDefaultAudio));
|
||||||
if (shared_->audio_device() == nullptr) {
|
if (shared_->audio_device() == nullptr) {
|
||||||
RTC_LOG(LS_ERROR) << "Init() failed to create the ADM";
|
RTC_LOG(LS_ERROR) << "Init() failed to create the ADM";
|
||||||
|
Reference in New Issue
Block a user