Skip to content
Snippets Groups Projects
Commit b001b34f authored by Chih-Yu Huang's avatar Chih-Yu Huang
Browse files

C2VdaBqBlockPool: Polish the retry logic

After fetching new IGBP slot times out, we should retry the fetching
when buffer released at IGBP. We use a flag
|mBufferReleasedAfterTimedOut| to catch the case that the buffer is
released between fetching timed out and setting the retry callback.
If the flag is set, then we should execute the callback immediately,
instead of waiting for the next buffer released event.

However, we forgot to reset the flag when executing the callback. It
caused we continuously retry the buffer fetching until the next buffer
released event. This CL fixes this issue.

Bug: 175489166
Test: run com.google.android.exoplayer.gts.DashTest#testH264Adaptive
      and check setMaxDequeuedBufferCount() only retry when buffer
      released
Change-Id: I8f7a36af50e5eebfcbecedc0f126c86f9427fa95
parent 9b9e79c1
No related branches found
No related tags found
No related merge requests found
...@@ -603,8 +603,8 @@ private: ...@@ -603,8 +603,8 @@ private:
sp<EventNotifier> mFetchBufferNotifier; sp<EventNotifier> mFetchBufferNotifier;
std::mutex mBufferReleaseMutex; std::mutex mBufferReleaseMutex;
// Set to true when the buffer release event is triggered after dequeueing // Set to true when the buffer release event is triggered after dequeueing buffer from IGBP
// buffer from IGBP times out. // times out. Reset when fetching new slot times out, or |mNotifyBlockAvailableCb| is executed.
bool mBufferReleasedAfterTimedOut GUARDED_BY(mBufferReleaseMutex) = false; bool mBufferReleasedAfterTimedOut GUARDED_BY(mBufferReleaseMutex) = false;
// The callback to notify the caller the buffer is available. // The callback to notify the caller the buffer is available.
::base::OnceClosure mNotifyBlockAvailableCb GUARDED_BY(mBufferReleaseMutex); ::base::OnceClosure mNotifyBlockAvailableCb GUARDED_BY(mBufferReleaseMutex);
...@@ -855,6 +855,7 @@ void C2VdaBqBlockPool::Impl::onEventNotified() { ...@@ -855,6 +855,7 @@ void C2VdaBqBlockPool::Impl::onEventNotified() {
mBufferReleasedAfterTimedOut = true; mBufferReleasedAfterTimedOut = true;
if (mNotifyBlockAvailableCb) { if (mNotifyBlockAvailableCb) {
mBufferReleasedAfterTimedOut = false;
outputCb = std::move(mNotifyBlockAvailableCb); outputCb = std::move(mNotifyBlockAvailableCb);
} }
} }
...@@ -1184,6 +1185,7 @@ bool C2VdaBqBlockPool::Impl::setNotifyBlockAvailableCb(::base::OnceClosure cb) { ...@@ -1184,6 +1185,7 @@ bool C2VdaBqBlockPool::Impl::setNotifyBlockAvailableCb(::base::OnceClosure cb) {
// If there is any buffer released after dequeueBuffer() timed out, then we could notify the // If there is any buffer released after dequeueBuffer() timed out, then we could notify the
// caller directly. // caller directly.
if (mBufferReleasedAfterTimedOut) { if (mBufferReleasedAfterTimedOut) {
mBufferReleasedAfterTimedOut = false;
outputCb = std::move(cb); outputCb = std::move(cb);
} else { } else {
mNotifyBlockAvailableCb = std::move(cb); mNotifyBlockAvailableCb = std::move(cb);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment