mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-20 09:07:52 +01:00
Make OnEncodedFrame and OnDecodableFrameTimeout expectations consistent.
Fix call in FrameBuffer3Proxy to OnDecodableFrameTimeout to match with FrameBuffer2Proxy and how OnEncodedFrame is called. Bug: none Change-Id: I6f5f18bd9a425aa55f5826654b24c2c0ee5af5f7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269302 Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37610}
This commit is contained in:
parent
fc22dfa727
commit
ed6b586b62
2 changed files with 18 additions and 22 deletions
|
@ -364,6 +364,7 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
|||
// VideoReceiveStream2 wants frames on the decoder thread.
|
||||
decode_queue_->PostTask(
|
||||
SafeTask(decode_safety_, [this, frame = std::move(frame)]() mutable {
|
||||
RTC_DCHECK_RUN_ON(decode_queue_);
|
||||
receiver_->OnEncodedFrame(std::move(frame));
|
||||
}));
|
||||
}
|
||||
|
@ -375,7 +376,10 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
|||
timeout_tracker_.Stop();
|
||||
return;
|
||||
}
|
||||
receiver_->OnDecodableFrameTimeout(delay);
|
||||
decode_queue_->PostTask(SafeTask(decode_safety_, [this, delay]() {
|
||||
RTC_DCHECK_RUN_ON(decode_queue_);
|
||||
receiver_->OnDecodableFrameTimeout(delay);
|
||||
}));
|
||||
// Stop sending timeouts until receive starts waiting for a new frame.
|
||||
timeout_tracker_.Stop();
|
||||
decoder_ready_for_new_frame_ = false;
|
||||
|
@ -493,7 +497,7 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
|||
TaskQueueBase* const worker_queue_;
|
||||
TaskQueueBase* const decode_queue_;
|
||||
VCMReceiveStatisticsCallback* const stats_proxy_;
|
||||
FrameSchedulingReceiver* const receiver_;
|
||||
FrameSchedulingReceiver* const receiver_ RTC_PT_GUARDED_BY(decode_queue_);
|
||||
VCMTiming* const timing_;
|
||||
const std::unique_ptr<FrameDecodeScheduler> frame_decode_scheduler_
|
||||
RTC_GUARDED_BY(&worker_sequence_checker_);
|
||||
|
|
|
@ -752,12 +752,6 @@ TimeDelta VideoReceiveStream2::GetMaxWait() const {
|
|||
}
|
||||
|
||||
void VideoReceiveStream2::OnEncodedFrame(std::unique_ptr<EncodedFrame> frame) {
|
||||
if (!decode_queue_.IsCurrent()) {
|
||||
decode_queue_.PostTask([this, frame = std::move(frame)]() mutable {
|
||||
OnEncodedFrame(std::move(frame));
|
||||
});
|
||||
return;
|
||||
}
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
if (decoder_stopped_)
|
||||
return;
|
||||
|
@ -766,26 +760,24 @@ void VideoReceiveStream2::OnEncodedFrame(std::unique_ptr<EncodedFrame> frame) {
|
|||
}
|
||||
|
||||
void VideoReceiveStream2::OnDecodableFrameTimeout(TimeDelta wait_time) {
|
||||
if (!call_->worker_thread()->IsCurrent()) {
|
||||
call_->worker_thread()->PostTask(
|
||||
SafeTask(task_safety_.flag(),
|
||||
[this, wait_time] { OnDecodableFrameTimeout(wait_time); }));
|
||||
return;
|
||||
}
|
||||
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
Timestamp now = clock_->CurrentTime();
|
||||
// TODO(bugs.webrtc.org/11993): PostTask to the network thread.
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
HandleFrameBufferTimeout(clock_->CurrentTime(), wait_time);
|
||||
call_->worker_thread()->PostTask(
|
||||
SafeTask(task_safety_.flag(), [this, wait_time, now] {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
HandleFrameBufferTimeout(now, wait_time);
|
||||
|
||||
decode_queue_.PostTask([this] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
frame_buffer_->StartNextDecode(keyframe_required_);
|
||||
});
|
||||
decode_queue_.PostTask([this] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
frame_buffer_->StartNextDecode(keyframe_required_);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
// RTC_RUN_ON(decode_queue_)
|
||||
void VideoReceiveStream2::HandleEncodedFrame(
|
||||
std::unique_ptr<EncodedFrame> frame) {
|
||||
// Running on `decode_queue_`.
|
||||
Timestamp now = clock_->CurrentTime();
|
||||
|
||||
// Current OnPreDecode only cares about QP for VP8.
|
||||
|
|
Loading…
Reference in a new issue