Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions webrtc-sys/src/adm_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ bool AdmProxy::EnsurePlatformAdmCreated() {
return false;
}

// Backfill the audio callback registration. WebRTC performs its one-time
// RegisterAudioCallback() early -- typically before the app constructs
// PlatformAudio and triggers this lazy creation -- so audio_transport_ was
// captured then but never delivered to the platform ADM. Without this the
// platform ADM runs with no transport wired up and writes silence.
if (audio_transport_) {
platform_adm_->RegisterAudioCallback(audio_transport_);
RTC_LOG(LS_VERBOSE) << "AdmProxy: backfilled audio transport to newly "
<< "created Android platform ADM";
}

return true;
}
#endif
Expand Down Expand Up @@ -297,6 +308,19 @@ int32_t AdmProxy::RegisterAudioCallback(webrtc::AudioTransport* transport) {
if (platform_adm_) {
platform_adm_->RegisterAudioCallback(transport);
}
#if defined(__ANDROID__)
else {
// On Android the platform ADM is created lazily (EnsurePlatformAdmCreated),
// so it usually does not exist yet at this one-time registration. The
// transport is retained in audio_transport_ and backfilled to the platform
// ADM when it is created; until then only the synthetic ADM is wired, which
// is the correct state for synthetic-only usage.
RTC_LOG(LS_INFO)
<< "AdmProxy::RegisterAudioCallback() - platform_adm_ not yet created "
<< "on Android; audio transport retained and will be backfilled when "
<< "the platform ADM is created.";
}
#endif
return 0;
}

Expand Down
Loading