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

Issue 242013002: Refactor video capturing code in the render process (Closed)

Created:
6 years, 8 months ago by Alpha Left Google
Modified:
6 years, 7 months ago
CC:
chromium-reviews, fischman+watch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, wjia+watch_chromium.org, miu+watch_chromium.org, perkj_chrome
Visibility:
Public.

Description

Refactor video capturing code in the render process This is a large refactoring to cleanup the code that handles video capturing in the render process. The goal of this change is to: * Simplify threading model for objects involved. * Clarify ownership model. * Remove extra complexity caused by media::VideoCapture. Summary of this change: * Interface media::VideoCapture is removed completely. This interface doesn't add much value. It fails to define threading model and ownership. Some of the methods are obsolete. * Pepper code that performs video capturing now do not inherit from media::VideoCapture. The inheritance is not necessary * VideoCaptureImpl is now a purely IO thread object. VideoCaptureImpl can only be accessed on the IO thread. It now becomes and inner object of VideoCaptureImplManager. Client is not allowed to access this object directly. This helps remove code that accepts call from the render thread and hopping to the IO thread. This also makes cleanup much simpler. * VideoCaptureHandle is removed. The function of VideoCaptureHandle, i.e. handle cleanup of video capture resource is now folded into VideoCaptureImplManager. It's function is now replaced by a closure. * VideoCaptureImplManager becomes the public interface for accessing video capture device and start/stop capture. It takes VideoCaptureImpl as an internal object and sheild it from clients. We can now perform cleanup to prevent leak. Also ensures VideoCaptureImpl objects are deleted on the IO thread. * VideoFrames delivery done using callback insteasd of an interface. Using callback to deliver VideoFrames and state changes make thread hopping much simpler. Clients no longer need to provide an EventHandler interface. * Net deleted 450 lines of code. Tested with apprtc.appspot.com and example pepper plugin. Additional test to verify there's no leakage of VideoCaptureImpl objects. BUG=335327, 362558 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266492

Patch Set 1 #

Patch Set 2 : more friends #

Patch Set 3 : explicit ClientInfo ctor #

Patch Set 4 : explicit dtor #

Patch Set 5 : merged #

Total comments: 80

Patch Set 6 : #

Patch Set 7 : merged #

