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

Unified Diff: content/common/gpu/media/v4l2_slice_video_decode_accelerator.h

Issue 1863523003: Revert "V4L2SVDA: Move allocation from GPU Child thread to decoder thread." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/v4l2_slice_video_decode_accelerator.h
diff --git a/content/common/gpu/media/v4l2_slice_video_decode_accelerator.h b/content/common/gpu/media/v4l2_slice_video_decode_accelerator.h
index 9171e442b8cc1adad2af47b8f3d0bc52920c9e93..cc11da302a160fd31f7fda734e08b3d8c6d54c62 100644
--- a/content/common/gpu/media/v4l2_slice_video_decode_accelerator.h
+++ b/content/common/gpu/media/v4l2_slice_video_decode_accelerator.h
@@ -157,21 +157,21 @@ class CONTENT_EXPORT V4L2SliceVideoDecodeAccelerator
// Dismiss all |picture_buffer_ids| via Client::DismissPictureBuffer()
// and signal |done| after finishing.
- void DismissPictures(const std::vector<int32_t>& picture_buffer_ids,
+ void DismissPictures(std::vector<int32_t> picture_buffer_ids,
base::WaitableEvent* done);
// Task to finish initialization on decoder_thread_.
void InitializeTask();
// Surface set change (resolution change) flow.
- // If we have no surfaces allocated, start it immediately, otherwise mark
- // ourselves as pending for surface set change.
+ // If we have no surfaces allocated, just allocate them and return.
+ // Otherwise mark us as pending for surface set change.
void InitiateSurfaceSetChange();
// If a surface set change is pending and we are ready, stop the device,
// destroy outputs, releasing resources and dismissing pictures as required,
- // followed by starting the flow to allocate a new set for the current
- // resolution/DPB size, as provided by decoder.
- bool FinishSurfaceSetChange();
+ // followed by allocating a new set for the new resolution/DPB size
+ // as provided by decoder. Finally, try to resume decoding.
+ void FinishSurfaceSetChangeIfNeeded();
void NotifyError(Error error);
void DestroyTask();
@@ -189,41 +189,20 @@ class CONTENT_EXPORT V4L2SliceVideoDecodeAccelerator
// Tell the decoder to flush all frames, reset it and mark us as scheduled
// for flush, so that we can finish it once all pending decodes are finished.
void InitiateFlush();
- // To be called if decoder_flushing_ is true. If not all pending frames are
- // decoded, return false, requesting the caller to try again later.
- // Otherwise perform flush by sending all pending pictures to the client,
- // notify it that flush is finished and return true, informing the caller
- // that further progress can be made.
- bool FinishFlush();
+ // If all pending frames are decoded and we are waiting to flush, perform it.
+ // This will send all pending pictures to client and notify the client that
+ // flush is complete and puts us in a state ready to resume.
+ void FinishFlushIfNeeded();
// Reset flow when requested by client.
- // Drop all inputs, reset the decoder and mark us as pending for reset.
+ // Drop all inputs and reset the decoder and mark us as pending for reset.
void ResetTask();
- // To be called if decoder_resetting_ is true. If not all pending frames are
- // decoded, return false, requesting the caller to try again later.
- // Otherwise perform reset by dropping all pending outputs (client is not
- // interested anymore), notifying it that reset is finished, and return true,
- // informing the caller that further progress can be made.
- bool FinishReset();
-
- // Allocate V4L2 buffers and assign them to |buffers| provided by the client
- // via AssignPictureBuffers() on decoder thread.
- void AssignPictureBuffersTask(
- const std::vector<media::PictureBuffer>& buffers);
-
- // Create EGLImages bound to textures in |buffers| for given
- // |output_format_fourcc| and |output_planes_count|.
- void CreateEGLImages(const std::vector<media::PictureBuffer>& buffers,
- uint32_t output_format_fourcc,
- size_t output_planes_count);
-
- // Assign |egl_images| to previously-allocated V4L2 buffers in
- // output_buffer_map_ and picture ids from |buffers| and finish the surface
- // change sequence.
- void AssignEGLImages(const std::vector<media::PictureBuffer>& buffers,
- const std::vector<EGLImageKHR>& egl_images);
-
- // Process pending events, if any.
+ // If all pending frames are decoded and we are waiting to reset, perform it.
+ // This drops all pending outputs (client is not interested anymore),
+ // notifies the client we are done and puts us in a state ready to resume.
+ void FinishResetIfNeeded();
+
+ // Process pending events if any.
void ProcessPendingEventsIfNeeded();
// Performed on decoder_thread_ as a consequence of poll() on decoder_thread_
@@ -400,6 +379,10 @@ class CONTENT_EXPORT V4L2SliceVideoDecodeAccelerator
// The number of pictures that are sent to PictureReady and will be cleared.
int picture_clearing_count_;
+ // Used by the decoder thread to wait for AssignPictureBuffers to arrive
+ // to avoid races with potential Reset requests.
+ base::WaitableEvent pictures_assigned_;
+
// EGL state
EGLDisplay egl_display_;
« no previous file with comments | « no previous file | content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698