Reland of Add ability to scale to arbitrary factors (patchset #1 id:1 of https://codereview.webrtc.org/2557323002/ )

Reason for revert:
There was a bug in the implementation where the adapter could get stuck at really low resolutions. That has now been fixed.

Original issue's description:
> Revert of Add ability to scale to arbitrary factors (patchset #7 id:120001 of https://codereview.webrtc.org/2555483005/ )
>
> Reason for revert:
> Issue discovered with scaling back up.
>
> Original issue's description:
> > Add ability to scale to arbitrary factors
> >
> > This CL adds a fallback for the case when no optimized scale factor produces a low enough resolution for what was requested. It also ensures that all resolutions provided by the video adapter are divisible by four. This is required by some hardware implementations.
> >
> > BUG=webrtc:6837
> >
> > Committed: https://crrev.com/710c335d785b104bda4a912bd7909e4d27f9b04f
> > Cr-Commit-Position: refs/heads/master@{#15469}
>
> TBR=magjed@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6837
>
> Committed: https://crrev.com/7722a4cc8d31e5e924e9e6c5c97412ce8bbbe59d
> Cr-Commit-Position: refs/heads/master@{#15470}

R=magjed@webrtc.org
BUG=webrtc:6837,webrtc:6848

Review-Url: https://codereview.webrtc.org/2558243003
Cr-Commit-Position: refs/heads/master@{#15485}
This commit is contained in:
kthelgason
2016-12-08 08:04:51 -08:00
committed by Commit bot
parent 7dada5e4c0
commit c8474178d6
6 changed files with 136 additions and 95 deletions

View File

@ -12,13 +12,19 @@
#include <utility>
namespace {
// MediaCodec wants resolution to be divisible by 2.
const int kRequiredResolutionAlignment = 2;
}
namespace webrtc {
AndroidVideoTrackSource::AndroidVideoTrackSource(rtc::Thread* signaling_thread,
JNIEnv* jni,
jobject j_egl_context,
bool is_screencast)
: signaling_thread_(signaling_thread),
: AdaptedVideoTrackSource(kRequiredResolutionAlignment),
signaling_thread_(signaling_thread),
surface_texture_helper_(webrtc_jni::SurfaceTextureHelper::create(
jni,
"Camera SurfaceTextureHelper",