Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_sink_owner.h |
| diff --git a/content/renderer/media/media_stream_audio_sink_owner.h b/content/renderer/media/media_stream_audio_sink_owner.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48255018cfab7773522cffd79d2f356557483ed3 |
| --- /dev/null |
| +++ b/content/renderer/media/media_stream_audio_sink_owner.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_ |
| +#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/synchronization/lock.h" |
| +#include "content/renderer/media/media_stream_audio_track_sink.h" |
| + |
| +namespace content { |
| + |
| +class MediaStreamAudioSink; |
| + |
| +// Reference counted holder of MediaStreamAudioSinksinks. |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
MediaStreamAudioSink sinks.
no longer working on chromium
2013/11/29 15:02:04
Done.
|
| +class MediaStreamAudioSinkOwner |
| + : public MediaStreamAudioTrackSink { |
| + public: |
| + explicit MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink); |
| + |
| + // MediaStreamAudioSink implementation. |
| + virtual int OnData(const int16* audio_data, |
| + int sample_rate, |
| + int number_of_channels, |
| + int number_of_frames, |
| + const std::vector<int>& channels, |
| + int audio_delay_milliseconds, |
| + int current_volume, |
| + bool need_audio_processing, |
| + bool key_pressed) OVERRIDE; |
| + virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE; |
| + virtual void Reset() OVERRIDE; |
| + virtual bool IsEqual(const MediaStreamAudioSink* other) const OVERRIDE; |
| + virtual bool IsEqual(const PeerConnectionAudioSink* other) const OVERRIDE { |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
do you need to implement this?
no longer working on chromium
2013/11/29 15:02:04
I think so, otherwise it will be pure virtual in t
tommi (sloooow) - chröme
2013/11/29 15:31:26
ok, I guess that would do it :)
|
| + return false; |
| + } |
| + |
| + protected: |
| + virtual ~MediaStreamAudioSinkOwner() {} |
| + |
| + private: |
| + mutable base::Lock lock_; |
| + |
| + // Weak reference to the delegate, the client need to call Reset() to set the |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
s/Weak reference/Raw pointer
(since we have WeakPt
no longer working on chromium
2013/11/29 15:02:04
Done.
|
| + // pointer to NULL before the delegate goes away. |
| + MediaStreamAudioSink* delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioSinkOwner); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SINK_OWNER_H_ |