cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / renderer / media / media_stream_audio_sink_owner.h
blob23acf69d7166711998421c9dbdab0676d4abf617
1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_
8 #include <vector>
10 #include "base/synchronization/lock.h"
11 #include "content/renderer/media/media_stream_audio_track_sink.h"
13 namespace content {
15 class MediaStreamAudioSink;
17 // Reference counted holder of MediaStreamAudioSink sinks.
18 class MediaStreamAudioSinkOwner : public MediaStreamAudioTrackSink {
19 public:
20 explicit MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink);
22 // MediaStreamAudioTrackSink implementation.
23 int OnData(const int16* audio_data,
24 int sample_rate,
25 int number_of_channels,
26 int number_of_frames,
27 const std::vector<int>& channels,
28 int audio_delay_milliseconds,
29 int current_volume,
30 bool need_audio_processing,
31 bool key_pressed) override;
32 void OnSetFormat(const media::AudioParameters& params) override;
33 void OnReadyStateChanged(
34 blink::WebMediaStreamSource::ReadyState state) override;
35 void Reset() override;
36 bool IsEqual(const MediaStreamAudioSink* other) const override;
37 bool IsEqual(const PeerConnectionAudioSink* other) const override;
39 protected:
40 ~MediaStreamAudioSinkOwner() override {}
42 private:
43 mutable base::Lock lock_;
45 // Raw pointer to the delegate, the client need to call Reset() to set the
46 // pointer to NULL before the delegate goes away.
47 MediaStreamAudioSink* delegate_;
49 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioSinkOwner);
52 } // namespace content
54 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_