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

Issue 10912004: Begin adding support for tab mirroring via the MediaStream audio/video capturing (Closed)

Created:
8 years, 3 months ago by miu
Modified:
6 years, 5 months ago
CC:
chromium-reviews, mihaip-chromium-reviews_chromium.org, Aaron Boodman, tfarina, jeremya+watch_chromium.org, jam, joi+watch-content_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, hclam, justinlin, hans
Visibility:
Public.

Description

Begin adding support for tab mirroring via the MediaStream audio/video capturing framework. Expanded the scope of the content::MediaStreamDeviceType enum to support the new concept of "internal capture devices." From there, many modules were tweaked to account for the new concept. In some cases, significant new functionality was added (described below). In this change, tab mirroring audio and video capture devices have been introduced, but stubbed-out. The following proposal provides more backrgound on this and the overall motivation for the code changes at-hand: http://dev.chromium.org/developers/design-documents/extensions/proposed-changes/apis-under-development/webrtc-tab-content-capture Significant changes: 1. content/common/media and content/public/common -- a) Expand content::MediaStreamDeviceType enum; b) Update media_stream::StreamOptions so that extension API bindings can ask for any of the MediaStreamTypes. 2. content/browser/renderer_host/media -- Minor refactoring: MediaStreamManager handles all MediaStreamDeviceTypes. Only supports EnumerateDevices and OpenDevice for physical device types. Add new GenerateStreamForDevice() API. 3. chrome/browser/media and chrome/browser/ui -- Enhance "Allow/Deny and device selection" infobar to handle all MediaStreamDeviceTypes. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155925

Patch Set 1 #

Total comments: 18

Patch Set 2 : Add CONTENT_EXPORT to resolve linker issues on components builds. Also, IWYU. #

Total comments: 34

Patch Set 3 : Changes after review by xians@. #

Total comments: 4

Patch Set 4 : Renamed MEDIA_USER_*_CAPTURE to MEDIA_*_DEVICE_CAPTURE, as suggested by wjia@. #

Total comments: 17

Patch Set 5 : Added separate GetStreamForDevice() call, per discussion with wjia@. Addressed more review comment… #

Patch Set 6 : Add MediaStreamDispatcher IPC glue (and unittests) for new GenerateStreamForDevice() API. #

Total comments: 21

Patch Set 7 : AudioManager injection into MediaStreamManager, consistent enum naming; per wjia@ comments. Also, … #

Total comments: 12

Patch Set 8 : Simplify: Use only one AudioInputDeviceManager and VideoCaptureManager, like before. #

Total comments: 45

Patch Set 9 : Addressed plethora of comments (mostly style issues) from xians@, tommi@ and scherkus@. #

