Name loopback debug record streams as `loopback`, rather then `input`.
Add a new DebugRecordingStreamType, and use it if we record a loopback signal.
Bug: 414576792
Change-Id: I2a8724598525aca677a652fecab3f362d951c1fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516064
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Olov Brändström <brandstrom@chromium.org>
Reviewed-by: Olga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1456290}
diff --git a/media/audio/audio_debug_recording_helper.h b/media/audio/audio_debug_recording_helper.h
index 91ad2983..81f1036 100644
--- a/media/audio/audio_debug_recording_helper.h
+++ b/media/audio/audio_debug_recording_helper.h
@@ -23,7 +23,11 @@
class AudioBus;
-enum class AudioDebugRecordingStreamType { kInput = 0, kOutput = 1 };
+enum class AudioDebugRecordingStreamType {
+ kInput = 0,
+ kOutput = 1,
+ kLoopback = 2
+};
// Interface for feeding data to a recorder.
class AudioDebugRecorder {
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index a8cc99d..a6e5143 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -358,11 +358,15 @@
// created stream and cleans it up when it is Close()d, transparently to
// the user of the stream. I the case where the audio manager closes the
// stream (Mac), this will result in a dangling pointer.
+ AudioDebugRecordingStreamType stream_type =
+ (device_id == media::AudioDeviceDescription::kLoopbackInputDeviceId)
+ ? AudioDebugRecordingStreamType::kLoopback
+ : AudioDebugRecordingStreamType::kInput;
stream = new AudioInputStreamDataInterceptor(
base::BindRepeating(
&AudioDebugRecordingManager::RegisterDebugRecordingSource,
- base::Unretained(debug_recording_manager_.get()),
- AudioDebugRecordingStreamType::kInput, params),
+ base::Unretained(debug_recording_manager_.get()), stream_type,
+ params),
stream);
}
}
diff --git a/services/audio/public/cpp/debug_recording_mojom_traits.cc b/services/audio/public/cpp/debug_recording_mojom_traits.cc
index 3f3dd7f..3d1b2220 100644
--- a/services/audio/public/cpp/debug_recording_mojom_traits.cc
+++ b/services/audio/public/cpp/debug_recording_mojom_traits.cc
@@ -15,6 +15,8 @@
return audio::mojom::DebugRecordingStreamType::kInput;
case media::AudioDebugRecordingStreamType::kOutput:
return audio::mojom::DebugRecordingStreamType::kOutput;
+ case media::AudioDebugRecordingStreamType::kLoopback:
+ return audio::mojom::DebugRecordingStreamType::kLoopback;
}
NOTREACHED();
}
@@ -30,6 +32,9 @@
case audio::mojom::DebugRecordingStreamType::kOutput:
*out = media::AudioDebugRecordingStreamType::kOutput;
return true;
+ case audio::mojom::DebugRecordingStreamType::kLoopback:
+ *out = media::AudioDebugRecordingStreamType::kLoopback;
+ return true;
}
NOTREACHED();
}
diff --git a/services/audio/public/cpp/debug_recording_session.cc b/services/audio/public/cpp/debug_recording_session.cc
index f8e4c1c..e1c31fd 100644
--- a/services/audio/public/cpp/debug_recording_session.cc
+++ b/services/audio/public/cpp/debug_recording_session.cc
@@ -30,6 +30,8 @@
return FILE_PATH_LITERAL("input");
case media::AudioDebugRecordingStreamType::kOutput:
return FILE_PATH_LITERAL("output");
+ case media::AudioDebugRecordingStreamType::kLoopback:
+ return FILE_PATH_LITERAL("loopback");
}
NOTREACHED();
}
diff --git a/services/audio/public/mojom/debug_recording.mojom b/services/audio/public/mojom/debug_recording.mojom
index 995a9b2..0f15025 100644
--- a/services/audio/public/mojom/debug_recording.mojom
+++ b/services/audio/public/mojom/debug_recording.mojom
@@ -10,6 +10,7 @@
enum DebugRecordingStreamType {
kInput = 0,
kOutput = 1,
+ kLoopback = 2,
};
// Implemented by the browser process to create audio debug recording files on