Commit f17d7a0c authored by Vadym Doroshenko's avatar Vadym Doroshenko Committed by Commit Bot

Revert "media: Use BindOnce everywhere in GMBVFP."

This reverts commit f35e389b.

Reason for revert: This CL is suspicious in Android WebKit test failures:

The first failure:
https://ci.chromium.org/buildbot/chromium.webkit/WebKit%20Android%20%28Nexus4%29/75367

Error message:
virtual/media-gpu-accelerated/external/wpt/media-source/mediasource-config-change-mp4-av-framesize.html failed unexpectedly (gpu crashed)

Error log:
https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webkit%2FWebKit_Android__Nexus4_%2F75367%2F%2B%2Frecipes%2Fsteps%2Fwebkit_tests%2F0%2Fstdout

Original change's description:
> media: Use BindOnce everywhere in GMBVFP.
> 
> Changes the use of Bind and Closure to BindOnce and OnceClosure in
> GpuMemoryBufferVideoFramePool.
> 
> It additionally introduces a trampoline in MailboxHoldersReleased so
> that if the callback is called on media_thread it can skip going trough
> the message loop.
> Previous the callback would be bound to the media_thread loop.
> 
> Two DCHECKs have also be added to check thread expectations.
> 
> Change-Id: Ie704f6f6bdc4b7d9b8dd0f5ffec4675cd060d5e2
> Reviewed-on: https://chromium-review.googlesource.com/959382
> Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
> Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
> Reviewed-by: Miguel Casas <mcasas@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#543609}

TBR=dalecurtis@chromium.org,mcasas@chromium.org,dcastagna@chromium.org

Change-Id: I600ddbf046ad44d4d80bf93ea81543e29dd8d46b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/966321Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543667}
parent ac22c9f7
......@@ -699,9 +699,10 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CopyVideoFrameToGpuMemoryBuffers(
++copies;
}
const base::RepeatingClosure barrier = base::BarrierClosure(
copies, base::BindOnce(&PoolImpl::OnCopiesDone, this, video_frame,
frame_resources));
const base::Closure copies_done =
base::Bind(&PoolImpl::OnCopiesDone, this, video_frame, frame_resources);
const base::RepeatingClosure barrier =
base::BarrierClosure(copies, copies_done);
// Map the buffers.
for (size_t i = 0; i < NumGpuMemoryBuffers(output_format_); i++) {
......@@ -839,24 +840,25 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
for (size_t i = 0; i < NumGpuMemoryBuffers(output_format_); i++)
mailbox_holders[i].sync_token = sync_token;
auto release_mailbox_callback = BindToCurrentLoop(
base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources));
VideoPixelFormat frame_format = VideoFormat(output_format_);
// Create the VideoFrame backed by native textures.
gfx::Size visible_size = video_frame->visible_rect().size();
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures(
frame_format, mailbox_holders, VideoFrame::ReleaseMailboxCB(), coded_size,
frame_format, mailbox_holders, release_mailbox_callback, coded_size,
gfx::Rect(visible_size), video_frame->natural_size(),
video_frame->timestamp());
if (!frame) {
frame_resources->MarkUnused(tick_clock_->NowTicks());
MailboxHoldersReleased(frame_resources, gpu::SyncToken());
release_mailbox_callback.Run(gpu::SyncToken());
std::move(frame_copy_requests_.front().frame_ready_cb).Run(video_frame);
frame_copy_requests_.pop_front();
return;
}
frame->SetReleaseMailboxCB(
base::BindOnce(&PoolImpl::MailboxHoldersReleased, this, frame_resources));
frame->set_color_space(video_frame->ColorSpace());
......@@ -911,7 +913,6 @@ GpuMemoryBufferVideoFramePool::PoolImpl::~PoolImpl() {
}
void GpuMemoryBufferVideoFramePool::PoolImpl::Shutdown() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
// Clients don't care about copies once shutdown has started, so abort them.
Abort();
......@@ -940,7 +941,6 @@ GpuMemoryBufferVideoFramePool::PoolImpl::FrameResources*
GpuMemoryBufferVideoFramePool::PoolImpl::GetOrCreateFrameResources(
const gfx::Size& size,
GpuVideoAcceleratorFactories::OutputFormat format) {
DCHECK(media_task_runner_->BelongsToCurrentThread());
auto it = resources_pool_.begin();
while (it != resources_pool_.end()) {
......@@ -1001,6 +1001,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::DeleteFrameResources(
// TODO(dcastagna): As soon as the context lost is dealt with in media,
// make sure that we won't execute this callback (use a weak pointer to
// the old context).
gpu::gles2::GLES2Interface* gles2 = gpu_factories->ContextGL();
if (!gles2)
return;
......@@ -1018,13 +1019,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::DeleteFrameResources(
void GpuMemoryBufferVideoFramePool::PoolImpl::MailboxHoldersReleased(
FrameResources* frame_resources,
const gpu::SyncToken& release_sync_token) {
if (!media_task_runner_->BelongsToCurrentThread()) {
media_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&PoolImpl::MailboxHoldersReleased, this,
frame_resources, release_sync_token));
return;
}
DCHECK(media_task_runner_->BelongsToCurrentThread());
if (in_shutdown_) {
DeleteFrameResources(gpu_factories_, frame_resources);
delete frame_resources;
......
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