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 { ...@@ -33,9 +33,11 @@ namespace pulse {
namespace { namespace {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
static const char kBrowserDisplayName[] = "google-chrome"; constexpr char kBrowserDisplayName[] = "google-chrome";
#define PRODUCT_STRING "Google Chrome"
#else #else
static const char kBrowserDisplayName[] = "chromium-browser"; constexpr char kBrowserDisplayName[] = "chromium-browser";
#define PRODUCT_STRING "Chromium"
#endif #endif
#if defined(DLOPEN_PULSEAUDIO) #if defined(DLOPEN_PULSEAUDIO)
...@@ -208,7 +210,8 @@ bool InitPulse(pa_threaded_mainloop** mainloop, pa_context** context) { ...@@ -208,7 +210,8 @@ bool InitPulse(pa_threaded_mainloop** mainloop, pa_context** context) {
return false; return false;
pa_mainloop_api* pa_mainloop_api = pa_threaded_mainloop_get_api(pa_mainloop); 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) { if (!pa_context) {
pa_threaded_mainloop_free(pa_mainloop); pa_threaded_mainloop_free(pa_mainloop);
return false; return false;
...@@ -483,8 +486,8 @@ bool CreateOutputStream(pa_threaded_mainloop** mainloop, ...@@ -483,8 +486,8 @@ bool CreateOutputStream(pa_threaded_mainloop** mainloop,
RETURN_ON_FAILURE(*mainloop, "Failed to create PulseAudio main loop."); RETURN_ON_FAILURE(*mainloop, "Failed to create PulseAudio main loop.");
pa_mainloop_api* pa_mainloop_api = pa_threaded_mainloop_get_api(*mainloop); pa_mainloop_api* pa_mainloop_api = pa_threaded_mainloop_get_api(*mainloop);
*context = pa_context_new(pa_mainloop_api, *context = pa_context_new(
app_name.empty() ? "Chromium" : app_name.c_str()); pa_mainloop_api, app_name.empty() ? PRODUCT_STRING : app_name.c_str());
RETURN_ON_FAILURE(*context, "Failed to create PulseAudio context."); RETURN_ON_FAILURE(*context, "Failed to create PulseAudio context.");
// A state callback must be set before calling pa_threaded_mainloop_lock() or // 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