Avoids caching native buffers of captured frames.
This ensures that capture devices that relies on the frame being released to continue are not blocked by storing the pending frame. Bug: None Change-Id: If501bca4ab7bda5e0438d24e98d67df589ad6a6d Reviewed-on: https://webrtc-review.googlesource.com/70480 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22907}
This commit is contained in:
parent
d746da6a1d
commit
0d70e372d6
@ -774,18 +774,33 @@ void VideoStreamEncoder::MaybeEncodeVideoFrame(const VideoFrame& video_frame,
|
||||
stats_proxy_->OnInitialQualityResolutionAdaptDown();
|
||||
}
|
||||
++initial_rampup_;
|
||||
pending_frame_ = video_frame;
|
||||
pending_frame_post_time_us_ = time_when_posted_us;
|
||||
// Storing references to a native buffer risks blocking frame capture.
|
||||
if (video_frame.video_frame_buffer()->type() !=
|
||||
VideoFrameBuffer::Type::kNative) {
|
||||
pending_frame_ = video_frame;
|
||||
pending_frame_post_time_us_ = time_when_posted_us;
|
||||
} else {
|
||||
// Ensure that any previously stored frame is dropped.
|
||||
pending_frame_.reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
initial_rampup_ = kMaxInitialFramedrop;
|
||||
|
||||
|
||||
if (EncoderPaused()) {
|
||||
if (pending_frame_)
|
||||
// Storing references to a native buffer risks blocking frame capture.
|
||||
if (video_frame.video_frame_buffer()->type() !=
|
||||
VideoFrameBuffer::Type::kNative) {
|
||||
if (pending_frame_)
|
||||
TraceFrameDropStart();
|
||||
pending_frame_ = video_frame;
|
||||
pending_frame_post_time_us_ = time_when_posted_us;
|
||||
} else {
|
||||
// Ensure that any previously stored frame is dropped.
|
||||
pending_frame_.reset();
|
||||
TraceFrameDropStart();
|
||||
pending_frame_ = video_frame;
|
||||
pending_frame_post_time_us_ = time_when_posted_us;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user