Commit e7a1a0d6 authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

Revert "components/arc: Create mojo struct for media::VideoFrame."

This reverts commit 2a59da47.

We postpone the VD migration at ARC++, so the mojo struct for
media::VideoFrame is not used now.

BUG=b:136716638
TEST=ninja chrome
TEST=./testing/xvfb.py ./out/Debug/components_unittests
     --gtest_filter=VideoAcceleratorStructTraitsTest.*

Change-Id: I9159afa69b42bc5798e18de75591b63302860f19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377262
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarDavid Staessens <dstaessens@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802127}
parent e08ea0eb
......@@ -269,31 +269,4 @@ bool StructTraits<arc::mojom::VideoFrameLayoutDataView,
return true;
}
// static
bool StructTraits<arc::mojom::VideoFrameDataView,
scoped_refptr<media::VideoFrame>>::
Read(arc::mojom::VideoFrameDataView data,
scoped_refptr<media::VideoFrame>* out) {
gfx::Rect visible_rect;
if (data.id() == 0 || !data.ReadVisibleRect(&visible_rect)) {
return false;
}
// We store id at the first 8 byte of the mailbox.
const uint64_t id = data.id();
static_assert(GL_MAILBOX_SIZE_CHROMIUM >= sizeof(id),
"Size of Mailbox is too small to store id.");
gpu::Mailbox mailbox;
memcpy(mailbox.name, &id, sizeof(id));
gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes];
mailbox_holders[0] = gpu::MailboxHolder(mailbox, gpu::SyncToken(), 0);
// We don't store pixel format and coded_size in Mojo struct. Use dummy value.
*out = media::VideoFrame::WrapNativeTextures(
media::PIXEL_FORMAT_I420, mailbox_holders,
media::VideoFrame::ReleaseMailboxCB(), visible_rect.size(), visible_rect,
visible_rect.size(), base::TimeDelta::FromMilliseconds(data.timestamp()));
return true;
}
} // namespace mojo
......@@ -5,17 +5,13 @@
#ifndef COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_
#define COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_
#include <string.h>
#include <memory>
#include "components/arc/mojom/arc_gfx_mojom_traits.h"
#include "components/arc/mojom/video_common.mojom.h"
#include "components/arc/video_accelerator/video_frame_plane.h"
#include "media/base/color_plane_layout.h"
#include "media/base/decode_status.h"
#include "media/base/video_codecs.h"
#include "media/base/video_frame.h"
#include "media/base/video_frame_layout.h"
#include "media/base/video_types.h"
#include "ui/gfx/geometry/size.h"
......@@ -144,46 +140,6 @@ struct EnumTraits<arc::mojom::DecodeStatus, media::DecodeStatus> {
media::DecodeStatus* output);
};
template <>
struct StructTraits<arc::mojom::VideoFrameDataView,
scoped_refptr<media::VideoFrame>> {
static bool IsNull(const scoped_refptr<media::VideoFrame> input) {
return !input;
}
static void SetToNull(scoped_refptr<media::VideoFrame>* output) {
output->reset();
}
static uint64_t id(const scoped_refptr<media::VideoFrame> input) {
DCHECK(input);
DCHECK(!input->mailbox_holder(0).mailbox.IsZero());
// We store id at the first 8 byte of the mailbox.
uint64_t id;
static_assert(GL_MAILBOX_SIZE_CHROMIUM >= sizeof(id),
"Size of Mailbox is too small to store id.");
const int8_t* const name = input->mailbox_holder(0).mailbox.name;
memcpy(&id, name, sizeof(id));
return id;
}
static gfx::Rect visible_rect(const scoped_refptr<media::VideoFrame> input) {
DCHECK(input);
return input->visible_rect();
}
static int64_t timestamp(const scoped_refptr<media::VideoFrame> input) {
DCHECK(input);
return input->timestamp().InMilliseconds();
}
static bool Read(arc::mojom::VideoFrameDataView data,
scoped_refptr<media::VideoFrame>* out);
};
} // namespace mojo
#endif // COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_
......@@ -15,7 +15,6 @@
namespace mojo {
namespace {
constexpr int64_t kTimestamp = 1234;
constexpr int kWidth = 640;
constexpr int kHeight = 480;
constexpr media::VideoPixelFormat kFormat = media::PIXEL_FORMAT_I420;
......@@ -59,41 +58,4 @@ TEST(VideoAcceleratorStructTraitsTest, ConvertNullVideoFrameLayout) {
EXPECT_FALSE(output);
}
TEST(VideoAcceleratorStructTraitsTest, ConvertVideoFrame) {
// We store id in the first 8 bytes of kMailbox.
gpu::Mailbox kMailbox;
kMailbox.name[0] = 0xff;
kMailbox.name[1] = 0xed;
kMailbox.name[2] = 0xfb;
kMailbox.name[3] = 0xea;
kMailbox.name[4] = 0xf9;
kMailbox.name[5] = 0x7e;
kMailbox.name[6] = 0xe5;
kMailbox.name[7] = 0xe3;
gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes];
mailbox_holders[0] = gpu::MailboxHolder(kMailbox, gpu::SyncToken(), 0);
scoped_refptr<media::VideoFrame> input =
media::VideoFrame::WrapNativeTextures(
kFormat, mailbox_holders, media::VideoFrame::ReleaseMailboxCB(),
kCodedSize, gfx::Rect(kCodedSize), kCodedSize,
base::TimeDelta::FromMilliseconds(kTimestamp));
scoped_refptr<media::VideoFrame> output;
mojo::test::SerializeAndDeserialize<arc::mojom::VideoFrame>(&input, &output);
// Verify the fields of input and output frames.
EXPECT_EQ(output->mailbox_holder(0).mailbox, kMailbox);
EXPECT_EQ(output->visible_rect(), input->visible_rect());
EXPECT_EQ(output->timestamp(), input->timestamp());
}
TEST(VideoAcceleratorStructTraitsTest, ConvertNullVideoFrame) {
scoped_refptr<media::VideoFrame> input;
scoped_refptr<media::VideoFrame> output;
mojo::test::SerializeAndDeserialize<arc::mojom::VideoFrame>(&input, &output);
EXPECT_FALSE(output);
}
} // namespace mojo
......@@ -7,8 +7,6 @@
module arc.mojom;
import "components/arc/mojom/gfx.mojom";
[Extensible]
enum VideoCodecProfile {
// The values must match to the values in media::VideoCodecProfile.
......@@ -122,11 +120,3 @@ struct VideoFrameLayout {
uint32 buffer_addr_align;
uint64 modifier;
};
struct VideoFrame {
// Identifier of the buffer. The value of a valid frame should be non-zero.
uint64 id;
Rect visible_rect;
// timestamp in milliseconds.
int64 timestamp;
};
......@@ -8,7 +8,6 @@ public_headers = [
"//media/base/color_plane_layout.h",
"//media/base/decode_status.h",
"//media/base/video_codecs.h",
"//media/base/video_frame.h",
"//media/base/video_types.h",
"//ui/gfx/geometry/size.h",
]
......@@ -34,7 +33,6 @@ type_mappings = [
"arc.mojom.ColorPlaneLayout=media::ColorPlaneLayout",
"arc.mojom.Size=gfx::Size",
"arc.mojom.VideoCodecProfile=media::VideoCodecProfile",
"arc.mojom.VideoFrame=scoped_refptr<media::VideoFrame>[nullable_is_same_type]",
# media::VideoFrameLayout doesn't have default constructor, so we cannot
# convert directly.
......
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