[adaptation] Expose target pixels and max framerate in VideoAdapter
This will enable wiring up these signals to the platform specific capturers Bug: chromium:1116430 Change-Id: I6cdab61eab202a24fa56167da57c389a5b1880c2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182683 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32017}
This commit is contained in:

committed by
Commit Bot

parent
08b63641bd
commit
c2cc4d305a
@ -349,4 +349,22 @@ void VideoAdapter::OnSinkWants(const rtc::VideoSinkWants& sink_wants) {
|
||||
source_resolution_alignment_, sink_wants.resolution_alignment);
|
||||
}
|
||||
|
||||
int VideoAdapter::GetTargetPixels() const {
|
||||
webrtc::MutexLock lock(&mutex_);
|
||||
return resolution_request_target_pixel_count_;
|
||||
}
|
||||
|
||||
float VideoAdapter::GetMaxFramerate() const {
|
||||
webrtc::MutexLock lock(&mutex_);
|
||||
// Minimum of |max_fps_| and |max_framerate_request_| is used to throttle
|
||||
// frame-rate.
|
||||
int framerate = std::min(max_framerate_request_,
|
||||
max_fps_.value_or(max_framerate_request_));
|
||||
if (framerate == std::numeric_limits<int>::max()) {
|
||||
return std::numeric_limits<float>::infinity();
|
||||
} else {
|
||||
return max_framerate_request_;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace cricket
|
||||
|
@ -97,6 +97,14 @@ class VideoAdapter {
|
||||
void OnSinkWants(const rtc::VideoSinkWants& sink_wants)
|
||||
RTC_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
// Returns maximum image area, which shouldn't impose any adaptations.
|
||||
// Can return |numeric_limits<int>::max()| if no limit is set.
|
||||
int GetTargetPixels() const;
|
||||
|
||||
// Returns current frame-rate limit.
|
||||
// Can return |numeric_limits<float>::infinity()| if no limit is set.
|
||||
float GetMaxFramerate() const;
|
||||
|
||||
private:
|
||||
// Determine if frame should be dropped based on input fps and requested fps.
|
||||
bool KeepFrame(int64_t in_timestamp_ns) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
||||
@ -136,7 +144,7 @@ class VideoAdapter {
|
||||
int max_framerate_request_ RTC_GUARDED_BY(mutex_);
|
||||
|
||||
// The critical section to protect the above variables.
|
||||
webrtc::Mutex mutex_;
|
||||
mutable webrtc::Mutex mutex_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter);
|
||||
};
|
||||
|
Reference in New Issue
Block a user