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

Side by Side Diff: media/base/audio_latency.h

Issue 2750543003: Support AudioContextOptions latencyHint as double. (Closed)
Patch Set: Fix audiocontextoptions LayoutTest. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_AUDIO_LATENCY_H_ 5 #ifndef MEDIA_BASE_AUDIO_LATENCY_H_
6 #define MEDIA_BASE_AUDIO_LATENCY_H_ 6 #define MEDIA_BASE_AUDIO_LATENCY_H_
7 7
8 #include "media/base/media_export.h" 8 #include "media/base/media_export.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 class AudioParameters;
13
12 class MEDIA_EXPORT AudioLatency { 14 class MEDIA_EXPORT AudioLatency {
13 public: 15 public:
14 // Categories of expected latencies for input/output audio. Do not change 16 // Categories of expected latencies for input/output audio. Do not change
15 // existing values, they are used for UMA histogram reporting. 17 // existing values, they are used for UMA histogram reporting.
16 enum LatencyType { 18 enum LatencyType {
17 // Specific latency in milliseconds. 19 // Specific latency in milliseconds.
18 LATENCY_EXACT_MS = 0, 20 LATENCY_EXACT_MS = 0,
19 // Lowest possible latency which does not cause glitches. 21 // Lowest possible latency which does not cause glitches.
20 LATENCY_INTERACTIVE = 1, 22 LATENCY_INTERACTIVE = 1,
21 // Latency optimized for real time communication. 23 // Latency optimized for real time communication.
22 LATENCY_RTC = 2, 24 LATENCY_RTC = 2,
23 // Latency optimized for continuous playback and power saving. 25 // Latency optimized for continuous playback and power saving.
24 LATENCY_PLAYBACK = 3, 26 LATENCY_PLAYBACK = 3,
25 // For validation only. 27 // For validation only.
26 LATENCY_LAST = LATENCY_PLAYBACK, 28 LATENCY_LAST = LATENCY_PLAYBACK,
27 LATENCY_COUNT = LATENCY_LAST + 1 29 LATENCY_COUNT = LATENCY_LAST + 1
28 }; 30 };
29 31
30 // |preferred_buffer_size| should be set to 0 if a client has no preference. 32 // |preferred_buffer_size| should be set to 0 if a client has no preference.
31 static int GetHighLatencyBufferSize(int sample_rate, 33 static int GetHighLatencyBufferSize(int sample_rate,
32 int preferred_buffer_size); 34 int preferred_buffer_size);
33 35
34 // |hardware_buffer_size| should be set to 0 if unknown/invalid/not preferred. 36 // |hardware_buffer_size| should be set to 0 if unknown/invalid/not preferred.
35 static int GetRtcBufferSize(int sample_rate, int hardware_buffer_size); 37 static int GetRtcBufferSize(int sample_rate, int hardware_buffer_size);
36 38
37 static int GetInteractiveBufferSize(int hardware_buffer_size); 39 static int GetInteractiveBufferSize(int hardware_buffer_size);
40
41 static int GetExactBufferSize(double duration_in_seconds,
42 const AudioParameters& hardware_params);
38 }; 43 };
39 44
40 } // namespace media 45 } // namespace media
41 46
42 #endif // MEDIA_BASE_AUDIO_LATENCY_H_ 47 #endif // MEDIA_BASE_AUDIO_LATENCY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698