Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: content/renderer/media/webrtc/webrtc_audio_sink_adapter.h

Issue 1966043006: Revert of MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
diff --git a/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc67c42c8f521d94c8c6546b2d610218a7e96795
--- /dev/null
+++ b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
@@ -0,0 +1,51 @@
+// Copyright 2014 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_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_
+#define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/macros.h"
+#include "content/public/renderer/media_stream_audio_sink.h"
+#include "media/base/audio_parameters.h"
+
+namespace webrtc {
+class AudioTrackSinkInterface;
+} // namespace webrtc
+
+namespace content {
+
+// Adapter to the webrtc::AudioTrackSinkInterface of the audio track.
+// This class is used in between the MediaStreamAudioSink and
+// webrtc::AudioTrackSinkInterface. It gets data callback via the
+// MediaStreamAudioSink::OnData() interface and pass the data to
+// webrtc::AudioTrackSinkInterface.
+class WebRtcAudioSinkAdapter : public MediaStreamAudioSink {
+ public:
+ explicit WebRtcAudioSinkAdapter(
+ webrtc::AudioTrackSinkInterface* sink);
+ ~WebRtcAudioSinkAdapter() override;
+
+ bool IsEqual(const webrtc::AudioTrackSinkInterface* other) const;
+
+ private:
+ // MediaStreamAudioSink implementation.
+ void OnData(const media::AudioBus& audio_bus,
+ base::TimeTicks estimated_capture_time) override;
+ void OnSetFormat(const media::AudioParameters& params) override;
+
+ webrtc::AudioTrackSinkInterface* const sink_;
+
+ media::AudioParameters params_;
+ std::unique_ptr<int16_t[]> interleaved_data_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebRtcAudioSinkAdapter);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_
« no previous file with comments | « content/renderer/media/webrtc/webrtc_audio_sink.cc ('k') | content/renderer/media/webrtc/webrtc_audio_sink_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698