|
|
Chromium Code Reviews|
Created:
4 years, 10 months ago by jrummell Modified:
4 years, 9 months ago CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-reviews, darin (slow to review), feature-media-reviews_chromium.org, miu+watch_chromium.org, qsr+mojo_chromium.org, sandersd (OOO until July 31), 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. |
DescriptionAdd MojoVideoFrame
Rather than add a few more fields to VideoFrame, refactor it a little
bit to allow MojoVideoFrame. Requires moving several static functions
to the interface so that they can be used by the derived class.
BUG=510088
TEST=new unittest passes
Committed: https://crrev.com/9a995c82fd5c1d186ebd3d0a30d5a78b29dd5e82
Cr-Commit-Position: refs/heads/master@{#379366}
Patch Set 1 #
Total comments: 6
Patch Set 2 : few protected methods #
Total comments: 39
Patch Set 3 : move to media/mojo/common #
Total comments: 28
Patch Set 4 : updates #
Total comments: 22
Patch Set 5 : Changes #
Total comments: 10
Patch Set 6 : rename file #Patch Set 7 : changes #
Total comments: 6
Patch Set 8 : changes + rebase #Patch Set 9 : PlaneOffset #
Messages
Total messages: 43 (12 generated)
jrummell@chromium.org changed reviewers: + dalecurtis@chromium.org, xhwang@chromium.org
PTAL. Code to actually use the MojoVideoFrame coming soon.
dalecurtis@chromium.org changed reviewers: + mcasas@chromium.org
+mcasas who might be working on similar things for capture.
https://codereview.chromium.org/1704273002/diff/1/media/base/video_frame.h File media/base/video_frame.h (right): https://codereview.chromium.org/1704273002/diff/1/media/base/video_frame.h#ne... media/base/video_frame.h:77: STORAGE_LAST = STORAGE_MOJO_SHARED_MEMORY, I do something similar in media/capture/service/mojo_video_frame.h in https://crrev.com/1699553002/ but without having to add the extra storage type at this level, since: - the parent class should not add provisions for derived classes - anyway the Mojo shared memory is a mojo::SharedBuffer which is a ShMem. Then I'm not moving static methiods but turning |data_| and |stride_| into protected, together with one constructor. Makes sense? https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.gn File media/mojo/services/BUILD.gn (right): https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.g... media/mojo/services/BUILD.gn:68: "mojo_video_frame.h", I would add these guys in media/base, WDYT?
Great! jrummell / mcasas: We should coordinate to have one MojoVideoFrame implementation that suits the need of both media/mojo and media/capture. mcasas: In your CL, how is the mojo shared memory released or recycled? In our case the shared memory is allocated in a non-browser process which involves a sync IPC and is pretty expensive. So we want to have a mechanism to recycle it which is critical to our performance. https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.gn File media/mojo/services/BUILD.gn (right): https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.g... media/mojo/services/BUILD.gn:68: "mojo_video_frame.h", On 2016/02/18 04:32:50, mcasas wrote: > I would add these guys in media/base, WDYT? We were debating about exactly this. So far media/base and actually the whole "media" target don't depend on mojo. All mojo related stuff are in media/mojo. The rationale is that the core "media" doesn't know anything about the process model and assume everything is working in one process. "media/mojo" extends "media" to easily support "remote" (out-of-process) components, e.g. remote media Renderer, remote CDM etc. So it makes sense to me that media/mojo depends on mojo, but the core "media" doesn't. This has the benefit that if someone wants to use media/ without using mojo/ (e.g. a browser that needs <video> support but doesn't use a multi-process architecture) it'll be super easy to do so. For another example, someone can use "media" to build a native (non-browser) application that doesn't need "mojo". I think in long term we should make VideoFrame a base class in media/base and clients of media/ can implement client-specific VideoFrame implementations. MojoVideoFrame would be the VideoFrame implementation for media/mojo. If we put MojoVideoFrame here, does it make sense for media/capture to depend on media/mojo?
In the mentioned CL, the mojo::SharedBuffer is created and mapped at MojoVideoFrame ctor time and remains so the whole time. These frames are pooled inside the VideoCaptureDeviceClientImpl so there's no memory bashing. https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.gn File media/mojo/services/BUILD.gn (right): https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.g... media/mojo/services/BUILD.gn:68: "mojo_video_frame.h", On 2016/02/18 06:01:20, xhwang wrote: > On 2016/02/18 04:32:50, mcasas wrote: > > I would add these guys in media/base, WDYT? > > We were debating about exactly this. So far media/base and actually the whole > "media" target don't depend on mojo. All mojo related stuff are in media/mojo. > That might be OK now, but mojo will become more and more pervasive, so it won't be contained in its own folder anyhow, e.g. all GPU-related stuff now in media/video will go into a mojo decode-encode accelerated module. Same with video capture, and expect it for audio capture sooner or later. If you see content/, .mojoms are not isolated but in content/common, content/public. Which reminds me that media/mojo/interfaces should be refactored to media/public/interfaces and what is now in media/mojo/service should go into something more descriptive (again because there will be more than a single service hosted in media/). But that's another topic :) > The rationale is that the core "media" doesn't know anything about the process > model and assume everything is working in one process. "media/mojo" extends > "media" to easily support "remote" (out-of-process) components, e.g. remote > media Renderer, remote CDM etc. So it makes sense to me that media/mojo depends > on mojo, but the core "media" doesn't. Think about mojo as another base/ folder. > > This has the benefit that if someone wants to use media/ without using mojo/ > (e.g. a browser that needs <video> support but doesn't use a multi-process > architecture) it'll be super easy to do so. For another example, someone can > use "media" to build a native (non-browser) application that doesn't need > "mojo". Those are interesting cases, but you know how it goes in Chrome: don't design for what could be but for what is today. > > I think in long term we should make VideoFrame a base class in media/base and > clients of media/ can implement client-specific VideoFrame implementations. > MojoVideoFrame would be the VideoFrame implementation for media/mojo. > > If we put MojoVideoFrame here, does it make sense for media/capture to depend on > media/mojo? I'm afraid I have to insist on a media/base of sorts. What we can do is to have two source_sets in the media/base/BUILD.gn, one with and one without mojo. A separate but interesting piece of information is that media/base includes files from e.g. media/audio, media/cdm and media/ffmpeg #justsaying, so media/base could depend on media/mojo.
On 2016/02/18 18:15:31, mcasas wrote: > In the mentioned CL, the mojo::SharedBuffer > is created and mapped at MojoVideoFrame > ctor time and remains so the whole time. These > frames are pooled inside the > VideoCaptureDeviceClientImpl so there's no > memory bashing. > > https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.gn > File media/mojo/services/BUILD.gn (right): > > https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.g... > media/mojo/services/BUILD.gn:68: "mojo_video_frame.h", > On 2016/02/18 06:01:20, xhwang wrote: > > On 2016/02/18 04:32:50, mcasas wrote: > > > I would add these guys in media/base, WDYT? > > > > We were debating about exactly this. So far media/base and actually the whole > > "media" target don't depend on mojo. All mojo related stuff are in media/mojo. > > > > That might be OK now, but mojo will become more and more > pervasive, so it won't be contained in its own folder anyhow, > e.g. all GPU-related stuff now in media/video will go into a > mojo decode-encode accelerated module. Same with video > capture, and expect it for audio capture sooner or later. > If you see content/, .mojoms are not isolated but in > content/common, content/public. As I mentioned, we were debating :) content/ is special because it contains the multi-process architecture of the browser. It's supposed to know processes so mojo is actually a perfect fit. > Which reminds me that media/mojo/interfaces should be > refactored to media/public/interfaces and what is now in > media/mojo/service should go into something more descriptive > (again because there will be more than a single service hosted > in media/). But that's another topic :) > > The rationale is that the core "media" doesn't know anything about the process > > model and assume everything is working in one process. "media/mojo" extends > > "media" to easily support "remote" (out-of-process) components, e.g. remote > > media Renderer, remote CDM etc. So it makes sense to me that media/mojo > depends > > on mojo, but the core "media" doesn't. > > Think about mojo as another base/ folder. I see mojo is used in more and more places, but it's still only used when multiple processes are involved. I don't think it will be as basic as base/. We can probably sent chromium-mojo@ an email asking about whether it's okay to depend on mojo/ universally. > > This has the benefit that if someone wants to use media/ without using mojo/ > > (e.g. a browser that needs <video> support but doesn't use a multi-process > > architecture) it'll be super easy to do so. For another example, someone can > > use "media" to build a native (non-browser) application that doesn't need > > "mojo". > > Those are interesting cases, but you know how it goes > in Chrome: don't design for what could be but for what is > today. We actually had projects using single-processed chromium as a media player before. So I don't think this is just a conceptual case. > > I think in long term we should make VideoFrame a base class in media/base and > > clients of media/ can implement client-specific VideoFrame implementations. > > MojoVideoFrame would be the VideoFrame implementation for media/mojo. > > > > If we put MojoVideoFrame here, does it make sense for media/capture to depend > on > > media/mojo? > > I'm afraid I have to insist on a media/base of sorts. > > What we can do is to have two source_sets in the > media/base/BUILD.gn, one with and one without mojo. If you do this, it's really just the same as putting mojo media stuff in media/mojo. The folder structure is just how we organize files. What really matters is the gn targets and their dependencies. > A separate but interesting piece of information is that > media/base includes files from e.g. media/audio, media/cdm > and media/ffmpeg #justsaying, so media/base could > depend on media/mojo. Yeah, the current folder structure has a lot of room to improve. Almost everything in media/ belongs to the "media" target. The two exceptions I can think of are "media/blink" and "media/mojo", which have their own targets. I think the discussion should be focusing on the gn targets design instead of the folder structure. Note that media/mojo just contains source_sets and not components. We may want to make it a component in the future.
Updated. mojo_video_frame is now in it's own source_set() to make it easier for others to use. However, it's still in the media/mojo directory, since there doesn't seem to be agreement on where it should go. https://codereview.chromium.org/1704273002/diff/1/media/base/video_frame.h File media/base/video_frame.h (right): https://codereview.chromium.org/1704273002/diff/1/media/base/video_frame.h#ne... media/base/video_frame.h:77: STORAGE_LAST = STORAGE_MOJO_SHARED_MEMORY, On 2016/02/18 04:32:50, mcasas wrote: > I do something similar in > media/capture/service/mojo_video_frame.h > in https://crrev.com/1699553002/ > but without having to add the extra storage > type at this level, since: > - the parent class should not add provisions for > derived classes > - anyway the Mojo shared memory is a > mojo::SharedBuffer which is a ShMem. > > Then I'm not moving static methiods but turning > |data_| and |stride_| into protected, together with > one constructor. Makes sense? > I've added most of the code from the other CL into this one. However: - I still added a new enum, since it would be hard to tell if a VideoFrame is a MojoVideoFrame in order to cast (unless everybody thinks that adding IsXXX() methods to the base class is the way to go). - I still moved some static methods into the private: so that they can be used by the derived class. Most are simply for parameter checking. https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.gn File media/mojo/services/BUILD.gn (right): https://codereview.chromium.org/1704273002/diff/1/media/mojo/services/BUILD.g... media/mojo/services/BUILD.gn:68: "mojo_video_frame.h", On 2016/02/18 18:15:31, mcasas wrote: > On 2016/02/18 06:01:20, xhwang wrote: > > On 2016/02/18 04:32:50, mcasas wrote: > > > I would add these guys in media/base, WDYT? > > > > We were debating about exactly this. So far media/base and actually the whole > > "media" target don't depend on mojo. All mojo related stuff are in media/mojo. > > > > That might be OK now, but mojo will become more and more > pervasive, so it won't be contained in its own folder anyhow, > e.g. all GPU-related stuff now in media/video will go into a > mojo decode-encode accelerated module. Same with video > capture, and expect it for audio capture sooner or later. > If you see content/, .mojoms are not isolated but in > content/common, content/public. > > Which reminds me that media/mojo/interfaces should be > refactored to media/public/interfaces and what is now in > media/mojo/service should go into something more descriptive > (again because there will be more than a single service hosted > in media/). But that's another topic :) > > > The rationale is that the core "media" doesn't know anything about the process > > model and assume everything is working in one process. "media/mojo" extends > > "media" to easily support "remote" (out-of-process) components, e.g. remote > > media Renderer, remote CDM etc. So it makes sense to me that media/mojo > depends > > on mojo, but the core "media" doesn't. > > Think about mojo as another base/ folder. > > > > > This has the benefit that if someone wants to use media/ without using mojo/ > > (e.g. a browser that needs <video> support but doesn't use a multi-process > > architecture) it'll be super easy to do so. For another example, someone can > > use "media" to build a native (non-browser) application that doesn't need > > "mojo". > > Those are interesting cases, but you know how it goes > in Chrome: don't design for what could be but for what is > today. > > > > > I think in long term we should make VideoFrame a base class in media/base and > > clients of media/ can implement client-specific VideoFrame implementations. > > MojoVideoFrame would be the VideoFrame implementation for media/mojo. > > > > If we put MojoVideoFrame here, does it make sense for media/capture to depend > on > > media/mojo? > > I'm afraid I have to insist on a media/base of sorts. > > What we can do is to have two source_sets in the > media/base/BUILD.gn, one with and one without mojo. > > A separate but interesting piece of information is that > media/base includes files from e.g. media/audio, media/cdm > and media/ffmpeg #justsaying, so media/base could > depend on media/mojo. > Without an agreement on what is the "best" thing to do, I've moved the MojoVideoFrame into ":common" so that others don't need to include all the media mojo stuff if they just want to use MojoVideoFrame.
Thanks! Looking good in general. Here are my comments. https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/base/video... File media/base/video_frame.h (right): https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/base/video... media/base/video_frame.h:421: // Clients must use the static factory/wrapping methods to create a new frame. except for derived classes? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/base/video... media/base/video_frame.h:432: static std::string ConfigToString(const VideoPixelFormat format, what does this function do? Add a comment? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/base/video... media/base/video_frame.h:483: // for the U-plane in PIXEL_FORMAT_I420. This is copied from existing code, but it would be nicer to have a more clear definition of "element"... https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/base/video... media/base/video_frame.h:492: Move these to the top of the "private" section? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... File media/mojo/services/BUILD.gn (right): https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/BUILD.gn:60: "//media/mojo/interfaces", Do you need anything from the interfaces? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/BUILD.gn:63: "//ui/mojo/geometry:interfaces", What is this used for? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/BUILD.gn:88: ":common", This is not needed for this CL yet. Add it later? We may also need this dependency in "cdm_service". https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... File media/mojo/services/mojo_video_frame.cc (right): https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.cc:1: // Copyright 2016 The Chromium Authors. All rights reserved. Can we add a unittest for MojoVideoFrame? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.cc:17: const StorageType storage = STORAGE_MOJO_SHARED_MEMORY; s/storage/storage_type/ https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.cc:41: dimensions.GetArea(), dimensions.GetArea() * 5 / 4)) Call MojoVideoFrame::Create() here? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.cc:62: const StorageType storage = STORAGE_MOJO_SHARED_MEMORY; storage_type https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.cc:131: MojoVideoFrame::~MojoVideoFrame() {} Do we need UnmapBuffer() anywhere? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... File media/mojo/services/mojo_video_frame.h (right): https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:6: #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_FRAME_H_ Thinking about the future more... Currently the media/mojo/services folder contains all implementations, including the proxy side (e.g. MojoCdm, MojoRendererImpl), the service side (e.g. MojoCdmService, MojoRendererService) and some common code (e.g. type converters and this new MojoVideoFrame). Maybe we should have separate folders for them in the future. Also, it make more sense to have capture code depend on media/mojo/common than media/mojo/services. Maybe we should do this (put this in media/mojo/common) in this CL? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:26: base::TimeDelta timestamp); Add a comment that the shared memory will be created internally? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:48: mojo::SharedBufferHandle handle() const; Is this only used by the type converter for serialization? If so, maybe we can make the type converter a friend... https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:51: size_t mapped_size() const; ditto https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:68: bool Init(int32_t y_stride, comment about what this does? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:75: void set_offset(size_t plane, size_t offset); will this override the offset set in Init()? https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:81: DISALLOW_IMPLICIT_CONSTRUCTORS(MojoVideoFrame); Why not just DISALLOW_COPY_AND_ASSIGN?
https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... File media/mojo/services/mojo_video_frame.h (right): https://chromiumcodereview.appspot.com/1704273002/diff/20001/media/mojo/servi... media/mojo/services/mojo_video_frame.h:8: #include <stddef.h> What is this used for?
Description was changed from ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=compiles, class not used just yet ========== to ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=new unittest passes ==========
Moved to code to media/mojo/common, added a unittest. PTAL. https://codereview.chromium.org/1704273002/diff/20001/media/base/video_frame.h File media/base/video_frame.h (right): https://codereview.chromium.org/1704273002/diff/20001/media/base/video_frame.... media/base/video_frame.h:421: // Clients must use the static factory/wrapping methods to create a new frame. On 2016/02/23 21:27:36, xhwang wrote: > except for derived classes? Done. https://codereview.chromium.org/1704273002/diff/20001/media/base/video_frame.... media/base/video_frame.h:432: static std::string ConfigToString(const VideoPixelFormat format, On 2016/02/23 21:27:36, xhwang wrote: > what does this function do? Add a comment? Done. https://codereview.chromium.org/1704273002/diff/20001/media/base/video_frame.... media/base/video_frame.h:483: // for the U-plane in PIXEL_FORMAT_I420. On 2016/02/23 21:27:36, xhwang wrote: > This is copied from existing code, but it would be nicer to have a more clear > definition of "element"... Done (I think). https://codereview.chromium.org/1704273002/diff/20001/media/base/video_frame.... media/base/video_frame.h:492: On 2016/02/23 21:27:36, xhwang wrote: > Move these to the top of the "private" section? Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/BUI... File media/mojo/services/BUILD.gn (right): https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/BUI... media/mojo/services/BUILD.gn:60: "//media/mojo/interfaces", On 2016/02/23 21:27:36, xhwang wrote: > Do you need anything from the interfaces? Removed. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/BUI... media/mojo/services/BUILD.gn:63: "//ui/mojo/geometry:interfaces", On 2016/02/23 21:27:36, xhwang wrote: > What is this used for? Removed. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/BUI... media/mojo/services/BUILD.gn:88: ":common", On 2016/02/23 21:27:36, xhwang wrote: > This is not needed for this CL yet. Add it later? > > We may also need this dependency in "cdm_service". I want to make sure the new code compiles. Added to "cdm_service". Will move the converters in a separate CL. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... File media/mojo/services/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.cc:1: // Copyright 2016 The Chromium Authors. All rights reserved. On 2016/02/23 21:27:36, xhwang wrote: > Can we add a unittest for MojoVideoFrame? Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.cc:17: const StorageType storage = STORAGE_MOJO_SHARED_MEMORY; On 2016/02/23 21:27:36, xhwang wrote: > s/storage/storage_type/ Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.cc:41: dimensions.GetArea(), dimensions.GetArea() * 5 / 4)) On 2016/02/23 21:27:36, xhwang wrote: > Call MojoVideoFrame::Create() here? Problem is that the other Create() call duplicates the handle, which we don't want to do. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.cc:62: const StorageType storage = STORAGE_MOJO_SHARED_MEMORY; On 2016/02/23 21:27:36, xhwang wrote: > storage_type Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.cc:131: MojoVideoFrame::~MojoVideoFrame() {} On 2016/02/23 21:27:36, xhwang wrote: > Do we need UnmapBuffer() anywhere? Since it's stored as a ScopedSharedBufferHandle, I would assume that the destructor will do whatever is necessary when it gets destroyed. I don't see anything in buffer.h that implies that Unmap() must be called. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... File media/mojo/services/mojo_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:6: #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_FRAME_H_ On 2016/02/23 21:27:36, xhwang wrote: > Thinking about the future more... > > Currently the media/mojo/services folder contains all implementations, including > the proxy side (e.g. MojoCdm, MojoRendererImpl), the service side (e.g. > MojoCdmService, MojoRendererService) and some common code (e.g. type converters > and this new MojoVideoFrame). Maybe we should have separate folders for them in > the future. > > Also, it make more sense to have capture code depend on media/mojo/common than > media/mojo/services. > > Maybe we should do this (put this in media/mojo/common) in this CL? Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:8: #include <stddef.h> On 2016/02/23 21:28:54, xhwang wrote: > What is this used for? size_t (somebody added this to all media files). Also added stdint.h for int32_t, and a few others for types referenced in this header to be complete. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:26: base::TimeDelta timestamp); On 2016/02/23 21:27:36, xhwang wrote: > Add a comment that the shared memory will be created internally? Already there? ("This will create and own the shared memory.") https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:48: mojo::SharedBufferHandle handle() const; On 2016/02/23 21:27:36, xhwang wrote: > Is this only used by the type converter for serialization? If so, maybe we can > make the type converter a friend... It is used in mcasas@'s CL (https://codereview.chromium.org/1699553002/). https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:68: bool Init(int32_t y_stride, On 2016/02/23 21:27:36, xhwang wrote: > comment about what this does? Done. https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:75: void set_offset(size_t plane, size_t offset); On 2016/02/23 21:27:36, xhwang wrote: > will this override the offset set in Init()? Removed to avoid confusion (since changing the offset should also move the data ptr). https://codereview.chromium.org/1704273002/diff/20001/media/mojo/services/moj... media/mojo/services/mojo_video_frame.h:81: DISALLOW_IMPLICIT_CONSTRUCTORS(MojoVideoFrame); On 2016/02/23 21:27:36, xhwang wrote: > Why not just DISALLOW_COPY_AND_ASSIGN? Done. This is what is in VideoFrame, so I just copied it.
https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.h File media/base/video_frame.h (right): https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.... media/base/video_frame.h:433: static std::string ConfigToString(const VideoPixelFormat format, Since is only used in LOG(DFATAL)s I'd sandwich it in an #if !defined(NDEBUG) #endif (at least the body?) There is a AsHumanReadableString() function that does basically the same, please consolidate both. [1] https://code.google.com/p/chromium/codesearch#chromium/src/media/base/video_f... https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.... media/base/video_frame.h:493: static gfx::Size CommonAlignment(VideoPixelFormat format); Why did you change this file level static functions into class methods? I don't see them being used beyond video_frame.cc https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:9: #include "build/build_config.h" Needed? https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:22: LOG(DFATAL) << __FUNCTION__ << " Invalid config." nit: space before closing |"| https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:31: MojoResult result = nit: const ? https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:63: const StorageType storage_type = STORAGE_MOJO_SHARED_MEMORY; Since |storage_type| is always the same in this file, consider just making it a file level constant e.g const StorageType kMojoStorageType = VideoFrame::STORAGE_MOJO_SHARED_MEMORY; Also, shouldn't it be called STORAGE_MOJO_SHARED_BUFFER? Otherwise it leaks implementation details. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:90: StorageType storage_type, This parameter is not needed since is always the same in this file/class. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:93: const gfx::Size& natural_size, IIRC the only case of |natural_size| being different from |coded_size| is for some situation under V{D,E}A area(s), so we might as well nuke that parameter for the Mojo case. I'd doubt also |visible_rect| is needed ATM. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:115: MojoResult result = mojo::MapBuffer( const. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:9: #include <stdint.h> These 2 are probably not needed. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:51: mojo::SharedBufferHandle handle() const; ScopedSharedBufferHandle::get() signature (and implementation) is const HandleType& get() const { return handle_; } Shouldn't this method return a const& too? https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:31: base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); I think this is not needed now. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:32: mojo::edk::Init(); IIRC rockot@ mentioned that this should happen first thing in the test executable and that's the reason why there's a proliferation of run_all_unittests.cc around. Please investigate (or peg this file to some mojo-enabling run_all_unittests.cc). https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:42: const int kHeight = 48; nit: Smaller is faster, what about a 16x9 size?
Updated (and added a question of my own). https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.h File media/base/video_frame.h (right): https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.... media/base/video_frame.h:433: static std::string ConfigToString(const VideoPixelFormat format, On 2016/02/25 15:12:35, mcasas wrote: > Since is only used in LOG(DFATAL)s I'd sandwich > it in an > #if !defined(NDEBUG) > #endif > (at least the body?) > > There is a AsHumanReadableString() function that > does basically the same, please consolidate both. > > [1] > https://code.google.com/p/chromium/codesearch#chromium/src/media/base/video_f... Combined (AsHumanReadableString() now calls ConfigToString()). https://codereview.chromium.org/1704273002/diff/40001/media/base/video_frame.... media/base/video_frame.h:493: static gfx::Size CommonAlignment(VideoPixelFormat format); On 2016/02/25 15:12:35, mcasas wrote: > Why did you change this file level static functions > into class methods? I don't see them being used > beyond video_frame.cc CommonAlignment() uses SampleSize(), which is now private. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:9: #include "build/build_config.h" On 2016/02/25 15:12:35, mcasas wrote: > Needed? Nope. Removed. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:22: LOG(DFATAL) << __FUNCTION__ << " Invalid config." On 2016/02/25 15:12:35, mcasas wrote: > nit: space before closing |"| Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:31: MojoResult result = On 2016/02/25 15:12:35, mcasas wrote: > nit: const ? Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:63: const StorageType storage_type = STORAGE_MOJO_SHARED_MEMORY; On 2016/02/25 15:12:35, mcasas wrote: > Since |storage_type| is always the same in > this file, consider just making it a file level > constant e.g > const StorageType kMojoStorageType = VideoFrame::STORAGE_MOJO_SHARED_MEMORY; > > Also, shouldn't it be called > STORAGE_MOJO_SHARED_BUFFER? > Otherwise it leaks implementation details. Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:90: StorageType storage_type, On 2016/02/25 15:12:35, mcasas wrote: > This parameter is not needed since is always > the same in this file/class. Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:93: const gfx::Size& natural_size, On 2016/02/25 15:12:35, mcasas wrote: > IIRC the only case of |natural_size| being > different from |coded_size| is for some > situation under V{D,E}A area(s), so we > might as well nuke that parameter for the > Mojo case. I'd doubt also |visible_rect| is > needed ATM. I talked with xhwang@. Apparently both Netflix and Amazon use non-square pixels, so the natural size is different (e.g. http://crbug.com/561391). https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:115: MojoResult result = mojo::MapBuffer( On 2016/02/25 15:12:35, mcasas wrote: > const. Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:9: #include <stdint.h> On 2016/02/25 15:12:35, mcasas wrote: > These 2 are probably not needed. https://codereview.chromium.org/1542013004 went through and added them to all the media files, so I have assumed this is the new convention (stddef for size_t, stdint for [u]intxx_h). https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:51: mojo::SharedBufferHandle handle() const; On 2016/02/25 15:12:35, mcasas wrote: > ScopedSharedBufferHandle::get() signature (and > implementation) is > const HandleType& get() const { return handle_; } > > Shouldn't this method return a const& too? Done. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:31: base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); On 2016/02/25 15:12:35, mcasas wrote: > I think this is not needed now. Removed. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:32: mojo::edk::Init(); On 2016/02/25 15:12:35, mcasas wrote: > IIRC rockot@ mentioned that this should > happen first thing in the test executable > and that's the reason why there's a > proliferation of run_all_unittests.cc around. > Please investigate (or peg this file to some > mojo-enabling run_all_unittests.cc). Actually this uses "//mojo/edk/test:run_all_unittests", so it looks like this is not required at all. Removed. https://codereview.chromium.org/1704273002/diff/40001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:42: const int kHeight = 48; On 2016/02/25 15:12:35, mcasas wrote: > nit: Smaller is faster, what about a 16x9 size? Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:21: const gfx::Size& dimensions, Question: VideoFrame::CreateFrameInternal() rounds up the size based on CommonAlignment(). Should this do the same? Should we simply DCHECK that it is aligned?
jrummell@chromium.org changed reviewers: + sandersd@chromium.org
+sandersd@
Looking pretty good. I just have a few more comments. https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... File media/mojo/common/mojo_video_frame.cc (right): https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.cc:25: if (!IsValidConfig(format, kMojoStorageType, dimensions, visible_rect, Can you s/kMojoStorageType/STORAGE_MOJO_SHARED_BUFFER so that we don't need the extra const variable kMojoStorageType? https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.cc:47: dimensions.GetArea(), dimensions.GetArea() * 5 / 4)) Do we handle odd width/height well here? If so, add a comment why width / 2 is sufficient/good? Do we have a unit test to cover it? https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.cc:120: reinterpret_cast<void**>(&frame_data), MOJO_MAP_BUFFER_FLAG_NONE); Could you please double check with mojo team what's the requirement for calling unmap, and add a comment here? https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... File media/mojo/common/mojo_video_frame.h (right): https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:24: class MEDIA_EXPORT MojoVideoFrame : public VideoFrame { This should probably be MojoSharedBufferVideoFrame to be more accurate. We'll need to transport other types of VideoFrame (e.g. texture based) over mojo. https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:28: // == visible_rect(). What's the expectation on offset and strides? https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:30: base::TimeDelta timestamp); nit: This seems to be a special case of the next Create() method. Can we make the naming more specific, e.g. CreateDefaultI420()? https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:33: // a duplicate of |handle|, so the caller can continue to use it. What's the use case that the caller still needs to access the buffer after the Create() call? Is that for recycling the buffers? If so, does capture need something similar? Actualy, it seems after VideoFrameImpl::TransformToVideoFrame() the caller won't have access to the underlying buffer: https://code.google.com/p/chromium/codesearch#chromium/src/media/cdm/cdm_help... The handle duplication should probably happen when the allocator allocates the buffer. If this is true, we probably don't need to duplicate the handle, and can simply pass the handle in Create(). If so, then in the Create() on line 29, we can simply call this Create() on line 34. https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:51: const mojo::SharedBufferHandle& handle() const; You mentioned that these are used in mcasas@'s CL (https://codereview.chromium.org/1699553002/). IIUIC, that's used for client_->FrameAvailable() to transport the video frame info over mojo. I think we should have only one way to transport VideoFrame via mojo, i.e. using the TypeConverters. We should not invent another mojo video FrameInfo that looks exactly like VideoFrame to transport VideoFrame via mojo. So my original comment still apply. We probably should make TypeConverter a friend so we don't need these methods at all. Here's an example for the audio buffer: https://code.google.com/p/chromium/codesearch#chromium/src/media/base/audio_b... https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame_unittest.cc:1: // Copyright 2014 The Chromium Authors. All rights reserved. 2016 https://chromiumcodereview.appspot.com/1704273002/diff/60001/media/mojo/commo... media/mojo/common/mojo_video_frame_unittest.cc:25: // Create a MojoVideoFrame which will allocate enough space to hold a 64x48 Why 64x48?
sandersd@chromium.org changed reviewers: - sandersd@chromium.org
Updated. PS#5 is the changes, PS#6 renames the file for MojoSharedBufferVideoFrame. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:21: const gfx::Size& dimensions, On 2016/02/25 21:51:48, jrummell wrote: > Question: VideoFrame::CreateFrameInternal() rounds up the size based on > CommonAlignment(). Should this do the same? Should we simply DCHECK that it is > aligned? Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:25: if (!IsValidConfig(format, kMojoStorageType, dimensions, visible_rect, On 2016/02/29 18:28:05, xhwang wrote: > Can you s/kMojoStorageType/STORAGE_MOJO_SHARED_BUFFER so that we don't need the > extra const variable kMojoStorageType? Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:47: dimensions.GetArea(), dimensions.GetArea() * 5 / 4)) On 2016/02/29 18:28:05, xhwang wrote: > Do we handle odd width/height well here? If so, add a comment why width / 2 is > sufficient/good? > > Do we have a unit test to cover it? Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:120: reinterpret_cast<void**>(&frame_data), MOJO_MAP_BUFFER_FLAG_NONE); On 2016/02/29 18:28:05, xhwang wrote: > Could you please double check with mojo team what's the requirement for calling > unmap, and add a comment here? Unmap is required. Added. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:24: class MEDIA_EXPORT MojoVideoFrame : public VideoFrame { On 2016/02/29 18:28:05, xhwang wrote: > This should probably be MojoSharedBufferVideoFrame to be more accurate. We'll > need to transport other types of VideoFrame (e.g. texture based) over mojo. Done. I'll rename the file later (so the diffs still show up for now). https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:28: // == visible_rect(). On 2016/02/29 18:28:05, xhwang wrote: > What's the expectation on offset and strides? Updated comment. Most of the Create() calls in VideoFrame don't mention specifics, but assume that everything relevant is initialized. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:30: base::TimeDelta timestamp); On 2016/02/29 18:28:05, xhwang wrote: > nit: This seems to be a special case of the next Create() method. Can we make > the naming more specific, e.g. CreateDefaultI420()? Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:33: // a duplicate of |handle|, so the caller can continue to use it. On 2016/02/29 18:28:05, xhwang wrote: > What's the use case that the caller still needs to access the buffer after the > Create() call? Is that for recycling the buffers? If so, does capture need > something similar? > > Actualy, it seems after VideoFrameImpl::TransformToVideoFrame() the caller won't > have access to the underlying buffer: > > https://code.google.com/p/chromium/codesearch#chromium/src/media/cdm/cdm_help... > > The handle duplication should probably happen when the allocator allocates the > buffer. > > If this is true, we probably don't need to duplicate the handle, and can simply > pass the handle in Create(). If so, then in the Create() on line 29, we can > simply call this Create() on line 34. Discussion offline. This method will now take over |handle|. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:51: const mojo::SharedBufferHandle& handle() const; On 2016/02/29 18:28:05, xhwang wrote: > You mentioned that these are used in mcasas@'s CL > (https://codereview.chromium.org/1699553002/). > > IIUIC, that's used for client_->FrameAvailable() to transport the video frame > info over mojo. > > I think we should have only one way to transport VideoFrame via mojo, i.e. using > the TypeConverters. We should not invent another mojo video FrameInfo that looks > exactly like VideoFrame to transport VideoFrame via mojo. > > So my original comment still apply. We probably should make TypeConverter a > friend so we don't need these methods at all. Here's an example for the audio > buffer: > > https://code.google.com/p/chromium/codesearch#chromium/src/media/base/audio_b... Removed them for now. In the TypeConverters CL, I'll add them back along with friend. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:1: // Copyright 2014 The Chromium Authors. All rights reserved. On 2016/02/29 18:28:05, xhwang wrote: > 2016 Done. https://codereview.chromium.org/1704273002/diff/60001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:25: // Create a MojoVideoFrame which will allocate enough space to hold a 64x48 On 2016/02/29 18:28:05, xhwang wrote: > Why 64x48? This was in the VideoFrame test. I actually made it smaller (16x9), so updated comment.
Sorry I saw your message then I forgot about it.. looking pretty good now. Just a few nits. https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... File media/mojo/common/mojo_video_frame.cc (right): https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... media/mojo/common/mojo_video_frame.cc:124: set_data(kYPlane, reinterpret_cast<uint8_t*>(buffer_data_) + y_offset); Can we declare |buffer_data_| as uint8_t* then we don't need this cast. https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... File media/mojo/common/mojo_video_frame.h (right): https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... media/mojo/common/mojo_video_frame.h:77: void* buffer_data_; nit: shared_buffer_data_ to be consistent with other members? https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... media/mojo/common/mojo_video_frame_unittest.cc:51: TEST(MojoSharedBufferVideoFrameTest, CreateFrameAndReuseSharedMemory) { Is "reuse" still relevant? https://chromiumcodereview.appspot.com/1704273002/diff/80001/media/mojo/commo... media/mojo/common/mojo_video_frame_unittest.cc:101: Do we support odd width? If so can we have a test for it?
Updated. https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:124: set_data(kYPlane, reinterpret_cast<uint8_t*>(buffer_data_) + y_offset); On 2016/03/04 00:55:34, xhwang wrote: > Can we declare |buffer_data_| as uint8_t* then we don't need this cast. MapBuffer() and UnmapBuffer() want void*, so have to do casts somewhere. Prefer to leave it as the "creator" expects. https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.h:77: void* buffer_data_; On 2016/03/04 00:55:34, xhwang wrote: > nit: shared_buffer_data_ to be consistent with other members? Done. https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame_unittest.cc (right): https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:51: TEST(MojoSharedBufferVideoFrameTest, CreateFrameAndReuseSharedMemory) { On 2016/03/04 00:55:34, xhwang wrote: > Is "reuse" still relevant? Not really. Changed to "Pass". https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame_unittest.cc:101: On 2016/03/04 00:55:34, xhwang wrote: > Do we support odd width? If so can we have a test for it? Done.
LGTM with nits https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:124: set_data(kYPlane, reinterpret_cast<uint8_t*>(buffer_data_) + y_offset); On 2016/03/04 02:19:06, jrummell wrote: > On 2016/03/04 00:55:34, xhwang wrote: > > Can we declare |buffer_data_| as uint8_t* then we don't need this cast. > > MapBuffer() and UnmapBuffer() want void*, so have to do casts somewhere. Prefer > to leave it as the "creator" expects. Non-void pointers can be converted to void* implicitly (without cast). So if you use uint8_t* you shouldn't need casts anywhere. https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.cc:32: const size_t requested_size = VideoFrame::AllocationSize(format, coded_size); nit: s/requested_size/allocation_size
Updated (and rebased to get the media/mojo/common/BUILD.gn changes). https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... File media/mojo/common/mojo_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/80001/media/mojo/common/mojo_... media/mojo/common/mojo_video_frame.cc:124: set_data(kYPlane, reinterpret_cast<uint8_t*>(buffer_data_) + y_offset); On 2016/03/04 04:32:27, xhwang wrote: > On 2016/03/04 02:19:06, jrummell wrote: > > On 2016/03/04 00:55:34, xhwang wrote: > > > Can we declare |buffer_data_| as uint8_t* then we don't need this cast. > > > > MapBuffer() and UnmapBuffer() want void*, so have to do casts somewhere. > Prefer > > to leave it as the "creator" expects. > > Non-void pointers can be converted to void* implicitly (without cast). So if you > use uint8_t* you shouldn't need casts anywhere. MapBuffer takes void**, so it still needs a cast. Done. https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.cc:32: const size_t requested_size = VideoFrame::AllocationSize(format, coded_size); On 2016/03/04 04:32:27, xhwang wrote: > nit: s/requested_size/allocation_size Done.
lgtm https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.cc:132: const MojoResult result = mojo::UnmapBuffer(shared_buffer_data_); Should this be called even when MapBuffer fails? https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.h:54: size_t plane_offset(size_t plane) const; Shouldn't be hacker_style() since it's not inline.
LGTM if the other reviewers are happy.
Thanks for the reviews. https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.cc (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.cc:132: const MojoResult result = mojo::UnmapBuffer(shared_buffer_data_); On 2016/03/04 19:16:57, DaleCurtis wrote: > Should this be called even when MapBuffer fails? Good catch. Fixed. https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... File media/mojo/common/mojo_shared_buffer_video_frame.h (right): https://codereview.chromium.org/1704273002/diff/120001/media/mojo/common/mojo... media/mojo/common/mojo_shared_buffer_video_frame.h:54: size_t plane_offset(size_t plane) const; On 2016/03/04 19:16:57, DaleCurtis wrote: > Shouldn't be hacker_style() since it's not inline. I was just following the (old?) convention used in VideoFrame. Fixed.
The CQ bit was checked by jrummell@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from xhwang@chromium.org, mcasas@chromium.org, dalecurtis@chromium.org Link to the patchset: https://codereview.chromium.org/1704273002/#ps160001 (title: "PlaneOffset")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1704273002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1704273002/160001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by jrummell@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1704273002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1704273002/160001
Message was sent while issue was closed.
Description was changed from ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=new unittest passes ========== to ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=new unittest passes ==========
Message was sent while issue was closed.
Committed patchset #9 (id:160001)
Message was sent while issue was closed.
Description was changed from ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=new unittest passes ========== to ========== Add MojoVideoFrame Rather than add a few more fields to VideoFrame, refactor it a little bit to allow MojoVideoFrame. Requires moving several static functions to the interface so that they can be used by the derived class. BUG=510088 TEST=new unittest passes Committed: https://crrev.com/9a995c82fd5c1d186ebd3d0a30d5a78b29dd5e82 Cr-Commit-Position: refs/heads/master@{#379366} ==========
Message was sent while issue was closed.
Patchset 9 (id:??) landed as https://crrev.com/9a995c82fd5c1d186ebd3d0a30d5a78b29dd5e82 Cr-Commit-Position: refs/heads/master@{#379366}
Message was sent while issue was closed.
thakis@chromium.org changed reviewers: + thakis@chromium.org
Message was sent while issue was closed.
This breaks component builds with gn on Windows, see e.g. https://build.chromium.org/p/chromium.fyi/builders/CrWinClang64%28dbg%29/buil... FAILED: ninja -t msvc -e environment.x64 -- E:\b\build\goma/gomacc.exe ../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC @obj/media/mojo/common/common/mojo_shared_buffer_video_frame.obj.rsp /c ../../media/mojo/common/mojo_shared_buffer_video_frame.cc /Foobj/media/mojo/common/common/mojo_shared_buffer_video_frame.obj /Fdobj/media/mojo/common/common_cc.pdb ../../media/mojo/common/mojo_shared_buffer_video_frame.cc(15,29) : error: 'media::MojoSharedBufferVideoFrame::CreateDefaultI420' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Werror,-Winconsistent-dllimport] MojoSharedBufferVideoFrame::CreateDefaultI420(const gfx::Size& dimensions, ^ ../..\media/mojo/common/mojo_shared_buffer_video_frame.h(31,52) : note: previous declaration is here static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( ^ ../..\media/mojo/common/mojo_shared_buffer_video_frame.h(24,7) : note: previous attribute is here class MEDIA_EXPORT MojoSharedBufferVideoFrame : public VideoFrame { ^ ../..\media/base/media_export.h(17,33) : note: expanded from macro 'MEDIA_EXPORT' #define MEDIA_EXPORT __declspec(dllimport) ^ et
Message was sent while issue was closed.
c. please take a look, and if fixing is tricky consider reverting until you have a fix
Message was sent while issue was closed.
On 2016/03/05 00:40:09, Nico wrote: > c. please take a look, and if fixing is tricky consider reverting until you have > a fix Dropping MEDIA_EXPORT and include should fix it. We'll fix it now.
Message was sent while issue was closed.
https://codereview.chromium.org/1764063003/ On Fri, Mar 4, 2016 at 4:50 PM, <xhwang@chromium.org> wrote: > On 2016/03/05 00:40:09, Nico wrote: > > c. please take a look, and if fixing is tricky consider reverting until > you > have > > a fix > > Dropping MEDIA_EXPORT and include should fix it. We'll fix it now. > > https://codereview.chromium.org/1704273002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
