Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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)>; | |
| 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 // const std::string& token: The token that we encoded. | |
|
Charlie
2014/11/06 17:28:24
These arguments are now in a different order.
rkc
2014/11/06 19:58:25
Done.
| |
| 69 // AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE. | |
| 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_ |
| OLD | NEW |