New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 611750 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 611224
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

media_types.mojom contains many duplicate structs that are only used in C++. Should use IPC::ParamTraits instead

Project Member Reported by jam@chromium.org, May 13 2016

Issue description

Since this interface is only by C++ code and it's just for sending existing C++ classes, there's no need to duplicate all the media classes/structs in mojom. The existing classes can be sent and their existing IPC::ParamTraits used. See https://www.chromium.org/developers/design-documents/mojo/type-mapping#TOC-Using-Existing-IPC::ParamTraits

See https://codereview.chromium.org/1896883002/ as an example of where we're sending a NativeStruct over mojo.

Assigning to xhwang as initial owner; feel free to redirect. This should be a small amount of work but removes a lot of duplication and type conversions.
 

Comment 1 by xhw...@chromium.org, May 13 2016

Cc: -tommi@chromium.org xhw...@chromium.org
Components: Internals>Media>Mojo
Labels: OS-All
Owner: jrumm...@chromium.org
jrummell: Could you please help work on this? Thanks!
IPC::ParamTraits don't exist[1][2][3] for most of the structs in media_types.mojom. Is the long term goal to use this IPC mechanism, or will we eventually move to defining it completely in mojom and remove the IPC stuff anyway?

[1] chromecast code defines IPC::ParamTraits for AudioDecoderConfig, VideoDecoderConfig, and EncryptionScheme. They could be moved into the media code.
[2] There is also an existing IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry) in the media code.
[3] There are no IPC::ParamTraits for media::DecryptConfig, media::DecoderBuffer, media::AudioBuffer, and media::VideoFrame. media::VideoFrame in particular supports multiple variants, with a mojo variant that uses mojo shared memory, so making a generic IPC::ParamTraits would be tough.

Comment 3 by jam@chromium.org, May 17 2016

Really? I saw that most of the structs/enums in media_types.mojom have IPC::ParamTraits. Some are not in media/, but can move as you say. These should all be used and then we can avoid duplicate structs.

For the last few structs, we could create IPC param traits for existing structs. I'm guessing that'll be less work than typemaps/convertors/duplicate structs?

For VideoFrame, if the mojom is using shared memory then sure we can keep that one in mojom :)
I didn't check the enums. Out of the 9 enums used, 2 have IPC code in media/, and 6 are in chromecast. chromecast/common/media/cma_param_traits.cc has a note[1] that they can't use the definitions in media, not exactly sure why.

I'm trying to determine the benefit of this. The document referenced in the original states "this should only be done if the interface will only be used by C++ and some factors prevent you from moving the definition to a mojom." We already have all the typemaps/convertors/etc. written for the types in media_types.mojom. Is this just to save duplicate code? What is the plan after we deprecate IPC?

[1] https://code.google.com/p/chromium/codesearch#chromium/src/chromecast/common/media/cma_param_traits.cc&q=ChannelLayout%20IPC_ENUM&sq=package:chromium&type=cs&l=26

Comment 5 by xhw...@chromium.org, Sep 28 2016

Mergedinto: 611224
Status: Duplicate (was: Assigned)
For most of our types we don't have IPC::ParamTraits. We used to have some in chromecast code but they were removed since chromecast has switched to use mojo instead of IPC.

With that I think we'll just use StructTraits instead of IPC::ParamTraits, which is tracked by issue 611224.
Cc: maxmorin@chromium.org olka@chromium.org
CC olka & maxmorin FYI

Sign in to add a comment