cricket::VideoAdapter: Drop frames before spending time converting/scaling, not after.

In VideoCapturer::OnFrameCaptured, we currently convert cricket::CapturedFrame to cricket::VideoFrame and then send that to VideoAdapter::AdaptFrame. AdaptFrame may then decide to drop the frame. It would be faster to drop the frame before converting to cricket::VideoFrame.

This CL refactors VideoAdapter with a new function AdaptFrameResolution that takes captured resolution as input and output adapted resolution, or 0x0 if the frame should be dropped. Using that function, frames can be dropped before any conversion takes place.

R=fbarchard@google.com, perkj@webrtc.org, tommi@webrtc.org

Committed: https://code.google.com/p/webrtc/source/detail?r=7702

Committed: https://code.google.com/p/webrtc/source/detail?r=7707

Review URL: https://webrtc-codereview.appspot.com/29949004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7721 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
magjed@webrtc.org
2014-11-19 18:09:14 +00:00
parent 40af3a56e4
commit f58b455cf7
7 changed files with 210 additions and 87 deletions

View File

@ -56,6 +56,11 @@ class VideoAdapter {
const VideoFormat& output_format();
// If the parameter black is true, the adapted frames will be black.
void SetBlackOutput(bool black);
bool IsBlackOutput();
// Return the adapted resolution given the input resolution. The returned
// resolution will be 0x0 if the frame should be dropped.
VideoFormat AdaptFrameResolution(int in_width, int in_height);
// Adapt the input frame from the input format to the output format. Return
// true and set the output frame to NULL if the input frame is dropped. Return