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

Side by Side Diff: components/copresence/public/copresence_constants.h

Issue 824593003: Revert of Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_ 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_ 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "components/copresence/tokens.h"
14 #include "media/base/channel_layout.h" 13 #include "media/base/channel_layout.h"
15 14
16 namespace media { 15 namespace media {
17 class AudioBusRefCounted; 16 class AudioBusRefCounted;
18 } 17 }
19 18
20 namespace copresence { 19 namespace copresence {
21 20
22 class Directive;
23
24 // Audio constants. Currently used from the AudioPlayer/AudioRecorder. 21 // Audio constants. Currently used from the AudioPlayer/AudioRecorder.
25 // TODO(rkc): Make these values configurable then remove them from here. 22 // TODO(rkc): Make these values configurable then remove them from here.
26 // Number of repetitions of the audio token in one sequence of samples. 23 // Number of repetitions of the audio token in one sequence of samples.
27 extern const int kDefaultRepetitions; 24 extern const int kDefaultRepetitions;
28 25
29 // The default sample rate. We need to ensure that both the recorder and the 26 // The default sample rate. We need to ensure that both the recorder and the
30 // player on _all platforms use the same rate. 27 // player on _all platforms use the same rate.
31 extern const float kDefaultSampleRate; 28 extern const float kDefaultSampleRate;
32 extern const int kDefaultBitsPerSample; 29 extern const int kDefaultBitsPerSample;
33 30
34 // 18500 for ultrasound, needs to be consistent between platforms. 31 // 18500 for ultrasound, needs to be consistent between platforms.
35 extern const float kDefaultCarrierFrequency; 32 extern const float kDefaultCarrierFrequency;
36 33
37 // The next two really need to be configurable since they don't need to be 34 // The next two really need to be configurable since they don't need to be
38 // consistent across platforms, or even playing/recording. 35 // consistent across platforms, or even playing/recording.
39 extern const int kDefaultChannels; 36 extern const int kDefaultChannels;
40 extern const media::ChannelLayout kDefaultChannelLayout; 37 extern const media::ChannelLayout kDefaultChannelLayout;
41 38
42
43 // These constants are used from everywhere. 39 // These constants are used from everywhere.
44 // Particularly, these are used to index the directive lists in the 40 // Particularly, these are used to index the directive lists in the
45 // audio manager, so do not change these enums without changing 41 // audio manager, so do not change these enums without changing
46 // audio_directive_list.[h|cc]. 42 // audio_directive_list.[h|cc].
47 enum AudioType { 43 enum AudioType {
48 AUDIBLE = 0, 44 AUDIBLE = 0,
49 INAUDIBLE = 1, 45 INAUDIBLE = 1,
50 BOTH = 2, 46 BOTH = 2,
51 AUDIO_TYPE_UNKNOWN = 3, 47 AUDIO_TYPE_UNKNOWN = 3,
52 }; 48 };
53 49
50 struct AudioToken {
51 AudioToken(const std::string& token, bool audible)
52 : token(token), audible(audible) {}
53 std::string token;
54 bool audible;
55 };
54 56
55 // These callbacks are used from various places in Copresence. 57 // These callbacks are used from various places in Copresence.
56 58
57 // Generic callback to indicate a boolean success or failure. 59 // Generic callback to indicate a boolean success or failure.
58 using SuccessCallback = base::Callback<void(bool)>; 60 using SuccessCallback = base::Callback<void(bool)>;
59 61
60 // Callback to pass around found tokens. 62 // Callback to pass around found tokens.
63 // Arguments:
64 // const std::vector<AudioToken>& tokens - List of found tokens.
61 using TokensCallback = base::Callback<void(const std::vector<AudioToken>&)>; 65 using TokensCallback = base::Callback<void(const std::vector<AudioToken>&)>;
62 66
63 // Callback to receive encoded samples from Whispernet. 67 // Callback to receive encoded samples from Whispernet.
64 // AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE. 68 // AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE.
65 // const std::string& token: The token that we encoded. 69 // const std::string& token: The token that we encoded.
66 // const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples. 70 // const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples.
67 using SamplesCallback = 71 using SamplesCallback =
68 base::Callback<void(AudioType, 72 base::Callback<void(AudioType,
69 const std::string&, 73 const std::string&,
70 const scoped_refptr<media::AudioBusRefCounted>&)>; 74 const scoped_refptr<media::AudioBusRefCounted>&)>;
71
72 // Callback to pass a list of directives back to CopresenceState.
73 using DirectivesCallback = base::Callback<void(const std::vector<Directive>&)>;
74
75 } // namespace copresence 75 } // namespace copresence
76 76
77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_ 77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_H_
OLDNEW
« no previous file with comments | « components/copresence/handlers/directive_handler_unittest.cc ('k') | components/copresence/public/copresence_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698