Improve error logging for AUAudioInputStream [chromium/src : main]

0 views
Skip to first unread message

Olga Sharonova (Gerrit)

unread,
Apr 15, 2026, 10:32:56 AM (8 days ago) Apr 15
to Palak Agarwal, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Palak Agarwal

Olga Sharonova added 10 comments

File media/audio/apple/audio_low_latency_input.h
Line 161, Patchset 7 (Latest): const char* func_name,
Olga Sharonova . unresolved

We don't really need a function name: we have a unique error message which points to the exact place in the source code.

File media/audio/apple/audio_low_latency_input.cc
Line 233, Patchset 7 (Latest): "Device ID is unknown; Returning OpenOutcome::kFailed");
Olga Sharonova . unresolved

not needed: we have the source code we can look at.

Line 800, Patchset 7 (Latest): base::StringPrintf("%s: [this=%p] Stop() called", __FUNCTION__, this));
Olga Sharonova . unresolved

We know it's Stop(): we have FUNCTION

Line 840, Patchset 7 (Latest): base::StringPrintf("%s: [this=%p] Close() called", __FUNCTION__, this));
Olga Sharonova . unresolved

Same - could you ensure throughout that we are not unnecessarily verbose?

Line 885, Patchset 7 (Latest): std::string error_string = base::StringPrintf(
"%s: [this=%p] voice processing disabled", __FUNCTION__, this);
DVLOG(1) << error_string;
log_callback_.Run(error_string);
Olga Sharonova . unresolved

not needed, it will be noise/spam

Line 895, Patchset 7 (Latest): std::string error_string = base::StringPrintf(
"%s: [this=%p] audio_device_id is same as output_device_id_for_aec_",
__FUNCTION__, this);
log_callback_.Run(error_string);
DVLOG(1) << error_string;
Olga Sharonova . unresolved

not needed

Line 1127, Patchset 7 (Latest): std::string error_string = "AudioUnitRender() failed ";
Olga Sharonova . unresolved

We don't want to use std::string here: it uses heap to store the string, we end up with dynamic memory allocation. And this code runs on a real-time trhead.

Line 1150, Patchset 7 (Latest): error_string += base::StringPrintf("Too long sequence of %s errors!", err);
Olga Sharonova . unresolved

I don't see it being useful for the log.

Line 1258, Patchset 7 (Latest): std::string error_string =
Olga Sharonova . unresolved

here and in other places - can we just use const char[] where it's a constant string?

File media/audio/mac/audio_manager_mac.cc
Line 1361, Patchset 7 (Latest): log_callback.Run(base::StrCat({__func__, ": ", error_string}));
Olga Sharonova . unresolved

AudioManager should have its own log callback, it may be sufficient to use it. We don't want to overcomplicate APIs for the sake of logging. If we really want to use the input stream logging callback, we can return an error code here.

Open in Gerrit

Related details

Attention is currently required from:
  • Palak Agarwal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I83f8b950b0de50ca46a1ee9525fcfec740568262
Gerrit-Change-Number: 7741726
Gerrit-PatchSet: 7
Gerrit-Owner: Palak Agarwal <agp...@chromium.org>
Gerrit-Reviewer: Olga Sharonova <ol...@chromium.org>
Gerrit-Reviewer: Palak Agarwal <agp...@chromium.org>
Gerrit-Attention: Palak Agarwal <agp...@chromium.org>
Gerrit-Comment-Date: Wed, 15 Apr 2026 14:32:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Palak Agarwal (Gerrit)

unread,
Apr 20, 2026, 10:52:14 AM (3 days ago) Apr 20
to Olga Sharonova, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Olga Sharonova

Palak Agarwal added 11 comments

File media/audio/apple/audio_low_latency_input.h
Line 161, Patchset 7: const char* func_name,
Olga Sharonova . resolved

We don't really need a function name: we have a unique error message which points to the exact place in the source code.

Palak Agarwal

Done

File media/audio/apple/audio_low_latency_input.cc
Line 233, Patchset 7: "Device ID is unknown; Returning OpenOutcome::kFailed");
Olga Sharonova . resolved

not needed: we have the source code we can look at.

Palak Agarwal

Done

Line 800, Patchset 7: base::StringPrintf("%s: [this=%p] Stop() called", __FUNCTION__, this));
Olga Sharonova . resolved

We know it's Stop(): we have FUNCTION

Palak Agarwal

Done

