Commit a24563fb authored by jrummell's avatar jrummell Committed by Commit bot

media: Use IPC_STRUCT_TRAITS to convert SubsampleEntry for mojo

Rather than use a TypeConvertor, reference the existing
IPC_STRUCT_TRAITS.

BUG=611750
TEST=media_mojo_unittests pass

Review-Url: https://codereview.chromium.org/2388383002
Cr-Commit-Position: refs/heads/master@{#423066}
parent 26d11c7a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "media/base/audio_parameters.h" #include "media/base/audio_parameters.h"
#include "media/base/subsample_entry.h"
#include "media/base/video_capture_types.h" #include "media/base/video_capture_types.h"
#include "media/base/video_types.h" #include "media/base/video_types.h"
...@@ -18,4 +19,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(media::AudioLatency::LatencyType, ...@@ -18,4 +19,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(media::AudioLatency::LatencyType,
IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelFormat, media::PIXEL_FORMAT_MAX) IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelFormat, media::PIXEL_FORMAT_MAX)
IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelStorage, media::PIXEL_STORAGE_MAX) IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelStorage, media::PIXEL_STORAGE_MAX)
IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry)
IPC_STRUCT_TRAITS_MEMBER(clear_bytes)
IPC_STRUCT_TRAITS_MEMBER(cypher_bytes)
IPC_STRUCT_TRAITS_END()
#endif // MEDIA_BASE_IPC_MEDIA_PARAM_TRAITS_MACROS_H_ #endif // MEDIA_BASE_IPC_MEDIA_PARAM_TRAITS_MACROS_H_
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
# new sandbox escapes. # new sandbox escapes.
per-file *_messages*.h=set noparent per-file *_messages*.h=set noparent
per-file *_messages*.h=file://ipc/SECURITY_OWNERS per-file *_messages*.h=file://ipc/SECURITY_OWNERS
per-file *_param_traits*.*=set noparent
per-file *_param_traits*.*=file://ipc/SECURITY_OWNERS
...@@ -34,11 +34,6 @@ IPC_STRUCT_TRAITS_BEGIN(media::VideoDecodeAccelerator::Config) ...@@ -34,11 +34,6 @@ IPC_STRUCT_TRAITS_BEGIN(media::VideoDecodeAccelerator::Config)
IPC_STRUCT_TRAITS_MEMBER(supported_output_formats) IPC_STRUCT_TRAITS_MEMBER(supported_output_formats)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry)
IPC_STRUCT_TRAITS_MEMBER(clear_bytes)
IPC_STRUCT_TRAITS_MEMBER(cypher_bytes)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(media::CreateVideoEncoderParams) IPC_STRUCT_TRAITS_BEGIN(media::CreateVideoEncoderParams)
IPC_STRUCT_TRAITS_MEMBER(input_format) IPC_STRUCT_TRAITS_MEMBER(input_format)
IPC_STRUCT_TRAITS_MEMBER(input_visible_size) IPC_STRUCT_TRAITS_MEMBER(input_visible_size)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "media/base/demuxer_stream.h" #include "media/base/demuxer_stream.h"
#include "media/base/encryption_scheme.h" #include "media/base/encryption_scheme.h"
#include "media/base/media_keys.h" #include "media/base/media_keys.h"
#include "media/base/subsample_entry.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "media/mojo/common/mojo_shared_buffer_video_frame.h" #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
...@@ -393,24 +394,6 @@ TypeConverter<media::EncryptionScheme, media::mojom::EncryptionSchemePtr>:: ...@@ -393,24 +394,6 @@ TypeConverter<media::EncryptionScheme, media::mojom::EncryptionSchemePtr>::
input->pattern.To<media::EncryptionScheme::Pattern>()); input->pattern.To<media::EncryptionScheme::Pattern>());
} }
// static
media::mojom::SubsampleEntryPtr
TypeConverter<media::mojom::SubsampleEntryPtr, media::SubsampleEntry>::Convert(
const media::SubsampleEntry& input) {
media::mojom::SubsampleEntryPtr mojo_subsample_entry(
media::mojom::SubsampleEntry::New());
mojo_subsample_entry->clear_bytes = input.clear_bytes;
mojo_subsample_entry->cypher_bytes = input.cypher_bytes;
return mojo_subsample_entry;
}
// static
media::SubsampleEntry
TypeConverter<media::SubsampleEntry, media::mojom::SubsampleEntryPtr>::Convert(
const media::mojom::SubsampleEntryPtr& input) {
return media::SubsampleEntry(input->clear_bytes, input->cypher_bytes);
}
// static // static
media::mojom::DecryptConfigPtr media::mojom::DecryptConfigPtr
TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig>::Convert( TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig>::Convert(
...@@ -420,7 +403,8 @@ TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig>::Convert( ...@@ -420,7 +403,8 @@ TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig>::Convert(
mojo_decrypt_config->key_id = input.key_id(); mojo_decrypt_config->key_id = input.key_id();
mojo_decrypt_config->iv = input.iv(); mojo_decrypt_config->iv = input.iv();
mojo_decrypt_config->subsamples = mojo_decrypt_config->subsamples =
Array<media::mojom::SubsampleEntryPtr>::From(input.subsamples()); Array<media::SubsampleEntry>::From(input.subsamples());
return mojo_decrypt_config; return mojo_decrypt_config;
} }
......
...@@ -22,7 +22,6 @@ class VideoDecoderConfig; ...@@ -22,7 +22,6 @@ class VideoDecoderConfig;
class VideoFrame; class VideoFrame;
struct CdmConfig; struct CdmConfig;
struct CdmKeyInformation; struct CdmKeyInformation;
struct SubsampleEntry;
} }
// These are specializations of mojo::TypeConverter and have to be in the mojo // These are specializations of mojo::TypeConverter and have to be in the mojo
...@@ -42,17 +41,6 @@ struct TypeConverter<media::EncryptionScheme, ...@@ -42,17 +41,6 @@ struct TypeConverter<media::EncryptionScheme,
const media::mojom::EncryptionSchemePtr& input); const media::mojom::EncryptionSchemePtr& input);
}; };
template <>
struct TypeConverter<media::mojom::SubsampleEntryPtr, media::SubsampleEntry> {
static media::mojom::SubsampleEntryPtr Convert(
const media::SubsampleEntry& input);
};
template <>
struct TypeConverter<media::SubsampleEntry, media::mojom::SubsampleEntryPtr> {
static media::SubsampleEntry Convert(
const media::mojom::SubsampleEntryPtr& input);
};
template <> template <>
struct TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig> { struct TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig> {
static media::mojom::DecryptConfigPtr Convert( static media::mojom::DecryptConfigPtr Convert(
......
...@@ -240,12 +240,9 @@ struct VideoDecoderConfig { ...@@ -240,12 +240,9 @@ struct VideoDecoderConfig {
EncryptionScheme encryption_scheme; EncryptionScheme encryption_scheme;
}; };
// This defines a mojo transport format for media::SubsampleEntry. // Native struct media::SubsampleEntry;
// See media/base/decrypt_config.h for descriptions. [Native]
struct SubsampleEntry { struct SubsampleEntry;
uint32 clear_bytes;
uint32 cypher_bytes;
};
// This defines a mojo transport format for media::DecryptConfig. // This defines a mojo transport format for media::DecryptConfig.
// See media/base/decrypt_config.h for descriptions. // See media/base/decrypt_config.h for descriptions.
......
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
mojom = "//media/mojo/interfaces/media_types.mojom"
public_headers = [ "//media/base/subsample_entry.h" ]
traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
deps = [
"//media",
"//media/base/ipc",
]
type_mappings = [ "media.mojom.SubsampleEntry=media::SubsampleEntry" ]
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
typemaps = [ typemaps = [
"//media/mojo/interfaces/audio_parameters.typemap", "//media/mojo/interfaces/audio_parameters.typemap",
"//media/mojo/interfaces/media_types.typemap",
"//media/mojo/interfaces/pipeline_statistics.typemap", "//media/mojo/interfaces/pipeline_statistics.typemap",
] ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment