| OLD | NEW |
| 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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/public/renderer/render_view_observer.h" | 19 #include "content/public/renderer/render_view_observer.h" |
| 20 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 20 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| 21 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 21 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" |
| 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamDescr
iptor.h" | 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamDescr
iptor.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaRequest.h
" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaRequest.h
" |
| 25 #include "webkit/media/media_stream_client.h" | 25 #include "webkit/media/media_stream_client.h" |
| 26 | 26 |
| 27 namespace webkit_media { |
| 28 class MediaStreamAudioRenderer; |
| 29 } |
| 30 |
| 27 namespace content { | 31 namespace content { |
| 28 class MediaStreamDependencyFactory; | 32 class MediaStreamDependencyFactory; |
| 29 class MediaStreamDispatcher; | 33 class MediaStreamDispatcher; |
| 30 class VideoCaptureImplManager; | 34 class VideoCaptureImplManager; |
| 35 class WebRtcAudioRenderer; |
| 31 | 36 |
| 32 // MediaStreamImpl is a delegate for the Media Stream API messages used by | 37 // MediaStreamImpl is a delegate for the Media Stream API messages used by |
| 33 // WebKit. It ties together WebKit, native PeerConnection in libjingle and | 38 // WebKit. It ties together WebKit, native PeerConnection in libjingle and |
| 34 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 39 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
| 35 // in the browser process. It must be created, called and destroyed on the | 40 // in the browser process. It must be created, called and destroyed on the |
| 36 // render thread. | 41 // render thread. |
| 37 // MediaStreamImpl have weak pointers to a MediaStreamDispatcher. | 42 // MediaStreamImpl have weak pointers to a MediaStreamDispatcher. |
| 38 class CONTENT_EXPORT MediaStreamImpl | 43 class CONTENT_EXPORT MediaStreamImpl |
| 39 : public RenderViewObserver, | 44 : public RenderViewObserver, |
| 40 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), | 45 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 | 72 |
| 68 // webkit_media::MediaStreamClient implementation. | 73 // webkit_media::MediaStreamClient implementation. |
| 69 virtual bool IsMediaStream(const GURL& url) OVERRIDE; | 74 virtual bool IsMediaStream(const GURL& url) OVERRIDE; |
| 70 virtual scoped_refptr<webkit_media::VideoFrameProvider> GetVideoFrameProvider( | 75 virtual scoped_refptr<webkit_media::VideoFrameProvider> GetVideoFrameProvider( |
| 71 const GURL& url, | 76 const GURL& url, |
| 72 const base::Closure& error_cb, | 77 const base::Closure& error_cb, |
| 73 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb) OVERRIDE; | 78 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb) OVERRIDE; |
| 74 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder( | 79 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder( |
| 75 const GURL& url, | 80 const GURL& url, |
| 76 media::MessageLoopFactory* message_loop_factory) OVERRIDE; | 81 media::MessageLoopFactory* message_loop_factory) OVERRIDE; |
| 82 virtual scoped_refptr<webkit_media::MediaStreamAudioRenderer> |
| 83 GetAudioRenderer(const GURL& url) OVERRIDE; |
| 77 | 84 |
| 78 // MediaStreamDispatcherEventHandler implementation. | 85 // MediaStreamDispatcherEventHandler implementation. |
| 79 virtual void OnStreamGenerated( | 86 virtual void OnStreamGenerated( |
| 80 int request_id, | 87 int request_id, |
| 81 const std::string& label, | 88 const std::string& label, |
| 82 const media_stream::StreamDeviceInfoArray& audio_array, | 89 const media_stream::StreamDeviceInfoArray& audio_array, |
| 83 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE; | 90 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE; |
| 84 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; | 91 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; |
| 85 virtual void OnDevicesEnumerated( | 92 virtual void OnDevicesEnumerated( |
| 86 int request_id, | 93 int request_id, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); | 160 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); |
| 154 | 161 |
| 155 scoped_refptr<webkit_media::VideoFrameProvider> | 162 scoped_refptr<webkit_media::VideoFrameProvider> |
| 156 CreateVideoFrameProvider( | 163 CreateVideoFrameProvider( |
| 157 webrtc::MediaStreamInterface* stream, | 164 webrtc::MediaStreamInterface* stream, |
| 158 const base::Closure& error_cb, | 165 const base::Closure& error_cb, |
| 159 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb); | 166 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb); |
| 160 scoped_refptr<media::VideoDecoder> CreateVideoDecoder( | 167 scoped_refptr<media::VideoDecoder> CreateVideoDecoder( |
| 161 webrtc::MediaStreamInterface* stream, | 168 webrtc::MediaStreamInterface* stream, |
| 162 media::MessageLoopFactory* message_loop_factory); | 169 media::MessageLoopFactory* message_loop_factory); |
| 170 scoped_refptr<WebRtcAudioRenderer> CreateRemoteAudioRenderer( |
| 171 webrtc::MediaStreamInterface* stream); |
| 163 | 172 |
| 164 // Weak ref to a MediaStreamDependencyFactory, owned by the RenderThread. | 173 // Weak ref to a MediaStreamDependencyFactory, owned by the RenderThread. |
| 165 // It's valid for the lifetime of RenderThread. | 174 // It's valid for the lifetime of RenderThread. |
| 166 MediaStreamDependencyFactory* dependency_factory_; | 175 MediaStreamDependencyFactory* dependency_factory_; |
| 167 | 176 |
| 168 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's | 177 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's |
| 169 // valid for the lifetime of RenderView. | 178 // valid for the lifetime of RenderView. |
| 170 MediaStreamDispatcher* media_stream_dispatcher_; | 179 MediaStreamDispatcher* media_stream_dispatcher_; |
| 171 | 180 |
| 172 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 181 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 173 | 182 |
| 174 UserMediaRequests user_media_requests_; | 183 UserMediaRequests user_media_requests_; |
| 175 | 184 |
| 176 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 185 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 177 }; | 186 }; |
| 178 | 187 |
| 179 } // namespace content | 188 } // namespace content |
| 180 | 189 |
| 181 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 190 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |