[MediaRecorder] Fix corrupted video problem with pause/resume spamming.
This CL fixes an issue caused by the following sequence of events: 1. MediaRecorderHandler::Pause(): recording_ = false 2. MediaRecorderHandler::WriteData(): if (!recording_) return The problem is that the WriteData() invocation was decided to happen while the recorder was still resumed. In that state, wholes would be produced which are not tolerated by vpx_encoder, which interprets those as corrupted. The fix reverts the semantic of the code to when the class was not under oilpan and would require manual memory management and restores the "invalidation" semantic from when the class was using a weak ptr. In fact, the weak reference would be invalidated hence making the callbacks no-ops. To keep the same semantic, this CL introduces a boolean and avoids overloading the meaning of 'recording_' This should also not require calling Pause() in Stop(), as all callbacks will not do anything after Stop() is called. Fixed: 1060358 Change-Id: I88b0aeb10fd13034412f3689648cebd1df40d6bf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106072 Commit-Queue: Armando Miraglia <armax@chromium.org> Reviewed-by:Markus Handell <handellm@google.com> Cr-Commit-Position: refs/heads/master@{#752838}
Showing
Please register or sign in to comment