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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
7
8 #include <vector>
9
10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h"
12 //#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.
13 //#include "content/renderer/media/peer_connection_audio_sink_owner.h"
14 #include "media/audio/audio_parameters.h"
15
16 namespace content {
17
18 class MediaStreamAudioSink;
19 class PeerConnectionAudioSink;
20
21 // Interface for reference counted holder of audio stream audio track sink.
22 class MediaStreamAudioTrackSink
23 : public base::RefCountedThreadSafe<MediaStreamAudioTrackSink> {
24 public:
25 virtual int OnData(const int16* audio_data,
26 int sample_rate,
27 int number_of_channels,
28 int number_of_frames,
29 const std::vector<int>& channels,
30 int audio_delay_milliseconds,
31 int current_volume,
32 bool need_audio_processing,
33 bool key_pressed) = 0;
34
35 virtual void OnSetFormat(const media::AudioParameters& params) = 0;
36
37 virtual void Reset() = 0;
38
39 virtual bool IsEqual(const MediaStreamAudioSink* other) const = 0;
40 virtual bool IsEqual(const PeerConnectionAudioSink* other) const = 0;
41
42 // Wrapper which allows to use std::find_if() when adding and removing
43 // sinks to/from the list.
44 struct WrapsMediaStreamSink {
45 WrapsMediaStreamSink(MediaStreamAudioSink* sink) : sink_(sink) {}
46 bool operator()(const scoped_refptr<MediaStreamAudioTrackSink>& owner) {
47 return owner->IsEqual(sink_);
48 }
49 MediaStreamAudioSink* sink_;
50 };
51 struct WrapsPeerConnectionSink {
52 WrapsPeerConnectionSink(PeerConnectionAudioSink* sink) : sink_(sink) {}
53 bool operator()(const scoped_refptr<MediaStreamAudioTrackSink>& owner) {
54 return owner->IsEqual(sink_);
55 }
56 PeerConnectionAudioSink* sink_;
57 };
58
59 protected:
60 virtual ~MediaStreamAudioTrackSink() {}
61
62 private:
63 friend class base::RefCountedThreadSafe<MediaStreamAudioTrackSink>;
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
OLDNEW
« 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