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

Side by Side Diff: components/copresence/handlers/audio/audio_directive_list.h

Issue 453793002: Add audible support to the copresence API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_ 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_
6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_ 6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // samples associated with a audio transmit directives and expires directives 48 // samples associated with a audio transmit directives and expires directives
49 // that have outlived their TTL. 49 // that have outlived their TTL.
50 // TODO(rkc): Once we implement more token technologies, move reusable code 50 // TODO(rkc): Once we implement more token technologies, move reusable code
51 // from here to a base class and inherit various XxxxDirectiveList 51 // from here to a base class and inherit various XxxxDirectiveList
52 // classes from it. 52 // classes from it.
53 class AudioDirectiveList { 53 class AudioDirectiveList {
54 public: 54 public:
55 typedef base::Callback< 55 typedef base::Callback<
56 void(const std::string&, const scoped_refptr<media::AudioBusRefCounted>&)> 56 void(const std::string&, const scoped_refptr<media::AudioBusRefCounted>&)>
57 SamplesCallback; 57 SamplesCallback;
58 typedef base::Callback<void(const std::string&, const SamplesCallback&)> 58 typedef base::Callback<void(const std::string&, bool, const SamplesCallback&)>
59 EncodeTokenCallback; 59 EncodeTokenCallback;
60 60
61 AudioDirectiveList(const EncodeTokenCallback& encode_token_callback, 61 AudioDirectiveList(const EncodeTokenCallback& encode_token_callback,
62 const base::Closure& token_added_callback); 62 const base::Closure& token_added_callback,
63 bool use_audible_encoding);
63 virtual ~AudioDirectiveList(); 64 virtual ~AudioDirectiveList();
64 65
65 // Adds a token to the token queue, after getting its corresponding samples 66 // Adds a token to the token queue, after getting its corresponding samples
66 // from whispernet. 67 // from whispernet.
67 void AddTransmitDirective(const std::string& token, 68 void AddTransmitDirective(const std::string& token,
68 const std::string& op_id, 69 const std::string& op_id,
69 base::TimeDelta ttl); 70 base::TimeDelta ttl);
70 71
71 void AddReceiveDirective(const std::string& op_id, base::TimeDelta ttl); 72 void AddReceiveDirective(const std::string& op_id, base::TimeDelta ttl);
72 73
(...skipping 26 matching lines...) Expand all
99 scoped_ptr<AudioDirective> GetNextFromList(AudioDirectiveQueue* list); 100 scoped_ptr<AudioDirective> GetNextFromList(AudioDirectiveQueue* list);
100 101
101 // A map of tokens that are awaiting their samples before we can 102 // A map of tokens that are awaiting their samples before we can
102 // add them to the active transmit tokens list. 103 // add them to the active transmit tokens list.
103 std::map<std::string, AudioDirective> pending_transmit_tokens_; 104 std::map<std::string, AudioDirective> pending_transmit_tokens_;
104 105
105 AudioDirectiveQueue active_transmit_tokens_; 106 AudioDirectiveQueue active_transmit_tokens_;
106 AudioDirectiveQueue active_receive_tokens_; 107 AudioDirectiveQueue active_receive_tokens_;
107 108
108 EncodeTokenCallback encode_token_callback_; 109 EncodeTokenCallback encode_token_callback_;
109
110 base::Closure token_added_callback_; 110 base::Closure token_added_callback_;
111 const bool use_audible_encoding_;
111 112
112 // Cache that holds the encoded samples. After reaching its limit, the cache 113 // Cache that holds the encoded samples. After reaching its limit, the cache
113 // expires the oldest samples first. 114 // expires the oldest samples first.
114 SamplesMap samples_cache_; 115 SamplesMap samples_cache_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveList); 117 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveList);
117 }; 118 };
118 119
119 } // namespace copresence 120 } // namespace copresence
120 121
121 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_ 122 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_LIST_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698