Line 840, Patchset 7: base::StringPrintf("%s: [this=%p] Close() called", __FUNCTION__, this));
Olga Sharonova . resolved

Same - could you ensure throughout that we are not unnecessarily verbose?

Palak Agarwal

Done

Line 885, Patchset 7: std::string error_string = base::StringPrintf(

"%s: [this=%p] voice processing disabled", __FUNCTION__, this);
DVLOG(1) << error_string;
log_callback_.Run(error_string);
Olga Sharonova . resolved

not needed, it will be noise/spam

Palak Agarwal

Done

Line 895, Patchset 7: std::string error_string = base::StringPrintf(

"%s: [this=%p] audio_device_id is same as output_device_id_for_aec_",
__FUNCTION__, this);
log_callback_.Run(error_string);
DVLOG(1) << error_string;
Olga Sharonova . resolved

not needed

Palak Agarwal

Done

Line 904, Patchset 7: LogMessageEverywhere(
__FUNCTION__,
base::StringPrintf("Unable to resolve output device id for AEC: %s",
output_device_id));
return;
Palak Agarwal . unresolved

Is this needed? Because LogMessageEverywhere calls log_callback_ inside it.

Line 1127, Patchset 7: std::string error_string = "AudioUnitRender() failed ";
Olga Sharonova . resolved

We don't want to use std::string here: it uses heap to store the string, we end up with dynamic memory allocation. And this code runs on a real-time trhead.

Palak Agarwal

Done

Line 1150, Patchset 7: error_string += base::StringPrintf("Too long sequence of %s errors!", err);
Olga Sharonova . resolved

I don't see it being useful for the log.

Palak Agarwal

Done

Line 1258, Patchset 7: std::string error_string =
Olga Sharonova . resolved

here and in other places - can we just use const char[] where it's a constant string?

Palak Agarwal

Done

File media/audio/mac/audio_manager_mac.cc
Line 1361, Patchset 7: log_callback.Run(base::StrCat({__func__, ": ", error_string}));
Olga Sharonova . resolved

AudioManager should have its own log callback, it may be sufficient to use it. We don't want to overcomplicate APIs for the sake of logging. If we really want to use the input stream logging callback, we can return an error code here.

Palak Agarwal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Olga Sharonova
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I83f8b950b0de50ca46a1ee9525fcfec740568262
Gerrit-Change-Number: 7741726
Gerrit-PatchSet: 10
Gerrit-Owner: Palak Agarwal <agp...@chromium.org>
Gerrit-Reviewer: Olga Sharonova <ol...@chromium.org>
Gerrit-Reviewer: Palak Agarwal <agp...@chromium.org>
Gerrit-Attention: Olga Sharonova <ol...@chromium.org>
Gerrit-Comment-Date: Mon, 20 Apr 2026 14:51:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Olga Sharonova <ol...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Palak Agarwal (Gerrit)

unread,
Apr 21, 2026, 4:57:03 AM (3 days ago) Apr 21
to Olga Sharonova, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Olga Sharonova

Palak Agarwal voted and added 1 comment

Votes added by Palak Agarwal

Commit-Queue+1

1 comment

