Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Issue 1816203003: Add an additional VDA::Flush() mode to return all allocated buffers. (Closed)

Created:
4 years, 9 months ago by Pawel Osciak
Modified:
4 years, 7 months ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, posciak+watch_chromium.org, jam, mcasas+watch_chromium.org, sievers+watch_chromium.org, jbauman+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, kalyank, mkwst+moarreviews-renderer_chromium.org, piman+watch_chromium.org, danakj+watch_chromium.org, sandersd (OOO until July 31)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add an additional VDA::Flush() mode to return all allocated buffers. Currently, VDA::Flush() only returns to the Client PictureBuffers that contain decoded frames, keeping any remaining PictureBuffers for later use. Add a VDA::Config option to allow the Client to request a second VDA::Flush() mode, in which the VDA returns all allocated PictureBuffers to the Client once the Flush is done. Also, add support for it in V4L2SVDA. BUG=b/27780242 TEST=vdatest,crosvideo.appspot

Patch Set 1 #

Total comments: 4

Patch Set 2 : #

Total comments: 3

Messages

Total messages: 11 (3 generated)
Pawel Osciak
ptal
4 years, 9 months ago (2016-03-22 08:02:57 UTC) #2
kcwu
lgtm; nits https://codereview.chromium.org/1816203003/diff/1/content/common/gpu/media/fake_video_decode_accelerator.cc File content/common/gpu/media/fake_video_decode_accelerator.cc (right): https://codereview.chromium.org/1816203003/diff/1/content/common/gpu/media/fake_video_decode_accelerator.cc#newcode142 content/common/gpu/media/fake_video_decode_accelerator.cc:142: void FakeVideoDecodeAccelerator::Flush(bool return_buffers) { how about adding ...
4 years, 9 months ago (2016-03-22 09:47:42 UTC) #3
Owen Lin
lgtm. However, I thought you'll choose to put this option in config, where the VDA ...
4 years, 9 months ago (2016-03-23 02:01:57 UTC) #4
Pawel Osciak
ptal
4 years, 8 months ago (2016-04-13 07:13:26 UTC) #6
Owen Lin
https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/video_decode_accelerator.h File media/video/video_decode_accelerator.h (right): https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/video_decode_accelerator.h#newcode126 media/video/video_decode_accelerator.h:126: // PictureReady() before posting NotifyFlushDone(), including buffers not Actually, ...
4 years, 8 months ago (2016-04-13 09:21:39 UTC) #7
Pawel Osciak
https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/video_decode_accelerator.h File media/video/video_decode_accelerator.h (right): https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/video_decode_accelerator.h#newcode126 media/video/video_decode_accelerator.h:126: // PictureReady() before posting NotifyFlushDone(), including buffers not On ...
4 years, 8 months ago (2016-04-14 02:14:01 UTC) #8
Pawel Osciak
sandersd@chromium.org: Please review changes in media/. Thanks!
4 years, 8 months ago (2016-04-14 02:17:27 UTC) #10
Owen Lin
4 years, 8 months ago (2016-04-14 02:57:17 UTC) #11
https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/vide...
File media/video/video_decode_accelerator.h (right):

https://chromiumcodereview.appspot.com/1816203003/diff/20001/media/video/vide...
media/video/video_decode_accelerator.h:126: // PictureReady() before posting
NotifyFlushDone(), including buffers not
On 2016/04/14 02:14:01, Pawel Osciak wrote:
> On 2016/04/13 09:21:39, Owen Lin wrote:
> > Actually, the whole VideoDecodeAccelerator runs in one thread. I mean the
> > methods of VDA as well as the callbacks in Client are called in this thread
> (and
> > we call it child thread). The fact that there is another decoder thread to
> help
> > sending/processing buffers is implementation details that each VDAImpl
should
> > hide.
> 
> That's true, however VDA is also an IPC interface and calls are IPC messages
and
> can be posted from and executed in separate worlds (e.g. different processes).
> How it works on the GPU process side and its details is not applicable in all
> cases. The only thing we can guarantee is the ordering of IPC messages, but
not
> when they arrive or when they execute and how.
> 
> 
> > So the contract is simple, before Client::NotifyFlushDone() is called, all
> > buffers should be returned by NotifyPictureReady(). And after that, VDA
should
> > start to use and hold any pictures sent by ReusePictureBuffer().
> 
> The Client and VDA are in different processes. The only way for the Client to
> guarantee that VDA will keep the buffers returned to it after flush sequence,
is
> to wait for NotifyFlushDone() before actually posting any
ReusePictureBuffers().
> There is no way for Client or the VDA to know or control when a message
arrives
> on the other side, apart from not posting it, or posting it only after
receiving
> the message that has to precede it.
> 
> The problem is, there is no notification Client->VDA that it consumed the
> NotifyFlushDone, so VDA cannot govern this. Instead, the Client must assume
that
> any ReusePictureBuffer() call it posts after calling Flush() and before it
gets
> NotifyFlushDone() may behave in either way. Only if Client posts RPB() after
> getting NotifyFlushDone(), it can guarantee VDA will keep the buffer.

I see. You're right, I only think about the the use case for ArcGVDA which also
runs in the GPU process. However this make things difficult to handle. Client
must keep returning buffers since it doesn't know how many buffers are required
to finish the flush. On the other hand, those returned buffers could be hold
because VDA may already post NotifyFlushDone(). That leads us back to the
original issue: ArcGVDA may not have a buffer to send the EOS flag.

How about adding a new function like ResumeFromFlush() in VDA, before it is
called, VDA just keeps returning picture buffers. Otherwise, I would suggest we
just keeping one more picture buffer in ArcGVDA and use it to send back the EOS
flag as a temporary solution.

Powered by Google App Engine
This is Rietveld 408576698