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: components/copresence/public/copresence_constants.h

Issue 704923002: Add polling and audio check to copresence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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_ 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_ 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_
7 7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h"
8 #include "media/base/channel_layout.h" 13 #include "media/base/channel_layout.h"
9 14
15 namespace media {
16 class AudioBusRefCounted;
17 }
18
10 namespace copresence { 19 namespace copresence {
11 20
12 // Audio constants. Currently used from the AudioPlayer/AudioRecorder. 21 // Audio constants. Currently used from the AudioPlayer/AudioRecorder.
13 // TODO(rkc): Make these values configurable then remove them from here. 22 // TODO(rkc): Make these values configurable then remove them from here.
14 // 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.
15 extern const int kDefaultRepetitions; 24 extern const int kDefaultRepetitions;
16 25
17 // 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
18 // player on _all platforms use the same rate. 27 // player on _all platforms use the same rate.
19 extern const float kDefaultSampleRate; 28 extern const float kDefaultSampleRate;
(...skipping 11 matching lines...) Expand all
31 // Particularly, these are used to index the directive lists in the 40 // Particularly, these are used to index the directive lists in the
32 // audio manager, so do not change these enums without changing 41 // audio manager, so do not change these enums without changing
33 // audio_directive_list.[h|cc]. 42 // audio_directive_list.[h|cc].
34 enum AudioType { 43 enum AudioType {
35 AUDIBLE = 0, 44 AUDIBLE = 0,
36 INAUDIBLE = 1, 45 INAUDIBLE = 1,
37 BOTH = 2, 46 BOTH = 2,
38 AUDIO_TYPE_UNKNOWN = 3, 47 AUDIO_TYPE_UNKNOWN = 3,
39 }; 48 };
40 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 };
56
57 // These callbacks are used from various places in Copresence.
58
59 // Generic callback to indicate a boolean success or failure.
60 using SuccessCallback = base::Callback<void(bool)>;
xiyuan 2014/11/06 21:27:50 Are we allowed to use "using" in this scoped in a
rkc 2014/11/06 21:45:05 New C++11 rules (http://chromium-cpp.appspot.com/)
xiyuan 2014/11/06 21:51:12 Good to know. Apparently, I don't follow chromium-
61
62 // Callback to pass around found tokens.
63 // Arguments:
64 // const std::vector<AudioToken>& tokens - List of found tokens.
65 using TokensCallback = base::Callback<void(const std::vector<AudioToken>&)>;
66
67 // Callback to receive encoded samples from Whispernet.
68 // AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE.
69 // const std::string& token: The token that we encoded.
70 // const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples.
71 using SamplesCallback =
72 base::Callback<void(AudioType,
73 const std::string&,
74 const scoped_refptr<media::AudioBusRefCounted>&)>;
41 } // namespace copresence 75 } // namespace copresence
42 76
43 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_ 77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698