Skip to content

Commit

Permalink
Enable MultiPlaneVideoCaptureSharedImages on macOS
Browse files Browse the repository at this point in the history
Avoid an extra copy when texturing out of frames produced by video
capture. Separate this flag from MultiPlaneSoftwareVideoSharedImages,
which is for use with GpuMemoryBufferVideoFramePool.

Bug: 1173132
Change-Id: I31d05c0bd840238721801ca40684b3086fcda21e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3056042
Reviewed-by: Justin Novosad <junov@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#906303}
  • Loading branch information
ccameron-chromium authored and Chromium LUCI CQ committed Jul 28, 2021
1 parent 6eacebb commit d3a41ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
18 changes: 15 additions & 3 deletions media/base/media_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,21 @@ const base::Feature kCdmProcessSiteIsolation{"CdmProcessSiteIsolation",
const base::Feature kMemoryPressureBasedSourceBufferGC{
"MemoryPressureBasedSourceBufferGC", base::FEATURE_DISABLED_BY_DEFAULT};

// Enable binding multiple shared images to a single GpuMemoryBuffer.
const base::Feature kMultiPlaneVideoSharedImages {
"MultiPlaneVideoSharedImages", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable binding multiple shared images to a single GpuMemoryBuffer for
// software decoded video frames created by the GpuMemoryBufferVideoFramePool.
const base::Feature kMultiPlaneSoftwareVideoSharedImages{
"MultiPlaneSoftwareVideoSharedImages", base::FEATURE_DISABLED_BY_DEFAULT};

// Enable binding multiple shared images to a single GpuMemoryBuffer for video
// frames created by video capture.
const base::Feature kMultiPlaneVideoCaptureSharedImages {
"MultiPlaneVideoCaptureSharedImages",
#if defined(OS_MAC)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};

// Approach original pre-REC MSE object URL autorevoking behavior, though await
// actual attempt to use the object URL for attachment to perform revocation.
Expand Down
3 changes: 2 additions & 1 deletion media/base/media_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ MEDIA_EXPORT extern const base::Feature kMediaOptimizer;
MEDIA_EXPORT extern const base::Feature kMediaPowerExperiment;
MEDIA_EXPORT extern const base::Feature kMediaSessionWebRTC;
MEDIA_EXPORT extern const base::Feature kMemoryPressureBasedSourceBufferGC;
MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoSharedImages;
MEDIA_EXPORT extern const base::Feature kMultiPlaneSoftwareVideoSharedImages;
MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoCaptureSharedImages;
MEDIA_EXPORT extern const base::Feature kOverlayFullscreenVideo;
MEDIA_EXPORT extern const base::Feature kPictureInPicture;
MEDIA_EXPORT extern const base::Feature kPlaybackSpeedButton;
Expand Down
2 changes: 1 addition & 1 deletion media/video/gpu_memory_buffer_video_frame_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace media {
namespace {

bool MultiPlaneVideoSharedImagesEnabled() {
return base::FeatureList::IsEnabled(kMultiPlaneVideoSharedImages);
return base::FeatureList::IsEnabled(kMultiPlaneSoftwareVideoSharedImages);
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion media/video/gpu_memory_buffer_video_frame_pool_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ TEST_F(GpuMemoryBufferVideoFramePoolTest, CreateOneHardwareNV12Frame) {

EXPECT_NE(software_frame.get(), frame.get());
EXPECT_EQ(PIXEL_FORMAT_NV12, frame->format());
if (base::FeatureList::IsEnabled(kMultiPlaneVideoSharedImages)) {
if (base::FeatureList::IsEnabled(kMultiPlaneSoftwareVideoSharedImages)) {
EXPECT_EQ(2u, frame->NumTextures());
EXPECT_EQ(2u, sii_->shared_image_count());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ bool VideoCaptureImpl::VideoFrameBufferPreparer::BindVideoFrameOnMediaThread(
}
#endif // defined(OS_WIN)
if (planes.empty()) {
if (base::FeatureList::IsEnabled(media::kMultiPlaneVideoSharedImages)) {
if (base::FeatureList::IsEnabled(
media::kMultiPlaneVideoCaptureSharedImages)) {
planes.push_back(gfx::BufferPlane::Y);
planes.push_back(gfx::BufferPlane::UV);
} else {
Expand Down

0 comments on commit d3a41ed

Please sign in to comment.