Removes decoder thread fallback from VideoReceiveStream.
The task queue variant has been the default without issues for a few months. Bug: webrtc:10365 Change-Id: I1e1707a80788243eba1b439c8db4f8f6162774ed Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152283 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29138}
This commit is contained in:
parent
29ab487ea7
commit
de5f63910e
@ -184,12 +184,6 @@ VideoReceiveStream::VideoReceiveStream(
|
||||
num_cpu_cores_(num_cpu_cores),
|
||||
process_thread_(process_thread),
|
||||
clock_(clock),
|
||||
use_task_queue_(
|
||||
!field_trial::IsDisabled("WebRTC-Video-DecodeOnTaskQueue")),
|
||||
decode_thread_(&DecodeThreadFunction,
|
||||
this,
|
||||
"DecodingThread",
|
||||
rtc::kHighestPriority),
|
||||
call_stats_(call_stats),
|
||||
source_tracker_(clock_),
|
||||
stats_proxy_(&config_, clock_),
|
||||
@ -392,18 +386,14 @@ void VideoReceiveStream::Start() {
|
||||
// method does nothing that is useful for us, since we no longer use the old
|
||||
// jitter buffer.
|
||||
|
||||
// Start the decode thread
|
||||
// Start decoding on task queue.
|
||||
video_receiver_.DecoderThreadStarting();
|
||||
stats_proxy_.DecoderThreadStarting();
|
||||
if (!use_task_queue_) {
|
||||
decode_thread_.Start();
|
||||
} else {
|
||||
decode_queue_.PostTask([this] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
decoder_stopped_ = false;
|
||||
StartNextDecode();
|
||||
});
|
||||
}
|
||||
decode_queue_.PostTask([this] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
decoder_stopped_ = false;
|
||||
StartNextDecode();
|
||||
});
|
||||
decoder_running_ = true;
|
||||
rtp_video_stream_receiver_.StartReceive();
|
||||
}
|
||||
@ -415,11 +405,8 @@ void VideoReceiveStream::Stop() {
|
||||
stats_proxy_.OnUniqueFramesCounted(
|
||||
rtp_video_stream_receiver_.GetUniqueFramesSeen());
|
||||
|
||||
if (!use_task_queue_) {
|
||||
frame_buffer_->Stop();
|
||||
} else {
|
||||
decode_queue_.PostTask([this] { frame_buffer_->Stop(); });
|
||||
}
|
||||
decode_queue_.PostTask([this] { frame_buffer_->Stop(); });
|
||||
|
||||
call_stats_->DeregisterStatsObserver(this);
|
||||
|
||||
if (decoder_running_) {
|
||||
@ -428,17 +415,14 @@ void VideoReceiveStream::Stop() {
|
||||
// before joining the decoder thread.
|
||||
video_receiver_.TriggerDecoderShutdown();
|
||||
|
||||
if (!use_task_queue_) {
|
||||
decode_thread_.Stop();
|
||||
} else {
|
||||
rtc::Event done;
|
||||
decode_queue_.PostTask([this, &done] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
decoder_stopped_ = true;
|
||||
done.Set();
|
||||
});
|
||||
done.Wait(rtc::Event::kForever);
|
||||
}
|
||||
rtc::Event done;
|
||||
decode_queue_.PostTask([this, &done] {
|
||||
RTC_DCHECK_RUN_ON(&decode_queue_);
|
||||
decoder_stopped_ = true;
|
||||
done.Set();
|
||||
});
|
||||
done.Wait(rtc::Event::kForever);
|
||||
|
||||
decoder_running_ = false;
|
||||
video_receiver_.DecoderThreadStopped();
|
||||
stats_proxy_.DecoderThreadStopped();
|
||||
@ -646,7 +630,6 @@ int64_t VideoReceiveStream::GetWaitMs() const {
|
||||
}
|
||||
|
||||
void VideoReceiveStream::StartNextDecode() {
|
||||
RTC_DCHECK(use_task_queue_);
|
||||
TRACE_EVENT0("webrtc", "VideoReceiveStream::StartNextDecode");
|
||||
|
||||
struct DecodeTask {
|
||||
@ -674,34 +657,6 @@ void VideoReceiveStream::StartNextDecode() {
|
||||
});
|
||||
}
|
||||
|
||||
void VideoReceiveStream::DecodeThreadFunction(void* ptr) {
|
||||
ScopedRegisterThreadForDebugging thread_dbg(RTC_FROM_HERE);
|
||||
while (static_cast<VideoReceiveStream*>(ptr)->Decode()) {
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoReceiveStream::Decode() {
|
||||
RTC_DCHECK(!use_task_queue_);
|
||||
TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode");
|
||||
|
||||
std::unique_ptr<video_coding::EncodedFrame> frame;
|
||||
video_coding::FrameBuffer::ReturnReason res =
|
||||
frame_buffer_->NextFrame(GetWaitMs(), &frame, keyframe_required_);
|
||||
|
||||
if (res == ReturnReason::kStopped) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
RTC_DCHECK_EQ(res, ReturnReason::kFrameFound);
|
||||
HandleEncodedFrame(std::move(frame));
|
||||
} else {
|
||||
RTC_DCHECK_EQ(res, ReturnReason::kTimeout);
|
||||
HandleFrameBufferTimeout();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void VideoReceiveStream::HandleEncodedFrame(
|
||||
std::unique_ptr<EncodedFrame> frame) {
|
||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
|
||||
@ -134,8 +134,6 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
private:
|
||||
int64_t GetWaitMs() const;
|
||||
void StartNextDecode() RTC_RUN_ON(decode_queue_);
|
||||
static void DecodeThreadFunction(void* ptr);
|
||||
bool Decode();
|
||||
void HandleEncodedFrame(std::unique_ptr<video_coding::EncodedFrame> frame);
|
||||
void HandleFrameBufferTimeout();
|
||||
|
||||
@ -157,10 +155,6 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
ProcessThread* const process_thread_;
|
||||
Clock* const clock_;
|
||||
|
||||
const bool use_task_queue_;
|
||||
|
||||
rtc::PlatformThread decode_thread_;
|
||||
|
||||
CallStats* const call_stats_;
|
||||
|
||||
bool decoder_running_ RTC_GUARDED_BY(worker_sequence_checker_) = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user