File media/audio/apple/audio_low_latency_input.cc
Line 1327, Patchset 11 (Parent): log_callback_.Run("AU in" + base::StringPrintf(" [this=%p] ", this) +
Palak Agarwal . unresolved

Should we keep this and add it as a prefix in the other logs in this file to identify that the logs are from the input stream.

Open in Gerrit

Related details

Attention is currently required from:
  • Olga Sharonova
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I83f8b950b0de50ca46a1ee9525fcfec740568262
Gerrit-Change-Number: 7741726
Gerrit-PatchSet: 11
Gerrit-Owner: Palak Agarwal <agp...@chromium.org>
Gerrit-Reviewer: Olga Sharonova <ol...@chromium.org>
Gerrit-Reviewer: Palak Agarwal <agp...@chromium.org>
Gerrit-Attention: Olga Sharonova <ol...@chromium.org>
Gerrit-Comment-Date: Tue, 21 Apr 2026 08:56:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Olga Sharonova (Gerrit)

unread,
Apr 21, 2026, 1:24:35 PM (2 days ago) Apr 21
to Palak Agarwal, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Palak Agarwal

Olga Sharonova added 4 comments

File media/audio/apple/audio_low_latency_input.cc
Line 50, Patchset 11 (Latest):std::string FormatOsStatusError(const void* ptr,
const char* message,
OSStatus err) {
return base::StringPrintf("[this=%p] %s (OSStatus error %d: %s)", ptr,
message, static_cast<int>(err),
logging::DescriptionFromOSStatus(err).c_str());
}
Olga Sharonova . unresolved

Keep ducking functions together, move this one a bit?

Line 1327, Patchset 11 (Parent): log_callback_.Run("AU in" + base::StringPrintf(" [this=%p] ", this) +
Palak Agarwal . unresolved

Should we keep this and add it as a prefix in the other logs in this file to identify that the logs are from the input stream.

Olga Sharonova

Yes, most definitely. We need it to be able to filter logs.

File media/audio/mac/audio_manager_mac.cc
Line 1141, Patchset 11 (Latest): return kAudioUnitErr_InvalidElement;
Olga Sharonova . unresolved

Why this error?

Line 1358, Patchset 11 (Latest): const AudioManager::LogCallback& log_callback = GetEnumerationLogCallback();
Olga Sharonova . unresolved

Will this be helpful without knowing which device this is about?

Open in Gerrit

Related details

Attention is currently required from:
  • Palak Agarwal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I83f8b950b0de50ca46a1ee9525fcfec740568262
Gerrit-Change-Number: 7741726
Gerrit-PatchSet: 11
Gerrit-Owner: Palak Agarwal <agp...@chromium.org>
Gerrit-Reviewer: Olga Sharonova <ol...@chromium.org>
Gerrit-Reviewer: Palak Agarwal <agp...@chromium.org>
Gerrit-Attention: Palak Agarwal <agp...@chromium.org>
Gerrit-Comment-Date: Tue, 21 Apr 2026 17:24:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Palak Agarwal <agp...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Palak Agarwal (Gerrit)

unread,
11:25 AM (7 hours ago) 11:25 AM
to Olga Sharonova, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Olga Sharonova

Palak Agarwal voted and added 5 comments

Votes added by Palak Agarwal

Commit-Queue+1

5 comments

File media/audio/apple/audio_low_latency_input.cc
Line 50, Patchset 11:std::string FormatOsStatusError(const void* ptr,

const char* message,
OSStatus err) {
return base::StringPrintf("[this=%p] %s (OSStatus error %d: %s)", ptr,
message, static_cast<int>(err),
logging::DescriptionFromOSStatus(err).c_str());
}
Olga Sharonova . resolved

Keep ducking functions together, move this one a bit?

Palak Agarwal

Done, removed this function altogether and moved its functionality in the SendLog function

Line 904, Patchset 7: LogMessageEverywhere(
__FUNCTION__,
base::StringPrintf("Unable to resolve output device id for AEC: %s",
output_device_id));
return;
Palak Agarwal . resolved

Is this needed? Because LogMessageEverywhere calls log_callback_ inside it.

Palak Agarwal

Acknowledged

Line 1327, Patchset 11 (Parent): log_callback_.Run("AU in" + base::StringPrintf(" [this=%p] ", this) +
Palak Agarwal . resolved

Should we keep this and add it as a prefix in the other logs in this file to identify that the logs are from the input stream.

Olga Sharonova

Yes, most definitely. We need it to be able to filter logs.

Palak Agarwal

Done

File media/audio/mac/audio_manager_mac.cc
Line 1141, Patchset 11: return kAudioUnitErr_InvalidElement;
Olga Sharonova . resolved

Why this error?

Palak Agarwal

Ack but not relevant anymore since i've changed the function signature back to bool

Line 1358, Patchset 11: const AudioManager::LogCallback& log_callback = GetEnumerationLogCallback();
Olga Sharonova . unresolved

Will this be helpful without knowing which device this is about?

Palak Agarwal

Since we cant expose device ids, now i'm trying to get device names and use them here. WDYT?

Open in Gerrit

Related details

Attention is currently required from:
  • Olga Sharonova
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I83f8b950b0de50ca46a1ee9525fcfec740568262
Gerrit-Change-Number: 7741726
Gerrit-PatchSet: 14
Gerrit-Owner: Palak Agarwal <agp...@chromium.org>
Gerrit-Reviewer: Olga Sharonova <ol...@chromium.org>
Gerrit-Reviewer: Palak Agarwal <agp...@chromium.org>
Gerrit-Attention: Olga Sharonova <ol...@chromium.org>
Gerrit-Comment-Date: Thu, 23 Apr 2026 15:25:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Olga Sharonova <ol...@chromium.org>
Comment-In-Reply-To: Palak Agarwal <agp...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages