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

Side by Side Diff: components/audio_modem/public/whispernet_client.h

Issue 2131993002: Delete the audio modem and copresence private APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eol
Patch Set: Sync again Created 4 years, 5 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
« no previous file with comments | « components/audio_modem/public/modem.h ('k') | components/audio_modem/test/random_samples.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_
6 #define COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "components/audio_modem/public/audio_modem_types.h"
12 #include "media/base/audio_bus.h"
13
14 namespace audio_modem {
15
16 // Generic callback to indicate a boolean success or failure.
17 using SuccessCallback = base::Callback<void(bool)>;
18
19 // Callback to receive encoded samples from Whispernet.
20 // AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE.
21 // const std::string& token: The token that we encoded.
22 // const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples.
23 using SamplesCallback =
24 base::Callback<void(AudioType,
25 const std::string&,
26 const scoped_refptr<media::AudioBusRefCounted>&)>;
27
28 // A client for the Whispernet audio library,
29 // responsible for the actual encoding and decoding of tokens.
30 class WhispernetClient {
31 public:
32 // Initialize the whispernet client and call the callback when done. The
33 // parameter indicates whether we succeeded or failed.
34 virtual void Initialize(const SuccessCallback& init_callback) = 0;
35
36 // Fires an event to request a token encode.
37 virtual void EncodeToken(const std::string& token,
38 AudioType type,
39 const TokenParameters token_params[2]) = 0;
40 // Fires an event to request a decode for the given samples.
41 virtual void DecodeSamples(AudioType type,
42 const std::string& samples,
43 const TokenParameters token_params[2]) = 0;
44
45 // Callback registration methods. The modem will set these to receive data.
46 virtual void RegisterTokensCallback(
47 const TokensCallback& tokens_callback) = 0;
48 virtual void RegisterSamplesCallback(
49 const SamplesCallback& samples_callback) = 0;
50
51 // Don't cache these callbacks, as they may become invalid at any time.
52 // Always invoke callbacks directly through these accessors.
53 virtual TokensCallback GetTokensCallback() = 0;
54 virtual SamplesCallback GetSamplesCallback() = 0;
55 virtual SuccessCallback GetInitializedCallback() = 0;
56
57 virtual ~WhispernetClient() {}
58 };
59
60 } // namespace audio_modem
61
62 #endif // COMPONENTS_AUDIO_MODEM_PUBLIC_WHISPERNET_CLIENT_H_
OLDNEW
« no previous file with comments | « components/audio_modem/public/modem.h ('k') | components/audio_modem/test/random_samples.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698