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_
10 #include "base/synchronization/lock.h"
11 #include "content/renderer/media/media_stream_audio_track_sink.h"
15 class MediaStreamAudioSink
;
17 // Reference counted holder of MediaStreamAudioSink sinks.
18 class MediaStreamAudioSinkOwner
: public MediaStreamAudioTrackSink
{
20 explicit MediaStreamAudioSinkOwner(MediaStreamAudioSink
* sink
);
22 // MediaStreamAudioTrackSink implementation.
23 void OnData(const media::AudioBus
& audio_bus
,
24 base::TimeTicks estimated_capture_time
) override
;
25 void OnSetFormat(const media::AudioParameters
& params
) override
;
26 void OnReadyStateChanged(
27 blink::WebMediaStreamSource::ReadyState state
) override
;
28 void Reset() override
;
29 bool IsEqual(const MediaStreamAudioSink
* other
) const override
;
32 ~MediaStreamAudioSinkOwner() override
{}
35 mutable base::Lock lock_
;
37 // Raw pointer to the delegate, the client need to call Reset() to set the
38 // pointer to NULL before the delegate goes away.
39 MediaStreamAudioSink
* delegate_
;
41 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioSinkOwner
);
44 } // namespace content
46 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_