Commit eb6d3e0c authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/vda_video_frame_pool: invalidate pool weak pointers on reconfiguration

GetFrame() returns VideoFrames with a destruction observer than puts the
frame back into the pool once the client is done with it. However, when
a reconfiguration takes place, we are now working with a new set of
frames, and we should not put the old ones back into the pool. Make sure
this does not happen by invalidating the weak pointers the destruction
observers has been posted with when switching to a new set of frames.

BUG=b:161759267
BUG=b:165035340
BUG=b:172881995
TEST=CtsMediaTestCases android.media.cts.AdaptivePlaybackTest#testH264Adaptive
passes on Trogdor
TEST=GtsExoPlayerTestCases com.google.android.exoplayer.gts.DashTest
passes on Trogdor

Change-Id: Ia1a28fb64d5659eb1eedf0b96ad4bc344e67fdad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2548587
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829120}
parent 62214500
......@@ -52,6 +52,12 @@ base::Optional<GpuBufferLayout> VdaVideoFramePool::Initialize(
DVLOGF(3) << "Arguments related to frame layout are not changed, skip.";
return layout_;
}
// Invalidate weak pointers so the re-import callbacks of the frames we are
// about to stop managing do not run and add them back to us.
weak_this_factory_.InvalidateWeakPtrs();
weak_this_ = weak_this_factory_.GetWeakPtr();
max_num_frames_ = max_num_frames;
fourcc_ = fourcc;
coded_size_ = coded_size;
......
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