Commit 14648614 authored by Timothy Gu's avatar Timothy Gu Committed by Commit Bot

Set PulseAudio context name based on product branding

Currently, no matter what the branding of the browser is, the name of
the PulseAudio contexts are always "Chromium" and "Chrome Input". This
is shown in e.g., GNOME Settings. Instead, use current branding to
determine the name to use: "Chromium" and "Chromium Input", or "Google
Chrome" and "Google Chrome Input".

Change-Id: Ibff97112b990cb43eb568be11310d85604642b69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130766Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Timothy Gu <timothygu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755378}
parent baa168f5
......@@ -33,9 +33,11 @@ namespace pulse {
namespace {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
static const char kBrowserDisplayName[] = "google-chrome";
constexpr char kBrowserDisplayName[] = "google-chrome";
#define PRODUCT_STRING "Google Chrome"
#else
static const char kBrowserDisplayName[] = "chromium-browser";
constexpr char kBrowserDisplayName[] = "chromium-browser";
#define PRODUCT_STRING "Chromium"
#endif
#if defined(DLOPEN_PULSEAUDIO)
......@@ -208,7 +210,8 @@ bool InitPulse(pa_threaded_mainloop** mainloop, pa_context** context) {
return false;
pa_mainloop_api* pa_mainloop_api = pa_threaded_mainloop_get_api(pa_mainloop);
pa_context* pa_context = pa_context_new(pa_mainloop_api, "Chrome input");
pa_context* pa_context =
pa_context_new(pa_mainloop_api, PRODUCT_STRING " input");
if (!pa_context) {
pa_threaded_mainloop_free(pa_mainloop);
return false;
......@@ -483,8 +486,8 @@ bool CreateOutputStream(pa_threaded_mainloop** mainloop,
RETURN_ON_FAILURE(*mainloop, "Failed to create PulseAudio main loop.");
pa_mainloop_api* pa_mainloop_api = pa_threaded_mainloop_get_api(*mainloop);
*context = pa_context_new(pa_mainloop_api,
app_name.empty() ? "Chromium" : app_name.c_str());
*context = pa_context_new(
pa_mainloop_api, app_name.empty() ? PRODUCT_STRING : app_name.c_str());
RETURN_ON_FAILURE(*context, "Failed to create PulseAudio context.");
// A state callback must be set before calling pa_threaded_mainloop_lock() or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment