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

Issue 1637793004: [WIP] Mojo Video Capture thingy (Closed)

Created:
4 years, 11 months ago by mcasas
Modified:
4 years, 10 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, blundell+watchlist_chromium.org, chromium-reviews, darin (slow to review), droger+watchlist_chromium.org, feature-media-reviews_chromium.org, qsr+mojo_chromium.org, sdefresne+watchlist_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[WIP] Mojo Video Capture thingy https://goo.gl/Bsmk4u BUG=584797

Patch Set 1 #

Total comments: 2

Patch Set 2 : heave!! #

Total comments: 2

Patch Set 3 : clean up #

Total comments: 10

Patch Set 4 : rockot@ comments #

Total comments: 19
Unified diffs Side-by-side diffs Delta from patch set Stats (+2373 lines, -9 lines) Patch
M BUILD.gn View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A components/video_capture/BUILD.gn View 1 2 3 1 chunk +54 lines, -0 lines 0 comments Download
A components/video_capture/DEPS View 1 1 chunk +15 lines, -0 lines 0 comments Download
A components/video_capture/OWNERS View 1 chunk +3 lines, -0 lines 0 comments Download
A components/video_capture/mock_stream_client.h View 1 2 1 chunk +43 lines, -0 lines 0 comments Download
A components/video_capture/mock_stream_client.cc View 1 1 chunk +13 lines, -0 lines 0 comments Download
A components/video_capture/mojo_video_frame.h View 1 1 chunk +46 lines, -0 lines 2 comments Download
A components/video_capture/mojo_video_frame.cc View 1 1 chunk +55 lines, -0 lines 4 comments Download
A components/video_capture/public/cpp/BUILD.gn View 1 chunk +23 lines, -0 lines 0 comments Download
A components/video_capture/public/cpp/stream_client_impl.h View 1 2 3 1 chunk +66 lines, -0 lines 3 comments Download
A components/video_capture/public/cpp/stream_client_impl.cc View 1 2 3 1 chunk +111 lines, -0 lines 2 comments Download
A components/video_capture/public/interfaces/BUILD.gn View 1 chunk +16 lines, -0 lines 0 comments Download
A components/video_capture/public/interfaces/video_capture.mojom View 1 2 3 1 chunk +119 lines, -0 lines 0 comments Download
A components/video_capture/run_all_unittests.cc View 1 chunk +21 lines, -0 lines 2 comments Download
A components/video_capture/stream_impl.h View 1 2 1 chunk +100 lines, -0 lines 0 comments Download
A components/video_capture/stream_impl.cc View 1 2 3 1 chunk +129 lines, -0 lines 2 comments Download
A components/video_capture/stream_impl_unittest.cc View 1 2 3 1 chunk +143 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_device_client_impl.h View 1 2 1 chunk +113 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_device_client_impl.cc View 1 2 1 chunk +369 lines, -0 lines 2 comments Download
A components/video_capture/video_capture_device_client_impl_unittest.cc View 1 2 1 chunk +166 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_handler_impl.h View 1 1 chunk +85 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_handler_impl.cc View 1 2 3 1 chunk +195 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_handler_impl_unittest.cc View 1 1 chunk +228 lines, -0 lines 0 comments Download
A components/video_capture/video_capture_unittest.cc View 1 2 1 chunk +233 lines, -0 lines 0 comments Download
M media/base/video_frame.h View 1 3 chunks +14 lines, -9 lines 0 comments Download
M media/base/video_frame.cc View 1 2 1 chunk +12 lines, -0 lines 2 comments Download

Messages

