New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 657217 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 649275
issue 631783



Sign in to add a comment

Move video encode accelerator IPC calls to GPU IO thread

Project Member Reported by emir...@chromium.org, Oct 19 2016

Issue description

I came across to this issue when adding MediaFoundationVideoEncodeAccelerator for windows, see https://bugs.chromium.org/p/chromium/issues/detail?id=649275#c11 [0]. RunsAudioVideoCall60SecsAndLogsInternalMetricsH264() reported that frame rate input/output was well below 30 fps when using HW encoder. I observed that when opening a new tab or performing complex composite tasks, we started dropping frames. The attached trace on [0] showed that gpu main thread would be busy with a chunk of GpuCommandBufferMsg. Since encoder IPC messages also pass through the main thread, they get blocked. We start dropping captured frames as a result to avoid increasing memory.

VDA solves this issue by using MessageFilter and moving these tasks to IO thread. Early results, shows that this helps stabilize frame rate as well as reduce jitter.


 
Description: Show this description
Blocking: 631783
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/66ea9831c5714e7d25e544f31bce201cdb35c4af

commit 66ea9831c5714e7d25e544f31bce201cdb35c4af
Author: emircan <emircan@chromium.org>
Date: Wed Nov 09 06:51:21 2016

Move video encode accelerator IPC messages to GPU IO thread

This CL moves video encode accelerator IPC messages to GPU IO thread
instead of the main thread. This helps stabilize frame rate as well
as reduce jitter on Windows. Currently, a lot of these calls get huge
delays and results in dropped frames.

In order to do this with respect to each platform,
TryToSetupEncodeOnSeparateThread() is added to VideoEncodeAccelerator
interface. If this method return false, we keep all IPC messages on
main thread like before. It returns false by default.

Note: Initially, I only moved AcceleratedVideoEncoderMsg_Encode call
to IO thread, but then we started waiting for output buffers for a
long time and again stayed below 30 fps. Therefore I moved all three
functions to IO thread and reached ~30 fps, even when switching between
tabs.

BUG= 657217 , 649275
TEST=RunsAudioVideoCall60SecsAndLogsInternalMetricsH264 browser test
on Windows result in stable 30 fps.

Review-Url: https://codereview.chromium.org/2427053002
Cr-Commit-Position: refs/heads/master@{#430882}

[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/ipc/service/gpu_video_encode_accelerator.cc
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/ipc/service/gpu_video_encode_accelerator.h
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/ipc/service/media_gpu_channel.cc
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/media_foundation_video_encode_accelerator_win.cc
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/media_foundation_video_encode_accelerator_win.h
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/gpu/video_encode_accelerator_unittest.cc
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/video/video_encode_accelerator.cc
[modify] https://crrev.com/66ea9831c5714e7d25e544f31bce201cdb35c4af/media/video/video_encode_accelerator.h

Status: Fixed (was: Started)

Sign in to add a comment