| 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 <memory> | 10 #include <memory> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 virtual void CancelOpenDevice( | 68 virtual void CancelOpenDevice( |
| 69 int request_id, | 69 int request_id, |
| 70 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); | 70 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); |
| 71 | 71 |
| 72 // Close a started device. |label| is provided in OnDeviceOpened. | 72 // Close a started device. |label| is provided in OnDeviceOpened. |
| 73 void CloseDevice(const std::string& label); | 73 void CloseDevice(const std::string& label); |
| 74 | 74 |
| 75 // This method is called when the stream is started successfully. | 75 // This method is called when the stream is started successfully. |
| 76 void OnStreamStarted(const std::string& label); | 76 void OnStreamStarted(const std::string& label); |
| 77 | 77 |
| 78 // Get all the media devices of video capture, e.g. webcam. This is the set |
| 79 // of devices that should be suspended when the content frame is no longer |
| 80 // being shown to the user. |
| 81 void GetNonScreenCaptureDevices(StreamDeviceInfoArray* video_array); |
| 82 |
| 78 // Check if the label is a valid stream. | 83 // Check if the label is a valid stream. |
| 79 virtual bool IsStream(const std::string& label); | 84 virtual bool IsStream(const std::string& label); |
| 80 // Get the video session_id given a label. The label identifies a stream. | 85 // Get the video session_id given a label. The label identifies a stream. |
| 81 // index is the index in the video_device_array of the stream. | 86 // index is the index in the video_device_array of the stream. |
| 82 virtual int video_session_id(const std::string& label, int index); | 87 virtual int video_session_id(const std::string& label, int index); |
| 83 // Returns an audio session_id given a label and an index. | 88 // Returns an audio session_id given a label and an index. |
| 84 virtual int audio_session_id(const std::string& label, int index); | 89 virtual int audio_session_id(const std::string& label, int index); |
| 85 | 90 |
| 86 protected: | 91 protected: |
| 87 int GetNextIpcIdForTest() { return next_ipc_id_; } | 92 int GetNextIpcIdForTest() { return next_ipc_id_; } |
| 88 | 93 |
| 89 private: | 94 private: |
| 90 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, BasicVideoDevice); | 95 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, BasicVideoDevice); |
| 91 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); | 96 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure); |
| 92 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, CancelGenerateStream); | 97 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, CancelGenerateStream); |
| 98 FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, |
| 99 GetNonScreenCaptureDevices); |
| 93 | 100 |
| 94 struct Request; | 101 struct Request; |
| 95 | 102 |
| 96 // Private class for keeping track of opened devices and who have | 103 // Private class for keeping track of opened devices and who have |
| 97 // opened it. | 104 // opened it. |
| 98 struct Stream; | 105 struct Stream; |
| 99 | 106 |
| 100 // RenderFrameObserver override. | 107 // RenderFrameObserver override. |
| 101 void OnDestruct() override; | 108 void OnDestruct() override; |
| 102 bool Send(IPC::Message* message) override; | 109 bool Send(IPC::Message* message) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 130 // been canceled. | 137 // been canceled. |
| 131 typedef std::list<Request> RequestList; | 138 typedef std::list<Request> RequestList; |
| 132 RequestList requests_; | 139 RequestList requests_; |
| 133 | 140 |
| 134 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); | 141 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); |
| 135 }; | 142 }; |
| 136 | 143 |
| 137 } // namespace content | 144 } // namespace content |
| 138 | 145 |
| 139 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 146 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
| OLD | NEW |