Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_sink_owner.cc |
| diff --git a/content/renderer/media/media_stream_audio_sink_owner.cc b/content/renderer/media/media_stream_audio_sink_owner.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6e88318a4bd302a8b0f5c74fc2f3d9766819c374 |
| --- /dev/null |
| +++ b/content/renderer/media/media_stream_audio_sink_owner.cc |
| @@ -0,0 +1,56 @@ |
| +// 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. |
| + |
| +#include "content/renderer/media/media_stream_audio_sink_owner.h" |
| + |
| +#include "content/public/renderer/media_stream_audio_sink.h" |
| +#include "media/audio/audio_parameters.h" |
| + |
| +namespace content { |
| + |
| +MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner( |
| + MediaStreamAudioSink* sink) |
| + : delegate_(sink) { |
| +} |
| + |
| +int MediaStreamAudioSinkOwner::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) { |
| + base::AutoLock lock(lock_); |
| + if (delegate_) { |
| + delegate_->OnData(audio_data, |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
what about the return value from delegate_->OnData
no longer working on chromium
2013/11/29 15:02:04
It is a virtual void OnData(const int16* audio_dat
|
| + sample_rate, |
| + number_of_channels, |
| + number_of_frames); |
| + } |
| + |
| + return 0; |
| +} |
| + |
| +void MediaStreamAudioSinkOwner::OnSetFormat( |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
which methods do we expect to be called from the c
no longer working on chromium
2013/11/29 15:02:04
OnSetFormat and OnData are called on the same thre
|
| + const media::AudioParameters& params) { |
| + base::AutoLock lock(lock_); |
| + if (delegate_) |
| + delegate_->OnSetFormat(params); |
| +} |
| + |
| +void MediaStreamAudioSinkOwner::Reset() { |
| + base::AutoLock lock(lock_); |
| + delegate_ = NULL; |
| +} |
| + |
| +bool MediaStreamAudioSinkOwner::IsEqual( |
| + const MediaStreamAudioSink* other) const { |
| + DCHECK(other); |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
The reason for having this DCHECK doesn't apply no
no longer working on chromium
2013/11/29 15:02:04
why? the caller should make sure other should not
|
| + base::AutoLock lock(lock_); |
| + return (other == delegate_); |
| +} |
| + |
| +} // namespace content |