Total messages: 32 (22 generated)
Ken Rockot(use gerrit already)
https://codereview.chromium.org/1637793004/diff/80001/components/video_capture/stream_impl_unittest.cc File components/video_capture/stream_impl_unittest.cc (right): https://codereview.chromium.org/1637793004/diff/80001/components/video_capture/stream_impl_unittest.cc#newcode87 components/video_capture/stream_impl_unittest.cc:87: scoped_ptr<mojo::Binding<mojom::StreamClient>> binding( Binding takes ownership of its end of ...
4 years, 10 months ago (2016-01-28 03:20:36 UTC) #3
Ken Rockot(use gerrit already)
https://codereview.chromium.org/1637793004/diff/280001/components/video_capture/stream_impl_unittest.cc File components/video_capture/stream_impl_unittest.cc (right): https://codereview.chromium.org/1637793004/diff/280001/components/video_capture/stream_impl_unittest.cc#newcode133 components/video_capture/stream_impl_unittest.cc:133: TEST_F(StreamImplTest, StopPingsStopCallback) { In your message to me you ...
4 years, 10 months ago (2016-02-05 04:51:26 UTC) #17
mcasas
https://codereview.chromium.org/1637793004/diff/280001/components/video_capture/stream_impl_unittest.cc File components/video_capture/stream_impl_unittest.cc (right): https://codereview.chromium.org/1637793004/diff/280001/components/video_capture/stream_impl_unittest.cc#newcode139 components/video_capture/stream_impl_unittest.cc:139: stream_impl_->Stop(); Yeah, so the problem is: StartAndExpectStartCallback() does stream_impl_->Start(std::move(le_client)); ...
4 years, 10 months ago (2016-02-05 17:35:18 UTC) #18
mcasas
Ken can you PTAL? thx
4 years, 10 months ago (2016-02-06 01:27:38 UTC) #20
mcasas
adding emircan@ forced volunteer
4 years, 10 months ago (2016-02-06 01:28:18 UTC) #22
Ken Rockot(use gerrit already)
seems like a pretty good start. sorry for the review latency, i'll do a second ...
4 years, 10 months ago (2016-02-09 20:41:19 UTC) #24
mcasas
ptal https://codereview.chromium.org/1637793004/diff/320001/components/video_capture/mojo_video_frame.h File components/video_capture/mojo_video_frame.h (right): https://codereview.chromium.org/1637793004/diff/320001/components/video_capture/mojo_video_frame.h#newcode20 components/video_capture/mojo_video_frame.h:20: // A derived class of media::VideoFrame holding a ...
4 years, 10 months ago (2016-02-11 23:51:33 UTC) #29
Ken Rockot(use gerrit already)
Looking good. I'd say let's get this moved to a proper location (IIUC components/video_capture is ...
4 years, 10 months ago (2016-02-12 21:29:52 UTC) #30
emircan
https://codereview.chromium.org/1637793004/diff/320001/components/video_capture/stream_impl.cc File components/video_capture/stream_impl.cc (right): https://codereview.chromium.org/1637793004/diff/320001/components/video_capture/stream_impl.cc#newcode84 components/video_capture/stream_impl.cc:84: return; Should we stop the capture here, via a ...
4 years, 10 months ago (2016-02-16 17:45:48 UTC) #31
mcasas
4 years, 10 months ago (2016-02-16 23:17:21 UTC) #32
After offline discussions we thought that this
module should rather be somewhere under
content/ so this review is moving to 
https://codereview.chromium.org/1699553002/

(Also note that stream_client_impl.*
is disappearing from this particular CL)

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/mojo_video_frame.cc (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/mojo_video_frame.cc:41: DCHECK_EQ(rv, MOJO_RESULT_OK);
On 2016/02/16 17:45:48, emircan wrote:
> We should ideally fail and notify the consumer if Map somehow fails. What
about
> calling private ctor() and initialize() from
> MojoVideoFrame::CreateMojoVideoFrame() and return nullptr if it fails?

Done.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/mojo_video_frame.cc:50: static_cast<uint8_t*>(memory) +
(dimensions.GetArea() * 5 / 4));
On 2016/02/16 17:45:48, emircan wrote:
> const int num_planes = media::VideoFrame::NumPlanes(format());
> size_t offset = 0;
> for (size_t i = 0; i < num_planes; ++i) {
> set_stride(media::VideoFrame::RowBytes(i, format(), dimensions.width()));
> set_data(i, static_cast<uint8_t*>(memory) + offset);
> offset += media::VideoFrame::PlaneSize(format(), i, dimensions).GetArea()
> }

I don't think is needed since we only support I420.
Added a CHECK just in case.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/mojo_video_frame.h (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/mojo_video_frame.h:32: base::TimeDelta timestamp);
On 2016/02/16 17:45:48, emircan wrote:
> Should this be private since we have the static call above?

Done.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/public/cpp/stream_client_impl.h (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/public/cpp/stream_client_impl.h:43: void
AddOnFrameReceivedCallback(const OnFrameReceivedCallback& callback);
On 2016/02/16 17:45:48, emircan wrote:
> I like this idea generally. However, giving multiple clients VideoFrame data
> pointers might be problematic if they want to write over data. Either we
should
> map these buffers as read-only, or come up with a synchronization mechanism.
> Also run the callback with |const scoped_refptr<media::VideoFrame>|?

After discussing with rockot@, I think I'm removing
the StreamClientImpl, at least from this CL, for a 
number of reasons, the most important being that
in the VC module we don't really need to show-n-tell
how to write a client :) although is a way of leading
by example. We'll get to this in due time I'm sure.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/run_all_unittests.cc (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/run_all_unittests.cc:15:
base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk");
On 2016/02/12 21:29:52, Ken Rockot wrote:
> this flag is no longer needed

Done.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/stream_impl.cc (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/stream_impl.cc:126:
in_use_video_frames_.erase(in_use_video_frames_.find(buffer_id));
On 2016/02/16 17:45:48, emircan wrote:
> const auto it = in_use_video_frames_.find(buffer_id);
> if (it == in_use_video_frames_.end()) {
> ...
> }
> in_use_video_frames_.erase(it);

Done.

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
File components/video_capture/video_capture_device_client_impl.cc (right):

https://codereview.chromium.org/1637793004/diff/380001/components/video_captu...
components/video_capture/video_capture_device_client_impl.cc:347:
base::Bind(&VideoFramePool::FrameReleased, this, frame));
On 2016/02/16 17:45:48, emircan wrote:
> Since these are refptr objects, they can be in use while Shutdown() call takes
> place AFAIU.How should we handle these cases?

When Shutdown() is called, |is_shutdown_| is flipped to
true and FrameReleases() would not return the |frame|
back to the pool (back to |frames_|, so it will be destroyed
and its allocated memory released. Makes sense?

https://codereview.chromium.org/1637793004/diff/380001/media/base/video_frame.cc
File media/base/video_frame.cc (right):

https://codereview.chromium.org/1637793004/diff/380001/media/base/video_frame...
media/base/video_frame.cc:949: DCHECK_GE(stride, 0);
On 2016/02/16 17:45:48, emircan wrote:
> DCHECK_GT?

Done.

Powered by Google App Engine
This is Rietveld 408576698