Patch Set 8 : merged again :( #

Total comments: 29

Patch Set 9 : comments and merged #

Total comments: 2

Patch Set 10 : merged again :( #

Patch Set 11 : remove TimeTicks #

Total comments: 1

Patch Set 12 : merged and upload again #

Patch Set 13 : upload once more #

Patch Set 14 : merge again and again :( #

Total comments: 13

Patch Set 15 : fixed comments #

Patch Set 16 : comments for PepperPlatformVideoCapture #

Total comments: 1

Patch Set 17 : all done #

Patch Set 18 : merge again :( #

Unified diffs Side-by-side diffs Delta from patch set Stats (+828 lines, -1178 lines) Patch
M content/browser/renderer_host/media/video_capture_controller.h View 1 chunk +0 lines, -1 line 0 comments Download
M content/common/media/video_capture.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +13 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_video_capture_source_unittest.cc View 1 2 3 4 5 6 7 8 9 3 chunks +7 lines, -7 lines 0 comments Download
M content/renderer/media/media_stream_video_capturer_source.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +27 lines, -41 lines 0 comments Download
M content/renderer/media/media_stream_video_capturer_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +77 lines, -80 lines 0 comments Download
M content/renderer/media/media_stream_video_source.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -1 line 0 comments Download
M content/renderer/media/media_stream_video_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/media/media_stream_video_source_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +7 lines, -4 lines 0 comments Download
M content/renderer/media/video_capture_impl.h View 1 2 3 4 5 6 7 8 6 chunks +60 lines, -51 lines 0 comments Download
M content/renderer/media/video_capture_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 15 chunks +122 lines, -158 lines 0 comments Download
M content/renderer/media/video_capture_impl_manager.h View 1 2 3 4 5 3 chunks +61 lines, -45 lines 0 comments Download
M content/renderer/media/video_capture_impl_manager.cc View 1 2 3 4 5 6 7 8 2 chunks +134 lines, -61 lines 0 comments Download
M content/renderer/media/video_capture_impl_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +54 lines, -36 lines 0 comments Download
M content/renderer/media/video_capture_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +123 lines, -133 lines 0 comments Download
M content/renderer/media/video_capture_message_filter.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/media/webrtc/media_stream_remote_video_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/media/webrtc/video_destination_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -2 lines 0 comments Download
M content/renderer/pepper/pepper_platform_video_capture.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +17 lines, -44 lines 0 comments Download
M content/renderer/pepper/pepper_platform_video_capture.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +64 lines, -94 lines 0 comments Download
M content/renderer/pepper/pepper_video_capture_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +29 lines, -14 lines 0 comments Download
M content/renderer/pepper/pepper_video_capture_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 10 chunks +25 lines, -28 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +0 lines, -5 lines 0 comments Download
D media/video/capture/mock_video_capture_event_handler.h View 1 chunk +0 lines, -40 lines 0 comments Download
D media/video/capture/mock_video_capture_event_handler.cc View 1 chunk +0 lines, -15 lines 0 comments Download
D media/video/capture/video_capture.h View 1 chunk +0 lines, -95 lines 0 comments Download
D media/video/capture/video_capture_proxy.h View 1 chunk +0 lines, -85 lines 0 comments Download
D media/video/capture/video_capture_proxy.cc View 1 chunk +0 lines, -135 lines 0 comments Download

Messages

Total messages: 56 (0 generated)
Alpha Left Google
6 years, 8 months ago (2014-04-17 22:46:11 UTC) #1
Alpha Left Google
6 years, 8 months ago (2014-04-17 22:46:12 UTC) #2
Alpha Left Google
ifh: Please review pepper related code. fischman: Everything else. perkj: cc'ed.
6 years, 8 months ago (2014-04-17 22:47:13 UTC) #3
Alpha Left Google
Ping reviewers.
6 years, 8 months ago (2014-04-18 21:20:38 UTC) #4
Ami GONE FROM CHROMIUM
On Fri, Apr 18, 2014 at 2:20 PM, <hclam@chromium.org> wrote: > Ping reviewers. > > ...
6 years, 8 months ago (2014-04-18 21:24:46 UTC) #5
Alpha Left Google
> Remember last night when I was leaving and I told you: "it's gonna be ...
6 years, 8 months ago (2014-04-18 21:28:04 UTC) #6
ilja
This looks much simpler, thank you. I did not see anything remarkable. But it has ...
6 years, 8 months ago (2014-04-21 21:39:58 UTC) #7
Ami GONE FROM CHROMIUM
I <3 this CL. https://codereview.chromium.org/242013002/diff/80001/content/renderer/media/media_stream_video_capturer_source.cc File content/renderer/media/media_stream_video_capturer_source.cc (right): https://codereview.chromium.org/242013002/diff/80001/content/renderer/media/media_stream_video_capturer_source.cc#newcode85 content/renderer/media/media_stream_video_capturer_source.cc:85: RenderThreadImpl::current()->video_capture_impl_manager(); don't need to worry ...
6 years, 8 months ago (2014-04-21 23:42:52 UTC) #8
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-23 02:29:20 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/80001
6 years, 8 months ago (2014-04-23 02:29:36 UTC) #10
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-23 02:29:37 UTC) #11
commit-bot: I haz the power
No LGTM from a valid reviewer yet. Only full committers are accepted. Even if an ...
6 years, 8 months ago (2014-04-23 02:29:37 UTC) #12
Alpha Left Google
On 2014/04/23 02:29:37, I haz the power (commit-bot) wrote: > No LGTM from a valid ...
6 years, 8 months ago (2014-04-23 03:03:12 UTC) #13
Alpha Left Google
On 2014/04/23 02:29:37, I haz the power (commit-bot) wrote: > No LGTM from a valid ...
6 years, 8 months ago (2014-04-23 03:03:12 UTC) #14
Alpha Left Google
https://codereview.chromium.org/242013002/diff/80001/content/renderer/media/media_stream_video_capturer_source.cc File content/renderer/media/media_stream_video_capturer_source.cc (right): https://codereview.chromium.org/242013002/diff/80001/content/renderer/media/media_stream_video_capturer_source.cc#newcode85 content/renderer/media/media_stream_video_capturer_source.cc:85: RenderThreadImpl::current()->video_capture_impl_manager(); On 2014/04/21 23:42:53, Ami Fischman wrote: > don't ...
6 years, 8 months ago (2014-04-23 18:48:32 UTC) #15
Ami GONE FROM CHROMIUM
Yay for less refcounting! https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/media_stream_video_capturer_source.cc File content/renderer/media/media_stream_video_capturer_source.cc (right): https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/media_stream_video_capturer_source.cc#newcode48 content/renderer/media/media_stream_video_capturer_source.cc:48: if (manager) how can this ...
6 years, 8 months ago (2014-04-24 21:04:30 UTC) #16
Alpha Left Google
https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/media_stream_video_capturer_source.cc File content/renderer/media/media_stream_video_capturer_source.cc (right): https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/media_stream_video_capturer_source.cc#newcode48 content/renderer/media/media_stream_video_capturer_source.cc:48: if (manager) On 2014/04/24 21:04:31, Ami Fischman wrote: > ...
6 years, 8 months ago (2014-04-24 22:50:34 UTC) #17
Ami GONE FROM CHROMIUM
https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/webrtc/video_destination_handler.cc File content/renderer/media/webrtc/video_destination_handler.cc (right): https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/webrtc/video_destination_handler.cc#newcode120 content/renderer/media/webrtc/video_destination_handler.cc:120: // Not all sinks care about the TimeTicks so ...
6 years, 8 months ago (2014-04-24 23:05:17 UTC) #18
Alpha Left Google
https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/webrtc/video_destination_handler.cc File content/renderer/media/webrtc/video_destination_handler.cc (right): https://codereview.chromium.org/242013002/diff/140001/content/renderer/media/webrtc/video_destination_handler.cc#newcode120 content/renderer/media/webrtc/video_destination_handler.cc:120: // Not all sinks care about the TimeTicks so ...
6 years, 8 months ago (2014-04-24 23:33:52 UTC) #19
Ami GONE FROM CHROMIUM
LGTM % the ticks-vs-delta issue. On Thu, Apr 24, 2014 at 4:33 PM, <hclam@chromium.org> wrote: ...
6 years, 8 months ago (2014-04-25 00:44:08 UTC) #20
Alpha Left Google
Removed TimeTicks as discussed. Please take another look.
6 years, 8 months ago (2014-04-25 19:43:11 UTC) #21
Ami GONE FROM CHROMIUM
https://codereview.chromium.org/242013002/diff/200001/content/renderer/media/media_stream_video_source.cc File content/renderer/media/media_stream_video_source.cc (right): https://codereview.chromium.org/242013002/diff/200001/content/renderer/media/media_stream_video_source.cc#newcode373 content/renderer/media/media_stream_video_source.cc:373: const base::TimeTicks& timestamp) { Why is this param still ...
6 years, 8 months ago (2014-04-25 19:56:16 UTC) #22
Alpha Left Google
Had a problem with git. The last upload patch is correct now.
6 years, 8 months ago (2014-04-25 20:15:40 UTC) #23
Ami GONE FROM CHROMIUM
PS#9->#13 LGTM Please file a crbug detailing the delta/ticks discrepancy and point to it from ...
6 years, 8 months ago (2014-04-25 20:21:34 UTC) #24
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-25 20:23:38 UTC) #25
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-25 20:31:15 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/260001
6 years, 8 months ago (2014-04-25 21:39:16 UTC) #27
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-25 22:33:47 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on chromium_presubmit
6 years, 8 months ago (2014-04-25 22:33:47 UTC) #29
Alpha Left Google
+bbudge for OWNERS approval for content/renderer/pepper.
6 years, 8 months ago (2014-04-25 22:53:17 UTC) #30
bbudge
https://codereview.chromium.org/242013002/diff/260001/content/renderer/pepper/pepper_platform_video_capture.cc File content/renderer/pepper/pepper_platform_video_capture.cc (right): https://codereview.chromium.org/242013002/diff/260001/content/renderer/pepper/pepper_platform_video_capture.cc#newcode32 content/renderer/pepper/pepper_platform_video_capture.cc:32: DCHECK(thread_checker_.CalledOnValidThread()); Isn't thread_checker_ constructed on this thread too? So ...
6 years, 8 months ago (2014-04-25 23:18:58 UTC) #31
Alpha Left Google
https://codereview.chromium.org/242013002/diff/260001/content/renderer/pepper/pepper_platform_video_capture.cc File content/renderer/pepper/pepper_platform_video_capture.cc (right): https://codereview.chromium.org/242013002/diff/260001/content/renderer/pepper/pepper_platform_video_capture.cc#newcode32 content/renderer/pepper/pepper_platform_video_capture.cc:32: DCHECK(thread_checker_.CalledOnValidThread()); On 2014/04/25 23:18:58, bbudge wrote: > Isn't thread_checker_ ...
6 years, 8 months ago (2014-04-25 23:33:22 UTC) #32
bbudge
content/renderer/pepper LGTM https://codereview.chromium.org/242013002/diff/300001/content/renderer/pepper/pepper_platform_video_capture.h File content/renderer/pepper/pepper_platform_video_capture.h (right): https://codereview.chromium.org/242013002/diff/300001/content/renderer/pepper/pepper_platform_video_capture.h#newcode27 content/renderer/pepper/pepper_platform_video_capture.h:27: // same thread. I don't really get ...
6 years, 8 months ago (2014-04-26 00:27:11 UTC) #33
Alpha Left Google
On 2014/04/26 00:27:11, bbudge wrote: > content/renderer/pepper LGTM > > https://codereview.chromium.org/242013002/diff/300001/content/renderer/pepper/pepper_platform_video_capture.h > File content/renderer/pepper/pepper_platform_video_capture.h (right): ...
6 years, 8 months ago (2014-04-26 00:36:50 UTC) #34
Alpha Left Google
> > Since another reviewer requested the comment, could you just say this? > > ...
6 years, 8 months ago (2014-04-26 00:38:56 UTC) #35
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-26 00:39:06 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/320001
6 years, 8 months ago (2014-04-26 00:40:51 UTC) #37
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-26 08:33:09 UTC) #38
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on win_chromium_rel
6 years, 8 months ago (2014-04-26 08:33:09 UTC) #39
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-26 19:04:59 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/320001
6 years, 8 months ago (2014-04-26 19:06:21 UTC) #41
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-27 00:26:27 UTC) #42
commit-bot: I haz the power
Failed to apply patch for media/media.gyp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 8 months ago (2014-04-27 00:26:27 UTC) #43
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-27 08:54:22 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/340001
6 years, 8 months ago (2014-04-27 08:54:49 UTC) #45
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-27 09:32:18 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_chromeos_rel
6 years, 8 months ago (2014-04-27 09:32:19 UTC) #47
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-27 10:07:55 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/340001
6 years, 8 months ago (2014-04-27 10:08:40 UTC) #49
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-27 15:48:29 UTC) #50
Alpha Left Google
The CQ bit was checked by hclam@chromium.org
6 years, 8 months ago (2014-04-27 20:18:38 UTC) #52
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hclam@chromium.org/242013002/340001
6 years, 8 months ago (2014-04-27 20:19:36 UTC) #53
commit-bot: I haz the power
Change committed as 266492
6 years, 7 months ago (2014-04-28 08:56:23 UTC) #54
tonyg
Looks like this is causing flakiness on Mac due to: [8498:13575:0501/170220:FATAL:video_capture_impl.cc(140)] Check failed: removed. Removing ...
6 years, 7 months ago (2014-05-02 14:54:41 UTC) #55
tonyg
6 years, 7 months ago (2014-05-05 23:16:32 UTC) #56
Message was sent while issue was closed.
A revert of this CL has been created in
https://codereview.chromium.org/263323003/ by tonyg@chromium.org.

The reason for reverting is: "FATAL:video_capture_impl.cc(140)] Check failed:
removed. Removing a non-existent client."

BUG=369129.

Powered by Google App Engine
This is Rietveld 408576698