Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1861)

Unified Diff: content/renderer/media/audio_device_factory.cc

Issue 2043883005: Implementing AudioOutputDevice authorization timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dale's comments addressed: code simplified, comments fixed. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_output_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_device_factory.cc
diff --git a/content/renderer/media/audio_device_factory.cc b/content/renderer/media/audio_device_factory.cc
index ffe459c9f21c3e381e9c069b613fa65506fdb2e2..af6ddbe18517603da9da3e48b18ab1fac458e51b 100644
--- a/content/renderer/media/audio_device_factory.cc
+++ b/content/renderer/media/audio_device_factory.cc
@@ -4,7 +4,10 @@
#include "content/renderer/media/audio_device_factory.h"
+#include <algorithm>
+
#include "base/logging.h"
+#include "content/common/content_constants_internal.h"
#include "content/renderer/media/audio_input_message_filter.h"
#include "content/renderer/media/audio_message_filter.h"
#include "content/renderer/media/audio_renderer_mixer_manager.h"
@@ -20,6 +23,7 @@ namespace content {
AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL;
namespace {
+const int64_t kMaxAuthorizationTimeoutMs = 4000;
scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
int render_frame_id,
@@ -29,7 +33,11 @@ scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
AudioMessageFilter* const filter = AudioMessageFilter::Get();
scoped_refptr<media::AudioOutputDevice> device(new media::AudioOutputDevice(
filter->CreateAudioOutputIPC(render_frame_id), filter->io_task_runner(),
- session_id, device_id, security_origin));
+ session_id, device_id, security_origin,
+ // Set authorization request timeout at 80% of renderer hung timeout, but
+ // no more than kMaxAuthorizationTimeout.
+ base::TimeDelta::FromMilliseconds(std::min(kHungRendererDelayMs * 8 / 10,
+ kMaxAuthorizationTimeoutMs))));
device->RequestDeviceAuthorization();
return device;
}
« no previous file with comments | « no previous file | media/audio/audio_output_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698