Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: content/renderer/media/video_track_adapter.cc

Issue 517973002: Change VideoTrackAdapter to not drop frames if the source frame rate is known. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/video_track_adapter.cc
diff --git a/content/renderer/media/video_track_adapter.cc b/content/renderer/media/video_track_adapter.cc
index 3f61a429c46968697e095d9d91b227ac2cdb25ea..914c54f0f4783522ccd1ea58592ef1d7b5e12f58 100644
--- a/content/renderer/media/video_track_adapter.cc
+++ b/content/renderer/media/video_track_adapter.cc
@@ -89,7 +89,8 @@ class VideoTrackAdapter::VideoFrameResolutionAdapter
// Returns |true| if the input frame rate is higher that the requested max
// frame rate and |frame| should be dropped.
- bool MaybeDropFrame(const scoped_refptr<media::VideoFrame>& frame);
+ bool MaybeDropFrame(const scoped_refptr<media::VideoFrame>& frame,
+ float source_frame_rate);
// Bound to the IO-thread.
base::ThreadChecker io_thread_checker_;
@@ -152,7 +153,7 @@ void VideoTrackAdapter::VideoFrameResolutionAdapter::DeliverFrame(
const base::TimeTicks& estimated_capture_time) {
DCHECK(io_thread_checker_.CalledOnValidThread());
- if (MaybeDropFrame(frame))
+ if (MaybeDropFrame(frame, format.frame_rate))
return;
// TODO(perkj): Allow cropping / scaling of textures once
@@ -224,8 +225,15 @@ void VideoTrackAdapter::VideoFrameResolutionAdapter::DeliverFrame(
}
bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
- const scoped_refptr<media::VideoFrame>& frame) {
- if (max_frame_rate_ == 0.0f)
+ const scoped_refptr<media::VideoFrame>& frame,
+ float source_frame_rate) {
+ DCHECK(io_thread_checker_.CalledOnValidThread());
+
+ // Do not drop frames if max frame rate hasn't been specified or the source
+ // frame rate is known and is lower than max.
+ if (max_frame_rate_ == 0.0f ||
+ (source_frame_rate > 0 &&
+ source_frame_rate <= max_frame_rate_))
tommi (sloooow) - chröme 2014/08/30 17:40:58 nit: there should have been braces here.
return false;
base::TimeDelta delta = frame->timestamp() - last_time_stamp_;
@@ -243,7 +251,7 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
return true;
}
last_time_stamp_ = frame->timestamp();
- if (delta == last_time_stamp_) // First received frame.
+ if (delta == last_time_stamp_) // First received frame.
return false;
// Calculate the frame rate using a simple AR filter.
// Use a simple filter with 0.1 weight of the current sample.
« no previous file with comments | « content/renderer/media/media_stream_video_source.cc ('k') | content/renderer/media/webrtc/media_stream_remote_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698