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

Unified Diff: content/renderer/media/media_stream_audio_track_sink.h

Issue 90743004: Add generic interfaces for the sinks of the media stream audio track (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Tommi's comments and added the missing interface. Created 7 years, 1 month 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/media_stream_audio_track_sink.h
diff --git a/content/renderer/media/media_stream_audio_track_sink.h b/content/renderer/media/media_stream_audio_track_sink.h
new file mode 100644
index 0000000000000000000000000000000000000000..38c84dd07ea225fcb8316587e6e00e015268e7a4
--- /dev/null
+++ b/content/renderer/media/media_stream_audio_track_sink.h
@@ -0,0 +1,68 @@
+// 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_TRACK_SINK_H_
+#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
+
+#include <vector>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+//#include "content/renderer/media/media_stream_audio_sink_owner.h"
Jói 2013/11/29 15:47:59 You probably want to remove this and the next line
no longer working on chromium 2013/12/02 10:40:42 Done.
+//#include "content/renderer/media/peer_connection_audio_sink_owner.h"
+#include "media/audio/audio_parameters.h"
+
+namespace content {
+
+class MediaStreamAudioSink;
+class PeerConnectionAudioSink;
+
+// Interface for reference counted holder of audio stream audio track sink.
+class MediaStreamAudioTrackSink
+ : public base::RefCountedThreadSafe<MediaStreamAudioTrackSink> {
+ public:
+ 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) = 0;
+
+ virtual void OnSetFormat(const media::AudioParameters& params) = 0;
+
+ virtual void Reset() = 0;
+
+ virtual bool IsEqual(const MediaStreamAudioSink* other) const = 0;
+ virtual bool IsEqual(const PeerConnectionAudioSink* other) const = 0;
+
+ // Wrapper which allows to use std::find_if() when adding and removing
+ // sinks to/from the list.
+ struct WrapsMediaStreamSink {
+ WrapsMediaStreamSink(MediaStreamAudioSink* sink) : sink_(sink) {}
+ bool operator()(const scoped_refptr<MediaStreamAudioTrackSink>& owner) {
+ return owner->IsEqual(sink_);
+ }
+ MediaStreamAudioSink* sink_;
+ };
+ struct WrapsPeerConnectionSink {
+ WrapsPeerConnectionSink(PeerConnectionAudioSink* sink) : sink_(sink) {}
+ bool operator()(const scoped_refptr<MediaStreamAudioTrackSink>& owner) {
+ return owner->IsEqual(sink_);
+ }
+ PeerConnectionAudioSink* sink_;
+ };
+
+ protected:
+ virtual ~MediaStreamAudioTrackSink() {}
+
+ private:
+ friend class base::RefCountedThreadSafe<MediaStreamAudioTrackSink>;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
« no previous file with comments | « content/renderer/media/media_stream_audio_sink_owner.cc ('k') | content/renderer/media/media_stream_dependency_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698