OLD | NEW |
1 // Copyright (c) 2011 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> |
11 | 11 |
(...skipping 13 matching lines...) Expand all Loading... |
25 // BrowserRenderProcessHost). | 25 // BrowserRenderProcessHost). |
26 class CONTENT_EXPORT MediaStreamDispatcher | 26 class CONTENT_EXPORT MediaStreamDispatcher |
27 : public content::RenderViewObserver { | 27 : public content::RenderViewObserver { |
28 public: | 28 public: |
29 explicit MediaStreamDispatcher(RenderViewImpl* render_view); | 29 explicit MediaStreamDispatcher(RenderViewImpl* render_view); |
30 virtual ~MediaStreamDispatcher(); | 30 virtual ~MediaStreamDispatcher(); |
31 | 31 |
32 // Request a new media stream to be created. | 32 // Request a new media stream to be created. |
33 // This can be used either of WebKit or a plugin. | 33 // This can be used either of WebKit or a plugin. |
34 // Note: The event_handler must be valid for as long as the stream exists. | 34 // Note: The event_handler must be valid for as long as the stream exists. |
35 void GenerateStream(int request_id, | 35 virtual void GenerateStream( |
36 MediaStreamDispatcherEventHandler* event_handler, | 36 int request_id, |
37 media_stream::StreamOptions components, | 37 MediaStreamDispatcherEventHandler* event_handler, |
38 const std::string& security_origin); | 38 media_stream::StreamOptions components, |
| 39 const std::string& security_origin); |
39 | 40 |
40 // Stop a started stream. Label is the label provided in OnStreamGenerated. | 41 // Stop a started stream. Label is the label provided in OnStreamGenerated. |
41 void StopStream(const std::string& label); | 42 virtual void StopStream(const std::string& label); |
42 | 43 |
43 // Check if the label is a valid stream. | 44 // Check if the label is a valid stream. |
44 bool IsStream(const std::string& label); | 45 virtual bool IsStream(const std::string& label); |
45 // Get the video session_id given a label. The label identifies a stream. | 46 // Get the video session_id given a label. The label identifies a stream. |
46 // index is the index in the video_device_array of the stream. | 47 // index is the index in the video_device_array of the stream. |
47 int video_session_id(const std::string& label, int index); | 48 virtual int video_session_id(const std::string& label, int index); |
48 // Returns an audio session_id given a label and an index. | 49 // Returns an audio session_id given a label and an index. |
49 int audio_session_id(const std::string& label, int index); | 50 virtual int audio_session_id(const std::string& label, int index); |
50 | 51 |
51 private: | 52 private: |
52 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, Basic); | 53 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, Basic); |
53 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); | 54 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); |
54 | 55 |
55 struct Request; | 56 struct Request; |
56 | 57 |
57 // Private class for keeping track of opened devices and who have | 58 // Private class for keeping track of opened devices and who have |
58 // opened it. | 59 // opened it. |
59 struct Stream; | 60 struct Stream; |
(...skipping 14 matching lines...) Expand all Loading... |
74 LabelStreamMap label_stream_map_; | 75 LabelStreamMap label_stream_map_; |
75 | 76 |
76 // List of calls made to GenerateStream that has not yet completed. | 77 // List of calls made to GenerateStream that has not yet completed. |
77 typedef std::list<Request> RequestList; | 78 typedef std::list<Request> RequestList; |
78 RequestList requests_; | 79 RequestList requests_; |
79 | 80 |
80 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); | 81 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); |
81 }; | 82 }; |
82 | 83 |
83 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 84 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
OLD | NEW |