| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 NON_EXPORTED_BASE(public base::NonThreadSafe), | 64 NON_EXPORTED_BASE(public base::NonThreadSafe), |
| 65 public base::RefCountedThreadSafe<MediaStreamImpl> { | 65 public base::RefCountedThreadSafe<MediaStreamImpl> { |
| 66 public: | 66 public: |
| 67 MediaStreamImpl( | 67 MediaStreamImpl( |
| 68 MediaStreamDispatcher* media_stream_dispatcher, | 68 MediaStreamDispatcher* media_stream_dispatcher, |
| 69 content::P2PSocketDispatcher* p2p_socket_dispatcher, | 69 content::P2PSocketDispatcher* p2p_socket_dispatcher, |
| 70 VideoCaptureImplManager* vc_manager, | 70 VideoCaptureImplManager* vc_manager, |
| 71 MediaStreamDependencyFactory* dependency_factory); | 71 MediaStreamDependencyFactory* dependency_factory); |
| 72 virtual ~MediaStreamImpl(); | 72 virtual ~MediaStreamImpl(); |
| 73 | 73 |
| 74 virtual void GetVideoDevice(int size); |
| 75 |
| 74 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( | 76 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( |
| 75 WebKit::WebPeerConnectionHandlerClient* client); | 77 WebKit::WebPeerConnectionHandlerClient* client); |
| 76 virtual void ClosePeerConnection(); | 78 virtual void ClosePeerConnection(); |
| 77 | 79 |
| 78 // Returns true if created successfully or already exists, false otherwise. | 80 // Returns true if created successfully or already exists, false otherwise. |
| 79 virtual bool SetVideoCaptureModule(const std::string& label); | 81 virtual bool SetVideoCaptureModule(const std::string& label); |
| 80 | 82 |
| 81 // WebKit::WebUserMediaClient implementation | 83 // WebKit::WebUserMediaClient implementation |
| 82 virtual void requestUserMedia( | 84 virtual void requestUserMedia( |
| 83 const WebKit::WebUserMediaRequest& user_media_request, | 85 const WebKit::WebUserMediaRequest& user_media_request, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 const std::string& label, | 99 const std::string& label, |
| 98 const media_stream::StreamDeviceInfoArray& audio_array, | 100 const media_stream::StreamDeviceInfoArray& audio_array, |
| 99 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE; | 101 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE; |
| 100 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; | 102 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; |
| 101 virtual void OnVideoDeviceFailed( | 103 virtual void OnVideoDeviceFailed( |
| 102 const std::string& label, | 104 const std::string& label, |
| 103 int index) OVERRIDE; | 105 int index) OVERRIDE; |
| 104 virtual void OnAudioDeviceFailed( | 106 virtual void OnAudioDeviceFailed( |
| 105 const std::string& label, | 107 const std::string& label, |
| 106 int index) OVERRIDE; | 108 int index) OVERRIDE; |
| 109 virtual void OnDevicesEnumerated( |
| 110 int request_id, |
| 111 const media_stream::StreamDeviceInfoArray& device_array) OVERRIDE; |
| 112 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE; |
| 113 virtual void OnDeviceOpened( |
| 114 int request_id, |
| 115 const std::string& label, |
| 116 const media_stream::StreamDeviceInfo& device_info) OVERRIDE; |
| 117 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; |
| 107 | 118 |
| 108 private: | 119 private: |
| 109 FRIEND_TEST_ALL_PREFIXES(MediaStreamImplTest, Basic); | 120 FRIEND_TEST_ALL_PREFIXES(MediaStreamImplTest, Basic); |
| 110 | 121 |
| 111 void InitializeWorkerThread( | 122 void InitializeWorkerThread( |
| 112 talk_base::Thread** thread, | 123 talk_base::Thread** thread, |
| 113 base::WaitableEvent* event); | 124 base::WaitableEvent* event); |
| 114 void DeleteIpcNetworkManager(); | 125 void DeleteIpcNetworkManager(); |
| 115 | 126 |
| 116 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; | 127 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 talk_base::Thread* signaling_thread_; | 159 talk_base::Thread* signaling_thread_; |
| 149 talk_base::Thread* worker_thread_; | 160 talk_base::Thread* worker_thread_; |
| 150 base::Thread chrome_worker_thread_; | 161 base::Thread chrome_worker_thread_; |
| 151 | 162 |
| 152 static int next_request_id_; | 163 static int next_request_id_; |
| 153 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; | 164 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; |
| 154 MediaRequestMap user_media_requests_; | 165 MediaRequestMap user_media_requests_; |
| 155 | 166 |
| 156 std::list<std::string> stream_labels_; | 167 std::list<std::string> stream_labels_; |
| 157 | 168 |
| 169 int desired_size_; |
| 170 std::string local_label_; |
| 171 |
| 158 // Make sure we only create the video capture module once. This is also | 172 // Make sure we only create the video capture module once. This is also |
| 159 // temporary and will be handled differently when several PeerConnections | 173 // temporary and will be handled differently when several PeerConnections |
| 160 // and/or streams is supported. | 174 // and/or streams is supported. |
| 161 // TODO(grunell): This shall be removed or changed when native PeerConnection | 175 // TODO(grunell): This shall be removed or changed when native PeerConnection |
| 162 // has been updated to closer follow the specification. | 176 // has been updated to closer follow the specification. |
| 163 bool vcm_created_; | 177 bool vcm_created_; |
| 164 | 178 |
| 165 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 179 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 166 }; | 180 }; |
| 167 | 181 |
| 168 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 182 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |