Partial frame capture API part 4
Wire-up PartialFrameCompressor to VideoStreamEncoder. Bug: webrtc:10152 Change-Id: I6a3df28e392cf3f47aec1c97abb1d4d73d5f7e2a Reviewed-on: https://webrtc-review.googlesource.com/c/120409 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26548}
This commit is contained in:

committed by
Commit Bot

parent
9bee67c5c9
commit
62b9fb44aa
@ -336,6 +336,7 @@ class VideoStreamEncoder::VideoSourceProxy {
|
||||
}
|
||||
// Limit to configured max framerate.
|
||||
wants.max_framerate_fps = std::min(max_framerate_, wants.max_framerate_fps);
|
||||
wants.partial_frames = true;
|
||||
return wants;
|
||||
}
|
||||
|
||||
@ -713,8 +714,24 @@ void VideoStreamEncoder::ConfigureQualityScaler() {
|
||||
|
||||
void VideoStreamEncoder::OnFrame(const VideoFrame& video_frame) {
|
||||
RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_);
|
||||
|
||||
const VideoFrame::PartialFrameDescription* partial_desc =
|
||||
video_frame.partial_frame_description();
|
||||
VideoFrame incoming_frame = video_frame;
|
||||
|
||||
if (video_frame.cache_buffer_for_partial_updates()) {
|
||||
VideoFrameBuffer* input_buffer = video_frame.video_frame_buffer();
|
||||
if (!partial_frame_assembler_.ApplyPartialUpdate(
|
||||
input_buffer, &incoming_frame, partial_desc)) {
|
||||
// Can't apply new image to the cached buffer because of some error.
|
||||
// Nothing sensible to encode.
|
||||
// Detailed error message is already logged by |ApplyPartialUpdate()|.
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
partial_frame_assembler_.Reset();
|
||||
}
|
||||
|
||||
// Local time in webrtc time base.
|
||||
int64_t current_time_us = clock_->TimeInMicroseconds();
|
||||
int64_t current_time_ms = current_time_us / rtc::kNumMicrosecsPerMillisec;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "rtc_base/sequenced_task_checker.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
#include "video/overuse_frame_detector.h"
|
||||
#include "video/partial_frame_assembler.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -295,6 +296,9 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
|
||||
// the worker thread.
|
||||
std::atomic<int> pending_frame_drops_;
|
||||
|
||||
PartialFrameAssembler partial_frame_assembler_
|
||||
RTC_GUARDED_BY(incoming_frame_race_checker_);
|
||||
|
||||
// All public methods are proxied to |encoder_queue_|. It must must be
|
||||
// destroyed first to make sure no tasks are run that use other members.
|
||||
rtc::TaskQueue encoder_queue_;
|
||||
|
Reference in New Issue
Block a user