Commit 093dbe35 authored by jfroy's avatar jfroy Committed by Commit bot

Define a new media_cast target which provides the minimal functionality

required by media/cast.

The full media target cannot be easily built for some platform (namely
iOS aarch64), typically because of assembly code. The new target has no
such issues.

The change also includes modifications to the media/cast build file to
simplify the dependency list and enable builds using the media_cast
component via a build variable.

BUG=415335

Review URL: https://codereview.chromium.org/581803003

Cr-Commit-Position: refs/heads/master@{#296101}
parent 6ae8c50c
...@@ -444,6 +444,24 @@ component("media") { ...@@ -444,6 +444,24 @@ component("media") {
] ]
} }
# Minimal media component for media/cast on iOS.
if (is_ios) {
component("media_for_cast_ios") {
configs += [ ":media_config" ]
all_dependent_configs = [ ":media_dependent_config" ]
include_dirs = [ "." ]
libs = [ "CoreVideo.framework" ]
deps = [
":shared_memory_support",
"//base",
"//media/base:base_for_cast_ios",
"//media/base/mac",
"//ui/gfx/geometry",
]
}
}
test("media_unittests") { test("media_unittests") {
sources = [ sources = [
"cdm/aes_decryptor_unittest.cc", "cdm/aes_decryptor_unittest.cc",
......
...@@ -225,6 +225,20 @@ source_set("base") { ...@@ -225,6 +225,20 @@ source_set("base") {
} }
} }
# Minimal media component for media/cast on iOS.
config("base_for_cast_ios_dependent_config") {
defines = [ "MEDIA_FOR_CAST_IOS" ]
}
source_set("base_for_cast_ios") {
sources = [
"video_frame.cc",
"video_frame.h",
]
configs += [ "//media:media_config" ]
all_dependent_configs = [ ":base_for_cast_ios_dependent_config" ]
}
source_set("test_support") { source_set("test_support") {
testonly = true testonly = true
sources = [ sources = [
......
...@@ -14,7 +14,10 @@ ...@@ -14,7 +14,10 @@
#include "gpu/command_buffer/common/mailbox_holder.h" #include "gpu/command_buffer/common/mailbox_holder.h"
#include "media/base/limits.h" #include "media/base/limits.h"
#include "media/base/video_util.h" #include "media/base/video_util.h"
#if !defined(MEDIA_FOR_CAST_IOS)
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#endif
namespace media { namespace media {
...@@ -181,11 +184,13 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( ...@@ -181,11 +184,13 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
return frame; return frame;
} }
#if !defined(MEDIA_FOR_CAST_IOS)
void VideoFrame::ReadPixelsFromNativeTexture(const SkBitmap& pixels) { void VideoFrame::ReadPixelsFromNativeTexture(const SkBitmap& pixels) {
DCHECK_EQ(format_, NATIVE_TEXTURE); DCHECK_EQ(format_, NATIVE_TEXTURE);
if (!read_pixels_cb_.is_null()) if (!read_pixels_cb_.is_null())
read_pixels_cb_.Run(pixels); read_pixels_cb_.Run(pixels);
} }
#endif
// static // static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory( scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory(
......
...@@ -108,10 +108,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { ...@@ -108,10 +108,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
base::TimeDelta timestamp, base::TimeDelta timestamp,
const ReadPixelsCB& read_pixels_cb); const ReadPixelsCB& read_pixels_cb);
#if !defined(MEDIA_FOR_CAST_IOS)
// Read pixels from the native texture backing |*this| and write // Read pixels from the native texture backing |*this| and write
// them to |pixels| as BGRA. |pixels| must point to a buffer at // them to |pixels| as BGRA. |pixels| must point to a buffer at
// least as large as 4 * visible_rect().size().GetArea(). // least as large as 4 * visible_rect().size().GetArea().
void ReadPixelsFromNativeTexture(const SkBitmap& pixels); void ReadPixelsFromNativeTexture(const SkBitmap& pixels);
#endif
// Wraps packed image data residing in a memory buffer with a VideoFrame. // Wraps packed image data residing in a memory buffer with a VideoFrame.
// The image data resides in |data| and is assumed to be packed tightly in a // The image data resides in |data| and is assumed to be packed tightly in a
......
...@@ -138,6 +138,24 @@ source_set("sender") { ...@@ -138,6 +138,24 @@ source_set("sender") {
"//third_party/libvpx", "//third_party/libvpx",
"//third_party/opus", "//third_party/opus",
] ]
# use a restricted subset of media and no software codecs on iOS
if (is_ios) {
deps += [ "//media:media_for_cast_ios" ]
deps -= [
"//media",
"//third_party/libvpx",
"//third_party/opus",
]
sources -= [
"sender/external_video_encoder.h",
"sender/external_video_encoder.cc",
"sender/video_encoder_impl.h",
"sender/video_encoder_impl.cc",
"sender/vp8_encoder.cc",
"sender/vp8_encoder.h",
]
}
} }
source_set("receiver") { source_set("receiver") {
...@@ -158,10 +176,20 @@ source_set("receiver") { ...@@ -158,10 +176,20 @@ source_set("receiver") {
":net", ":net",
"//media", "//media",
"//media:shared_memory_support", "//media:shared_memory_support",
"//third_party/opus",
"//third_party/libvpx", "//third_party/libvpx",
"//third_party/opus",
"//ui/gfx", "//ui/gfx",
] ]
# use a restricted subset of media and no software codecs on iOS
if (is_ios) {
deps += [ "//media:media_for_cast_ios" ]
deps -= [
"//media",
"//third_party/libvpx",
"//third_party/opus",
]
}
} }
source_set("test_support") { source_set("test_support") {
......
...@@ -120,6 +120,17 @@ ...@@ -120,6 +120,17 @@
'net/rtp/rtp_receiver_defines.cc', 'net/rtp/rtp_receiver_defines.cc',
'net/rtp/rtp_receiver_defines.h', 'net/rtp/rtp_receiver_defines.h',
], # source ], # source
'conditions': [
# use a restricted subset of media and no software codecs on iOS
['OS=="ios"', {
'dependencies': [ '<(DEPTH)/media/media.gyp:media_for_cast_ios' ],
'dependencies!': [
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/third_party/opus/opus.gyp:opus',
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
}], # OS=="ios"
], # conditions
}, },
{ {
# GN version: //media/cast:sender # GN version: //media/cast:sender
...@@ -150,7 +161,7 @@ ...@@ -150,7 +161,7 @@
'sender/external_video_encoder.cc', 'sender/external_video_encoder.cc',
'sender/fake_software_video_encoder.h', 'sender/fake_software_video_encoder.h',
'sender/fake_software_video_encoder.cc', 'sender/fake_software_video_encoder.cc',
'sender/frame_sender.cc', 'sender/frame_sender.cc',
'sender/frame_sender.h', 'sender/frame_sender.h',
'sender/software_video_encoder.h', 'sender/software_video_encoder.h',
'sender/video_encoder.h', 'sender/video_encoder.h',
...@@ -161,6 +172,25 @@ ...@@ -161,6 +172,25 @@
'sender/vp8_encoder.cc', 'sender/vp8_encoder.cc',
'sender/vp8_encoder.h', 'sender/vp8_encoder.h',
], # source ], # source
'conditions': [
# use a restricted subset of media and no software codecs on iOS
['OS=="ios"', {
'dependencies': [ '<(DEPTH)/media/media.gyp:media_for_cast_ios' ],
'dependencies!': [
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/third_party/opus/opus.gyp:opus',
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
'sources!': [
'sender/external_video_encoder.h',
'sender/external_video_encoder.cc',
'sender/video_encoder_impl.h',
'sender/video_encoder_impl.cc',
'sender/vp8_encoder.cc',
'sender/vp8_encoder.h',
],
}], # OS=="ios"
], # conditions
}, },
{ {
# GN version: //media/cast:net # GN version: //media/cast:net
......
...@@ -1885,5 +1885,66 @@ ...@@ -1885,5 +1885,66 @@
}, },
], ],
}], }],
['OS=="ios"', {
'targets': [
{
# Minimal media component for media/cast on iOS.
# GN version: //media:media_for_cast_ios
'target_name': 'media_for_cast_ios',
'type': '<(component)',
'dependencies': [
'../base/base.gyp:base',
'../ui/gfx/gfx.gyp:gfx_geometry',
'shared_memory_support',
],
'defines': [
'MEDIA_IMPLEMENTATION',
'MEDIA_FOR_CAST_IOS',
],
'direct_dependent_settings': {
'include_dirs': [
'..',
],
},
'include_dirs': [
'..',
],
'sources': [
'base/mac/coremedia_glue.h',
'base/mac/coremedia_glue.mm',
'base/mac/corevideo_glue.h',
'base/mac/videotoolbox_glue.h',
'base/mac/videotoolbox_glue.mm',
'base/video_frame.cc',
'base/video_frame.h',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',
],
},
'conditions': [
['arm_neon==1', {
'defines': [
'USE_NEON'
],
}],
], # conditions
'target_conditions': [
['OS == "ios" and _toolset != "host"', {
'sources/': [
# Pull in specific Mac files for iOS (which have been filtered
# out by file name rules).
['include', '^base/mac/coremedia_glue\\.h$'],
['include', '^base/mac/coremedia_glue\\.mm$'],
['include', '^base/mac/corevideo_glue\\.h$'],
['include', '^base/mac/videotoolbox_glue\\.h$'],
['include', '^base/mac/videotoolbox_glue\\.mm$'],
],
}],
], # target_conditions
},
],
}],
], ],
} }
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