[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / remoting / client / audio_player.h
blobe1317379a5e341833d63e9abcc4215bafaa2544b
1 // Copyright (c) 2012 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.
5 #ifndef REMOTING_CLIENT_AUDIO_PLAYER_H_
6 #define REMOTING_CLIENT_AUDIO_PLAYER_H_
8 #include <list>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/synchronization/lock.h"
12 #include "remoting/proto/audio.pb.h"
14 namespace remoting {
16 class AudioPlayer {
17 public:
18 virtual ~AudioPlayer();
20 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet);
22 protected:
23 AudioPlayer();
25 // Return the recommended number of samples to include in a frame.
26 virtual uint32 GetSamplesPerFrame() = 0;
28 // Resets the audio player and starts playback.
29 // Returns true on success.
30 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) = 0;
32 // Function called by the browser when it needs more audio samples.
33 static void AudioPlayerCallback(void* samples,
34 uint32 buffer_size,
35 void* data);
37 private:
38 friend class AudioPlayerTest;
40 typedef std::list<AudioPacket*> AudioPacketQueue;
42 void ResetQueue();
43 void FillWithSamples(void* samples, uint32 buffer_size);
45 AudioPacket::SamplingRate sampling_rate_;
47 bool start_failed_;
49 // Protects |queued_packets_|, |queued_samples_ and |bytes_consumed_|. This is
50 // necessary to prevent races, because Pepper will call the callback on a
51 // separate thread.
52 base::Lock lock_;
54 AudioPacketQueue queued_packets_;
55 int queued_bytes_;
57 // The number of bytes from |queued_packets_| that have been consumed.
58 size_t bytes_consumed_;
60 DISALLOW_COPY_AND_ASSIGN(AudioPlayer);
63 } // namespace remoting
65 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_