Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/renderer/media/media_stream_dispatcher.h

Issue 1939313003: Revert of Add support for device-change notifications to MediaStreamDispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <string> 11 #include <string>
12 #include <vector>
13 12
14 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
17 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
18 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
19 #include "content/common/media/media_stream_options.h" 18 #include "content/common/media/media_stream_options.h"
20 #include "content/public/renderer/render_frame_observer.h" 19 #include "content/public/renderer/render_frame_observer.h"
21 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" 20 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
22 21
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const url::Origin& security_origin); 75 const url::Origin& security_origin);
77 76
78 // Cancel the request to open a device. 77 // Cancel the request to open a device.
79 virtual void CancelOpenDevice( 78 virtual void CancelOpenDevice(
80 int request_id, 79 int request_id,
81 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); 80 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
82 81
83 // Close a started device. |label| is provided in OnDeviceOpened. 82 // Close a started device. |label| is provided in OnDeviceOpened.
84 void CloseDevice(const std::string& label); 83 void CloseDevice(const std::string& label);
85 84
86 // Register and unregister event handlers for device-change notifications.
87 // It is an error to try to subscribe a handler that is already subscribed or
88 // to cancel the subscription of a handler that is not subscribed. Also,
89 // each subscribed handler must make sure to invoke
90 // CancelDeviceChangeNotifications() before the handler is destroyed.
91 void SubscribeToDeviceChangeNotifications(
92 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
93 const url::Origin& security_origin);
94 void CancelDeviceChangeNotifications(
95 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
96
97 // Check if the label is a valid stream. 85 // Check if the label is a valid stream.
98 virtual bool IsStream(const std::string& label); 86 virtual bool IsStream(const std::string& label);
99 // Get the video session_id given a label. The label identifies a stream. 87 // Get the video session_id given a label. The label identifies a stream.
100 // index is the index in the video_device_array of the stream. 88 // index is the index in the video_device_array of the stream.
101 virtual int video_session_id(const std::string& label, int index); 89 virtual int video_session_id(const std::string& label, int index);
102 // Returns an audio session_id given a label and an index. 90 // Returns an audio session_id given a label and an index.
103 virtual int audio_session_id(const std::string& label, int index); 91 virtual int audio_session_id(const std::string& label, int index);
104 92
105 protected: 93 protected:
106 int GetNextIpcIdForTest() { return next_ipc_id_; } 94 int GetNextIpcIdForTest() { return next_ipc_id_; }
(...skipping 26 matching lines...) Expand all
133 void OnDeviceStopped(const std::string& label, 121 void OnDeviceStopped(const std::string& label,
134 const StreamDeviceInfo& device_info); 122 const StreamDeviceInfo& device_info);
135 void OnDevicesEnumerated( 123 void OnDevicesEnumerated(
136 int request_id, 124 int request_id,
137 const StreamDeviceInfoArray& device_array); 125 const StreamDeviceInfoArray& device_array);
138 void OnDeviceOpened( 126 void OnDeviceOpened(
139 int request_id, 127 int request_id,
140 const std::string& label, 128 const std::string& label,
141 const StreamDeviceInfo& device_info); 129 const StreamDeviceInfo& device_info);
142 void OnDeviceOpenFailed(int request_id); 130 void OnDeviceOpenFailed(int request_id);
143 void OnDevicesChanged();
144 131
145 // Used for DCHECKs so methods calls won't execute in the wrong thread. 132 // Used for DCHECKs so methods calls won't execute in the wrong thread.
146 base::ThreadChecker thread_checker_; 133 base::ThreadChecker thread_checker_;
147 134
148 int next_ipc_id_; 135 int next_ipc_id_;
149 typedef std::map<std::string, Stream> LabelStreamMap; 136 typedef std::map<std::string, Stream> LabelStreamMap;
150 LabelStreamMap label_stream_map_; 137 LabelStreamMap label_stream_map_;
151 138
152 // List of calls made to the browser process that have not yet completed or 139 // List of calls made to the browser process that have not yet completed or
153 // been canceled. 140 // been canceled.
154 typedef std::list<Request> RequestList; 141 typedef std::list<Request> RequestList;
155 RequestList requests_; 142 RequestList requests_;
156 143
157 std::vector<base::WeakPtr<MediaStreamDispatcherEventHandler>>
158 device_change_subscribers_;
159
160 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); 144 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher);
161 }; 145 };
162 146
163 } // namespace content 147 } // namespace content
164 148
165 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ 149 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/common/media/media_stream_messages.h ('k') | content/renderer/media/media_stream_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698