OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 virtual void GenerateStream( | 35 void GenerateStream(int request_id, |
36 int request_id, | 36 MediaStreamDispatcherEventHandler* event_handler, |
37 MediaStreamDispatcherEventHandler* event_handler, | 37 media_stream::StreamOptions components, |
38 media_stream::StreamOptions components, | 38 const std::string& security_origin); |
39 const std::string& security_origin); | |
40 | 39 |
41 // Stop a started stream. Label is the label provided in OnStreamGenerated. | 40 // Stop a started stream. Label is the label provided in OnStreamGenerated. |
42 virtual void StopStream(const std::string& label); | 41 void StopStream(const std::string& label); |
43 | 42 |
44 // Check if the label is a valid stream. | 43 // Check if the label is a valid stream. |
45 virtual bool IsStream(const std::string& label); | 44 bool IsStream(const std::string& label); |
46 // Get the video session_id given a label. The label identifies a stream. | 45 // Get the video session_id given a label. The label identifies a stream. |
47 // index is the index in the video_device_array of the stream. | 46 // index is the index in the video_device_array of the stream. |
48 virtual int video_session_id(const std::string& label, int index); | 47 int video_session_id(const std::string& label, int index); |
49 // Returns an audio session_id given a label and an index. | 48 // Returns an audio session_id given a label and an index. |
50 virtual int audio_session_id(const std::string& label, int index); | 49 int audio_session_id(const std::string& label, int index); |
51 | 50 |
52 private: | 51 private: |
53 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, Basic); | 52 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, Basic); |
54 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); | 53 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); |
55 | 54 |
56 struct Request; | 55 struct Request; |
57 | 56 |
58 // Private class for keeping track of opened devices and who have | 57 // Private class for keeping track of opened devices and who have |
59 // opened it. | 58 // opened it. |
60 struct Stream; | 59 struct Stream; |
(...skipping 14 matching lines...) Expand all Loading... |
75 LabelStreamMap label_stream_map_; | 74 LabelStreamMap label_stream_map_; |
76 | 75 |
77 // List of calls made to GenerateStream that has not yet completed. | 76 // List of calls made to GenerateStream that has not yet completed. |
78 typedef std::list<Request> RequestList; | 77 typedef std::list<Request> RequestList; |
79 RequestList requests_; | 78 RequestList requests_; |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); | 80 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); |
82 }; | 81 }; |
83 | 82 |
84 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 83 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
OLD | NEW |