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

Side by Side Diff: content/renderer/media/media_stream_source_extra_data.h

Issue 23691038: Switch LiveAudio to source provider solution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the android bot Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/common/media/media_stream_options.h" 10 #include "content/common/media/media_stream_options.h"
11 #include "content/renderer/media/media_stream_source_observer.h" 11 #include "content/renderer/media/media_stream_source_observer.h"
12 #include "media/base/audio_capturer_source.h"
13 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" 12 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
15 14
16 namespace content { 15 namespace content {
17 16
18 class CONTENT_EXPORT MediaStreamSourceExtraData 17 class CONTENT_EXPORT MediaStreamSourceExtraData
19 : NON_EXPORTED_BASE(public WebKit::WebMediaStreamSource::ExtraData) { 18 : NON_EXPORTED_BASE(public WebKit::WebMediaStreamSource::ExtraData) {
20 public: 19 public:
21 MediaStreamSourceExtraData( 20 MediaStreamSourceExtraData(
22 const StreamDeviceInfo& device_info, 21 const StreamDeviceInfo& device_info,
23 const WebKit::WebMediaStreamSource& webkit_source); 22 const WebKit::WebMediaStreamSource& webkit_source);
24 explicit MediaStreamSourceExtraData( 23 MediaStreamSourceExtraData();
25 media::AudioCapturerSource* source);
26 virtual ~MediaStreamSourceExtraData(); 24 virtual ~MediaStreamSourceExtraData();
27 25
28 // Returns the WebMediaStreamSource object that owns this object. 26 // Returns the WebMediaStreamSource object that owns this object.
29 const WebKit::WebMediaStreamSource& webkit_source() const { 27 const WebKit::WebMediaStreamSource& webkit_source() const {
30 return webkit_source_; 28 return webkit_source_;
31 } 29 }
32 30
33 // Return device information about the camera or microphone. 31 // Return device information about the camera or microphone.
34 const StreamDeviceInfo& device_info() const { 32 const StreamDeviceInfo& device_info() const {
35 return device_info_; 33 return device_info_;
36 } 34 }
37 35
38 void SetVideoSource(webrtc::VideoSourceInterface* source) { 36 void SetVideoSource(webrtc::VideoSourceInterface* source) {
39 video_source_ = source; 37 video_source_ = source;
40 source_observer_.reset(new MediaStreamSourceObserver(source, this)); 38 source_observer_.reset(new MediaStreamSourceObserver(source, this));
41 } 39 }
42 40
43 void SetLocalAudioSource(webrtc::AudioSourceInterface* source) { 41 void SetLocalAudioSource(webrtc::AudioSourceInterface* source) {
44 local_audio_source_ = source; 42 local_audio_source_ = source;
45 // TODO(perkj): Implement a local source observer for audio. 43 // TODO(perkj): Implement a local source observer for audio.
46 // See |source_observer_|. 44 // See |source_observer_|.
47 } 45 }
48 46
49 webrtc::VideoSourceInterface* video_source() { return video_source_.get(); } 47 webrtc::VideoSourceInterface* video_source() { return video_source_.get(); }
50 media::AudioCapturerSource* audio_source() { return audio_source_.get(); }
51 webrtc::AudioSourceInterface* local_audio_source() { 48 webrtc::AudioSourceInterface* local_audio_source() {
52 return local_audio_source_.get(); 49 return local_audio_source_.get();
53 } 50 }
54 51
55 private: 52 private:
56 StreamDeviceInfo device_info_; 53 StreamDeviceInfo device_info_;
57 54
58 // TODO(tommyw): Remove |webkit_source_| after WebMediaStreamSource::Owner() 55 // TODO(tommyw): Remove |webkit_source_| after WebMediaStreamSource::Owner()
59 // is implemented, which let us fetch the 56 // is implemented, which let us fetch the
60 // WebMediaStreamSource without increasing the reference count. 57 // WebMediaStreamSource without increasing the reference count.
61 // |webkit_source_| will create a circular reference to WebMediaStreamSource. 58 // |webkit_source_| will create a circular reference to WebMediaStreamSource.
62 // WebMediaStreamSource -> MediaStreamSourceExtraData -> WebMediaStreamSource 59 // WebMediaStreamSource -> MediaStreamSourceExtraData -> WebMediaStreamSource
63 // Currently, we rely on manually releasing the MediaStreamSourceExtraData 60 // Currently, we rely on manually releasing the MediaStreamSourceExtraData
64 // from WebMediaStreamSource like what 61 // from WebMediaStreamSource like what
65 // MediaStreamImpl::~UserMediaRequestInfo() does. 62 // MediaStreamImpl::~UserMediaRequestInfo() does.
66 WebKit::WebMediaStreamSource webkit_source_; 63 WebKit::WebMediaStreamSource webkit_source_;
67 scoped_refptr<webrtc::VideoSourceInterface> video_source_; 64 scoped_refptr<webrtc::VideoSourceInterface> video_source_;
68 scoped_refptr<media::AudioCapturerSource> audio_source_;
69 65
70 // This member holds an instance of webrtc::LocalAudioSource. This is used 66 // This member holds an instance of webrtc::LocalAudioSource. This is used
71 // as a container for audio options. 67 // as a container for audio options.
72 // TODO(hclam): This should be merged with |audio_source_| such that it 68 // TODO(hclam): This should be merged with |audio_source_| such that it
73 // carries audio options. 69 // carries audio options.
74 scoped_refptr<webrtc::AudioSourceInterface> local_audio_source_; 70 scoped_refptr<webrtc::AudioSourceInterface> local_audio_source_;
75 scoped_ptr<MediaStreamSourceObserver> source_observer_; 71 scoped_ptr<MediaStreamSourceObserver> source_observer_;
76 72
77 DISALLOW_COPY_AND_ASSIGN(MediaStreamSourceExtraData); 73 DISALLOW_COPY_AND_ASSIGN(MediaStreamSourceExtraData);
78 }; 74 };
79 75
80 } // namespace content 76 } // namespace content
81 77
82 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_ 78 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_EXTRA_DATA_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/mock_media_stream_dependency_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698