Remove FrameBuffer::ReturnReason

This was a remenant leftover from a previous design, which was no longer
valid after the switch to TaskQueues. ReturnReason::kStopped was not
used at all, and so Timeout or FrameFound can be inferred from whether
the frame is null or not.

Bug: webrtc:13343, webrtc:13346
Change-Id: Ib0f847b1e1192e32ea11208e48f5a3892703521e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239651
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35490}
This commit is contained in:
Evan Shrubsole
2021-12-07 14:11:45 +01:00
committed by WebRTC LUCI CQ
parent 9445779545
commit 3d29efd279
8 changed files with 78 additions and 111 deletions

View File

@ -78,11 +78,10 @@ FrameBuffer::~FrameBuffer() {
RTC_DCHECK_RUN_ON(&construction_checker_);
}
void FrameBuffer::NextFrame(
int64_t max_wait_time_ms,
bool keyframe_required,
rtc::TaskQueue* callback_queue,
std::function<void(std::unique_ptr<EncodedFrame>, ReturnReason)> handler) {
void FrameBuffer::NextFrame(int64_t max_wait_time_ms,
bool keyframe_required,
rtc::TaskQueue* callback_queue,
NextFrameCallback handler) {
RTC_DCHECK_RUN_ON(&callback_checker_);
RTC_DCHECK(callback_queue->IsCurrent());
TRACE_EVENT0("webrtc", "FrameBuffer::NextFrame");
@ -110,8 +109,7 @@ void FrameBuffer::StartWaitForNextFrameOnQueue() {
// If this task has not been cancelled, we did not get any new frames
// while waiting. Continue with frame delivery.
std::unique_ptr<EncodedFrame> frame;
std::function<void(std::unique_ptr<EncodedFrame>, ReturnReason)>
frame_handler;
NextFrameCallback frame_handler;
{
MutexLock lock(&mutex_);
if (!frames_to_decode_.empty()) {
@ -130,8 +128,7 @@ void FrameBuffer::StartWaitForNextFrameOnQueue() {
CancelCallback();
}
// Deliver frame, if any. Otherwise signal timeout.
ReturnReason reason = frame ? kFrameFound : kTimeout;
frame_handler(std::move(frame), reason);
frame_handler(std::move(frame));
return TimeDelta::Zero(); // Ignored.
});
}