Patch Set 10 : REBASE #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1034 lines, -660 lines) Patch
M chrome/browser/media/media_stream_capture_indicator.cc View 1 2 4 chunks +11 lines, -8 lines 0 comments Download
M chrome/browser/media/media_stream_devices_controller.h View 1 2 3 4 5 6 7 8 3 chunks +29 lines, -8 lines 0 comments Download
M chrome/browser/media/media_stream_devices_controller.cc View 1 2 3 4 5 6 7 8 8 chunks +109 lines, -84 lines 0 comments Download
M chrome/browser/media/media_stream_devices_menu_model.h View 1 2 3 4 5 6 1 chunk +0 lines, -7 lines 0 comments Download
M chrome/browser/media/media_stream_devices_menu_model.cc View 1 2 3 4 5 6 7 8 5 chunks +25 lines, -13 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/media_stream_infobar_controller.mm View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/extensions/shell_window.cc View 1 2 3 4 5 6 7 8 9 3 chunks +21 lines, -14 lines 0 comments Download
M chrome/browser/ui/gtk/infobars/media_stream_infobar_gtk.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/media_stream_infobar_delegate.h View 1 2 3 4 5 6 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/ui/media_stream_infobar_delegate.cc View 1 2 3 4 5 6 1 chunk +10 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/infobars/media_stream_infobar.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -9 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager.h View 1 2 3 4 5 6 7 8 9 5 chunks +7 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager.cc View 1 2 3 4 5 6 7 8 9 7 chunks +27 lines, -24 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 17 chunks +24 lines, -44 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_device_settings.cc View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_device_settings_unittest.cc View 1 2 3 4 5 6 2 chunks +2 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host.h View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host.cc View 1 2 3 4 5 6 7 8 3 chunks +30 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc View 1 2 3 4 5 6 7 8 4 chunks +37 lines, -8 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_manager.h View 1 2 3 4 5 6 7 8 9 8 chunks +28 lines, -16 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_manager.cc View 1 2 3 4 5 6 7 8 9 25 chunks +260 lines, -223 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_provider.h View 3 chunks +4 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/media_stream_requester.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_host.h View 2 chunks +3 lines, -3 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host_unittest.cc View 1 2 3 4 5 6 7 3 chunks +4 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 2 3 4 5 6 7 8 4 chunks +15 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 4 5 6 7 8 15 chunks +92 lines, -58 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager_unittest.cc View 1 2 3 4 5 6 7 7 chunks +12 lines, -12 lines 0 comments Download
M content/common/media/media_stream_messages.h View 1 2 3 4 5 2 chunks +12 lines, -4 lines 0 comments Download
M content/common/media/media_stream_options.h View 1 2 3 4 1 chunk +10 lines, -9 lines 0 comments Download
M content/common/media/media_stream_options.cc View 1 2 3 4 5 6 1 chunk +24 lines, -1 line 0 comments Download
M content/public/common/media_stream_request.h View 1 2 3 4 5 6 1 chunk +16 lines, -4 lines 0 comments Download
M content/public/common/media_stream_request.cc View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_dispatcher.h View 1 2 3 4 5 6 4 chunks +13 lines, -2 lines 0 comments Download
M content/renderer/media/media_stream_dispatcher.cc View 1 2 3 4 5 6 3 chunks +26 lines, -8 lines 0 comments Download
M content/renderer/media/media_stream_dispatcher_unittest.cc View 1 2 3 4 5 6 8 chunks +97 lines, -23 lines 0 comments Download
M content/renderer/media/mock_media_stream_dispatcher.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M content/renderer/media/mock_media_stream_dispatcher.cc View 1 2 3 4 5 6 7 8 2 chunks +39 lines, -8 lines 0 comments Download
M content/renderer/pepper/pepper_device_enumeration_event_handler.cc View 1 2 3 4 5 6 2 chunks +7 lines, -7 lines 0 comments Download
M content/test/webrtc_audio_device_test.cc View 1 2 3 4 5 6 2 chunks +2 lines, -10 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
miu
wjia@ and xians@: Please review all changes, or re-assign as appropriate. avi@: Please review/OWNERS-approve for ...
8 years, 3 months ago (2012-08-30 08:15:57 UTC) #1
Avi (use Gerrit)
content/public LGTM
8 years, 3 months ago (2012-08-30 14:19:29 UTC) #2
no longer working on chromium
It looks awesome. Thanks Miu for doing this. My first round of review, and I ...
8 years, 3 months ago (2012-08-31 13:38:22 UTC) #3
miu
Thanks, Shijing, for the thorough review. I've addressed all your comments. -Yuri http://codereview.chromium.org/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc File chrome/browser/media/media_stream_devices_controller.cc ...
8 years, 3 months ago (2012-09-01 01:32:00 UTC) #4
miu
Forgot to mention: I ran the webrtc pyauto tests successfully, confirming no breakage.
8 years, 3 months ago (2012-09-01 01:33:50 UTC) #5
wjia(left Chromium)
Could you elaborate which set of API will be used for TAB capture: GenerateStream, or ...
8 years, 3 months ago (2012-09-03 15:54:17 UTC) #6
miu
On 2012/09/03 15:54:17, wjia wrote: > Could you elaborate which set of API will be ...
8 years, 3 months ago (2012-09-04 20:38:38 UTC) #7
miu
https://chromiumcodereview.appspot.com/10912004/diff/7003/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/7003/content/browser/renderer_host/media/media_stream_manager.cc#newcode309 content/browser/renderer_host/media/media_stream_manager.cc:309: options.opt_device_id = device_id; On 2012/09/03 15:54:17, wjia wrote: > ...
8 years, 3 months ago (2012-09-04 20:42:19 UTC) #8
no longer working on chromium
This is indeed a very big CL and could have been divided into 2 or ...
8 years, 3 months ago (2012-09-05 14:19:41 UTC) #9
miu
https://chromiumcodereview.appspot.com/10912004/diff/6007/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/6007/content/browser/renderer_host/media/media_stream_manager.cc#newcode236 content/browser/renderer_host/media/media_stream_manager.cc:236: EnumerationCache* cache; On 2012/09/05 14:19:41, xians1 wrote: > why ...
8 years, 3 months ago (2012-09-06 04:40:35 UTC) #10
wjia(left Chromium)
Nice! https://chromiumcodereview.appspot.com/10912004/diff/14004/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/14004/content/browser/renderer_host/media/media_stream_manager.cc#newcode285 content/browser/renderer_host/media/media_stream_manager.cc:285: } Based on the DCHECK at the beginning ...
8 years, 3 months ago (2012-09-07 14:11:35 UTC) #11
wjia(left Chromium)
missed couple of comments. https://chromiumcodereview.appspot.com/10912004/diff/14004/content/public/common/media_stream_request.h File content/public/common/media_stream_request.h (right): https://chromiumcodereview.appspot.com/10912004/diff/14004/content/public/common/media_stream_request.h#newcode28 content/public/common/media_stream_request.h:28: MEDIA_TAB_VIDEO_CAPTURE, It would be nice ...
8 years, 3 months ago (2012-09-07 17:16:30 UTC) #12
miu
Addressed latest round of issues. PTAL. https://chromiumcodereview.appspot.com/10912004/diff/14004/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/14004/content/browser/renderer_host/media/media_stream_manager.cc#newcode285 content/browser/renderer_host/media/media_stream_manager.cc:285: } (This was ...
8 years, 3 months ago (2012-09-07 23:14:28 UTC) #13
wjia(left Chromium)
Thanks! LGTM.
8 years, 3 months ago (2012-09-09 18:49:56 UTC) #14
sky
c/b/u LGTM
8 years, 3 months ago (2012-09-10 01:42:12 UTC) #15
no longer working on chromium
Some more comments, but most of them are nits, please address them. Note that some ...
8 years, 3 months ago (2012-09-10 09:11:03 UTC) #16
tommi (sloooow) - chröme
https://chromiumcodereview.appspot.com/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc File chrome/browser/media/media_stream_devices_controller.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc#newcode48 chrome/browser/media/media_stream_devices_controller.cc:48: has_audio_ = false; initialize these in the initializer list ...
8 years, 3 months ago (2012-09-10 09:17:25 UTC) #17
no longer working on chromium
https://chromiumcodereview.appspot.com/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc File chrome/browser/media/media_stream_devices_controller.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc#newcode119 chrome/browser/media/media_stream_devices_controller.cc:119: return request_.security_origin.spec(); On 2012/09/10 09:17:25, tommi wrote: > why ...
8 years, 3 months ago (2012-09-10 11:00:17 UTC) #18
scherkus (not reviewing)
media-related LGTM w/ nits deferring to tommi/xians/wjia for remainder fo review https://chromiumcodereview.appspot.com/10912004/diff/6052/chrome/browser/media/media_stream_devices_controller.cc File chrome/browser/media/media_stream_devices_controller.cc (right): ...
8 years, 3 months ago (2012-09-10 11:08:58 UTC) #19
tommi (sloooow) - chröme
https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/media_stream_manager.cc#newcode647 content/browser/renderer_host/media/media_stream_manager.cc:647: it->second.requester->AudioDeviceFailed(it->first, audio_device_idx); On 2012/09/10 11:00:17, xians1 wrote: > I ...
8 years, 3 months ago (2012-09-10 11:29:00 UTC) #20
no longer working on chromium
https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/media_stream_manager.cc#newcode647 content/browser/renderer_host/media/media_stream_manager.cc:647: it->second.requester->AudioDeviceFailed(it->first, audio_device_idx); On 2012/09/10 11:29:01, tommi wrote: > On ...
8 years, 3 months ago (2012-09-10 12:28:03 UTC) #21
wjia(left Chromium)
Trying to clarify something which doesn't belong to this patch. https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/renderer_host/media/video_capture_manager.cc#newcode232 ...
8 years, 3 months ago (2012-09-10 17:40:16 UTC) #22
miu
Thank you, everyone, for the code review. I've addressed all outstanding comments. -Yuri https://chromiumcodereview.appspot.com/10912004/diff/1/chrome/browser/media/media_stream_devices_controller.cc File ...
8 years, 3 months ago (2012-09-10 21:24:38 UTC) #23
no longer working on chromium
thanks, lgtm++. One more question, are you going to land it before the cut, or ...
8 years, 3 months ago (2012-09-10 22:12:38 UTC) #24
miu
On 2012/09/10 22:12:38, xians1 wrote: > thanks, lgtm++. > One more question, are you going ...
8 years, 3 months ago (2012-09-10 22:29:07 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/miu@chromium.org/10912004/3020
8 years, 3 months ago (2012-09-11 00:28:52 UTC) #26
commit-bot: I haz the power
Change committed as 155925
8 years, 3 months ago (2012-09-11 02:53:11 UTC) #27
tommi (sloooow) - chröme
8 years, 3 months ago (2012-09-11 10:40:26 UTC) #28
lgtm.

https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/ren...
File content/browser/renderer_host/media/video_capture_manager.cc (right):

https://chromiumcodereview.appspot.com/10912004/diff/6052/content/browser/ren...
content/browser/renderer_host/media/video_capture_manager.cc:232: delete
entry.capture_device;
On 2012/09/10 17:40:16, wjia wrote:
> On 2012/09/10 09:17:25, tommi wrote:
> > set to NULL as well?
> > It's not clear to me how capture_device ownership is managed actually and at
> > what time it is safe to delete etc.  There seems to be a good chance of
> > object/memory leaks here.
> 
> |entry| is a local variable. No need to set it to NULL. What happens here is
> that:
> 1. VideoCaptureDevices used to use capture_session_id as index to store
> VideoCaptureDevice, and it's possible multiple capture_session_id's can be
> mapped to same VideoCaptureDevice.
> 2. miu@ just added a MediaStreamType associated with each VideoCaptureDevice
> (i.e., the new class DeviceEntry).
> 3. When OnClose() is called, the entry in VideoCaptureDevices will be erased
> immediately. However, the corresponding VideoCaptureDevice might be still in
use
> by other session_id's. Therefore, the copy of DeviceEntry on line 211.
> 4. The VideoCaptureDevice will be deleted only when it's not used by any
> session.
> 
> Hope this clarifies.

Thanks for the info.

Powered by Google App Engine
This is Rietveld 408576698