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_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Request a new media stream to be created. | 39 // Request a new media stream to be created. |
40 // This can be used either by WebKit or a plugin. | 40 // This can be used either by WebKit or a plugin. |
41 // Note: The event_handler must be valid for as long as the stream exists. | 41 // Note: The event_handler must be valid for as long as the stream exists. |
42 virtual void GenerateStream( | 42 virtual void GenerateStream( |
43 int request_id, | 43 int request_id, |
44 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 44 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
45 media_stream::StreamOptions components, | 45 media_stream::StreamOptions components, |
46 const GURL& security_origin); | 46 const GURL& security_origin); |
47 | 47 |
48 // Like GenerateStream above, except use the device specified by |device_id| | |
49 // rather than allow the user to choose one. | |
50 virtual void GenerateStreamForDevice( | |
51 int request_id, | |
52 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | |
53 media_stream::StreamOptions components, | |
54 const std::string& device_id, | |
55 const GURL& security_origin); | |
56 | |
57 // Cancel the request for a new media stream to be created. | 48 // Cancel the request for a new media stream to be created. |
58 virtual void CancelGenerateStream(int request_id); | 49 virtual void CancelGenerateStream(int request_id); |
59 | 50 |
60 // Stop a started stream. Label is the label provided in OnStreamGenerated. | 51 // Stop a started stream. Label is the label provided in OnStreamGenerated. |
61 virtual void StopStream(const std::string& label); | 52 virtual void StopStream(const std::string& label); |
62 | 53 |
63 // Request to enumerate devices. | 54 // Request to enumerate devices. |
64 void EnumerateDevices( | 55 void EnumerateDevices( |
65 int request_id, | 56 int request_id, |
66 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 57 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Used for DCHECKs so methods calls won't execute in the wrong thread. | 149 // Used for DCHECKs so methods calls won't execute in the wrong thread. |
159 scoped_refptr<base::MessageLoopProxy> main_loop_; | 150 scoped_refptr<base::MessageLoopProxy> main_loop_; |
160 | 151 |
161 int next_ipc_id_; | 152 int next_ipc_id_; |
162 typedef std::map<std::string, Stream> LabelStreamMap; | 153 typedef std::map<std::string, Stream> LabelStreamMap; |
163 LabelStreamMap label_stream_map_; | 154 LabelStreamMap label_stream_map_; |
164 | 155 |
165 EnumerationState audio_enumeration_state_; | 156 EnumerationState audio_enumeration_state_; |
166 EnumerationState video_enumeration_state_; | 157 EnumerationState video_enumeration_state_; |
167 | 158 |
168 // List of calls made to GenerateStream/GenerateStreamForDevice that has not | 159 // List of calls made to GenerateStream that have not yet completed. |
169 // yet completed. | |
170 typedef std::list<Request> RequestList; | 160 typedef std::list<Request> RequestList; |
171 RequestList requests_; | 161 RequestList requests_; |
172 | 162 |
173 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); | 163 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); |
174 }; | 164 }; |
175 | 165 |
176 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 166 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
OLD | NEW |