Refactor buffer lock into ScopedBufferLock class
This change simplifies MFVideoCallback::OnSample by extracting the code that locks and unlocks the buffer containing the sample data to a new class called ScopedBufferLock. ScopedBufferLock takes an IMFMediaBuffer object upon creation and locks it in its constructor, allowing the caller to use the buffer, then automatically unlocks the buffer in its destructor. This not only simplifies the calling code, but ensures that a buffer is unlocked after use. Change-Id: Iba98f3fef8f15f03d5929e7c23b93ab53ab5e90c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218484 Commit-Queue: Jesse McKenna <jessemckenna@google.com> Reviewed-by:Dale Curtis <dalecurtis@chromium.org> Cr-Commit-Position: refs/heads/master@{#773947}
Showing
Please register or sign in to comment