Commit Graph

28 Commits

Author SHA1 Message Date
55a0135484 Make sure we observe enough frames before scaling.
If the encoder takes a long time to start up and emit frames the polling
interval of the quality scaler would get out of sync. This causes it to
sometimes make scaling decisions based on only a handful of frames.
This CL ensures that we have observed some minimum number of frames
before deciding to scale up or down.

BUG=b/36734056

Review-Url: https://codereview.webrtc.org/2789483002
Cr-Commit-Position: refs/heads/master@{#17523}
2017-04-04 09:31:42 +00:00
b12a3e3427 Synchronize task queue operations in QualityScaler tests.
These tests were disabled due to flakiness when running on the bots.
Hopefully synchronizing all operations that run on Task Queue will
fix this.

BUG=webrtc:6799

Review-Url: https://codereview.webrtc.org/2774643002
Cr-Commit-Position: refs/heads/master@{#17463}
2017-03-30 08:04:55 +00:00
b1ca073db4 Rename adaptation api methods, extended vie_encoder unit test.
Use AdaptDown/AdaptUp instead of ScaleDown/ScaleUp, since we may want to
adapt using other means than resolution.

Also, extend vie_encoder with unit test that actually uses frames scaled
to resolution as determined by VideoAdapter, since that seems to be the
default implementation.

BUG=webrtc:4172

Review-Url: https://codereview.webrtc.org/2652893015
Cr-Commit-Position: refs/heads/master@{#16402}
2017-02-01 16:38:12 +00:00
46711db355 Disable flaky QualityScaler tests for now.
BUG=webrtc:6799
TBR=sprang@webrtc.org

Review-Url: https://codereview.webrtc.org/2564423002
Cr-Commit-Position: refs/heads/master@{#15573}
2016-12-13 13:32:31 +00:00
86cf9a2474 Increase test timeout to combat flakiness.
These tests have been a little flaky on the bots.
Hopefully increasing the timeout by 200% will help.

BUG=webrtc:6799

Review-Url: https://codereview.webrtc.org/2541743006
Cr-Commit-Position: refs/heads/master@{#15355}
2016-12-01 10:57:07 +00:00
876222f77d Move usage of QualityScaler to ViEEncoder.
This brings QualityScaler much more in line with OveruseFrameDetector.
The two classes are conceptually similar, and should be used in the
same way. The biggest changes in this CL are:
- Quality scaling is now only done in ViEEncoder and not in each
  encoder implementation separately.
- QualityScaler now checks the average QP asynchronously, instead of
  having to be polled on each frame.
- QualityScaler is no longer responsible for actually scaling the frames,
  but has a callback to ViEEncoder that it uses to express it's desire
  for lower resolution.

BUG=webrtc:6495

Review-Url: https://codereview.webrtc.org/2398963003
Cr-Commit-Position: refs/heads/master@{#15286}
2016-11-29 09:44:22 +00:00
77eab70470 Enable the -Wundef warning for clang
NOPRESUBMIT=true
BUG=webrtc:6398

Review-Url: https://codereview.webrtc.org/2358993004
Cr-Commit-Position: refs/heads/master@{#14425}
2016-09-29 00:42:08 +00:00
194f40a2e7 Refactor QualityScaler and MovingAverage
The MovingAverage class was very specific to the QualityScaler. This
commit generalizes the MovingAverage class to be useful in other
situations as well, and adapts the QualityScaler to use the new
MovingAverage.

BUG=webrtc:6304

Review-Url: https://codereview.webrtc.org/2310853002
Cr-Commit-Position: refs/heads/master@{#14207}
2016-09-14 09:15:02 +00:00
ac62bd4a3b Rewrite CreateBlackFrame in webrtcvideoengine.
Don't use VideoFrameBuffer::MutableDataY and friends, instead, use
I420Buffer::SetToBlack.

Also introduce static method I420Buffer::Create, to create an object and
return a scoped_refptr.

TBR=marpan@webrtc.org # Trivial change to video_denoiser.cc
BUG=webrtc:5921

Review-Url: https://codereview.webrtc.org/2078943002
Cr-Commit-Position: refs/heads/master@{#13212}
2016-06-20 10:39:00 +00:00
718a763d59 Refactor scaling.
Introduce a new method I420Buffer::CropAndScale, and a static
convenience helper I420Buffer::CenterCropAndScale. Use them for almost
all scaling needs.

Delete the Scaler class and the cricket::VideoFrame::Stretch* methods.

BUG=webrtc:5682
R=pbos@webrtc.org, perkj@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2020593002 .

Cr-Commit-Position: refs/heads/master@{#13110}
2016-06-13 11:06:14 +00:00
3c6eac2860 Remove QualityScaler framerate reduction.
Framerate-reduction code is disabled on all platforms, and this code
adds complexity. It's necessary to react fast, especially on mobile
platforms or other bad network conditions and framerate reduction adds
another step between HD and QVGA.

BUG=webrtc:5678, webrtc:5830
R=jackychen@webrtc.org, mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1885893002 .

Cr-Commit-Position: refs/heads/master@{#12503}
2016-04-26 11:37:20 +00:00
b9e77097ed Add QVGA to thresholds for initial quality.
Makes QualityScaler start at QVGA for <250k initial bitrates. Useful in
combination with overriding max bitrates to a max lower than that for
connections where we know that the max bitrate is capped below where VGA
is useful.

BUG=webrtc:5678
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1900483004 .

Cr-Commit-Position: refs/heads/master@{#12416}
2016-04-18 20:46:06 +00:00
2c8a2964fd Tune QP-based quality thresholds.
Increases measure time for downscale back to 5 seconds, this is required
to not over-react on hand-waving or quick device rotations.

Also increase max thresholds for QP a bit to not overreact when quality
still looks somewhat OK. Min thresholds for H264 seemed very low and are
increased to be sure that we can go back up again. The window is still
quite big with the increased max QP.

Also changes libvpx thresholds to use the same thresholds as the
encoder, they were excessively low before and wouldn't adapt on bad QPs
at all before (but rely on >60% framedropping based on bitrates to go
down).

BUG=webrtc:5678
R=stefan@webrtc.org
TBR=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1894083002 .

Cr-Commit-Position: refs/heads/master@{#12403}
2016-04-18 10:58:17 +00:00
00b62b0849 Remove QualityScaler kDefaultLowQpDenominator.
This denominator doesn't make any semantic sense, it's better to use
real thresholds for when things look "good" or "bad" rather than
fractions of a max QP.

BUG=webrtc:5678
R=danilchap@webrtc.org

Review URL: https://codereview.webrtc.org/1855393005 .

Cr-Commit-Position: refs/heads/master@{#12363}
2016-04-14 15:04:10 +00:00
926dfcdf5e Make QualityScaler not downscale below QVGA.
Applies to all platforms, not only Android now, 160x90 video looks
awful and there's no real point to going below QVGA.

BUG=webrtc:5678
R=danilchap@webrtc.org
TBR=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1867643003 .

Cr-Commit-Position: refs/heads/master@{#12362}
2016-04-14 12:48:18 +00:00
cbac40d321 Reland of Make QualityScaler more responsive to downgrades. (patchset #1 id:1 of https://codereview.webrtc.org/1880103002/ )
Reason for revert:
Regressed behavior is actually desirable (go down to 360p instead of producing super-bad 720p).

Original issue's description:
> Revert of Make QualityScaler more responsive to downgrades. (patchset #3 id:40001 of https://codereview.webrtc.org/1830593003/ )
>
> Reason for revert:
> Speculative revert: want to see if this causes the regression in https://crbug.com/602621
>
> Original issue's description:
> > Make QualityScaler more responsive to downgrades.
> >
> > Permits going from HD to QVGA in 6 seconds instead of 10. Also adds
> > windows for going up quickly in the beginning of a call (before any
> > downscaling happens due to bad quality).
> >
> > BUG=webrtc:5678
> > R=glaznev@webrtc.org, stefan@webrtc.org
> >
> > Committed: https://crrev.com/85829fd90cc4e7a91c9857921b19e8fc126aeb60
> > Cr-Commit-Position: refs/heads/master@{#12219}
>
> TBR=glaznev@webrtc.org,stefan@webrtc.org,pbos@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:5678
> NOTRY=true
>
> Committed: https://crrev.com/19b4fecf08e3fe215e431a260fb673553c15e569
> Cr-Commit-Position: refs/heads/master@{#12331}

TBR=glaznev@webrtc.org,stefan@webrtc.org,phoglund@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:602621, webrtc:5678

Review URL: https://codereview.webrtc.org/1887493003

Cr-Commit-Position: refs/heads/master@{#12341}
2016-04-13 09:51:10 +00:00
19b4fecf08 Revert of Make QualityScaler more responsive to downgrades. (patchset #3 id:40001 of https://codereview.webrtc.org/1830593003/ )
Reason for revert:
Speculative revert: want to see if this causes the regression in https://crbug.com/602621

Original issue's description:
> Make QualityScaler more responsive to downgrades.
>
> Permits going from HD to QVGA in 6 seconds instead of 10. Also adds
> windows for going up quickly in the beginning of a call (before any
> downscaling happens due to bad quality).
>
> BUG=webrtc:5678
> R=glaznev@webrtc.org, stefan@webrtc.org
>
> Committed: https://crrev.com/85829fd90cc4e7a91c9857921b19e8fc126aeb60
> Cr-Commit-Position: refs/heads/master@{#12219}

TBR=glaznev@webrtc.org,stefan@webrtc.org,pbos@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5678
NOTRY=true

Review URL: https://codereview.webrtc.org/1880103002

Cr-Commit-Position: refs/heads/master@{#12331}
2016-04-12 16:06:02 +00:00
85829fd90c Make QualityScaler more responsive to downgrades.
Permits going from HD to QVGA in 6 seconds instead of 10. Also adds
windows for going up quickly in the beginning of a call (before any
downscaling happens due to bad quality).

BUG=webrtc:5678
R=glaznev@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1830593003 .

Cr-Commit-Position: refs/heads/master@{#12219}
2016-04-04 16:11:18 +00:00
a9d0892946 Add initial bitrate and frame resolution parameters to quality scaler.
- Scale down to VGA immediately if call starts with HD resolution
and bitrate below 500 kbps.
- Adjust QP threshold for HW VP8 encoder to scale down faster.

BUG=b/26504665
R=mflodman@webrtc.org, pbos@webrtc.org, sprang@google.com, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1672173002 .

Cr-Commit-Position: refs/heads/master@{#11692}
2016-02-19 23:24:12 +00:00
5908c71128 Lint fix for webrtc/modules/video_coding PART 3!
Trying to submit all changes at once proved impossible since there were
too many changes in too many files. The changes to PRESUBMIT.py
will be uploaded in the last CL.
(original CL: https://codereview.webrtc.org/1528503003/)

BUG=webrtc:5309
TBR=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1540243002

Cr-Commit-Position: refs/heads/master@{#11105}
2015-12-21 16:23:29 +00:00
b7ce96470b modules/video_coding/utility: Remove include
This makes it clearer this code not meant to be used as an API.
I could not find any use of this in downstream code.

BUG=webrtc:5095
TESTED=git cl try -c --bot=android_compile_rel --bot=linux_compile_rel --bot=win_compile_rel --bot=mac_compile_rel --bot=ios_rel --bot=linux_gn_rel --bot=win_x64_gn_rel --bot=mac_x64_gn_rel --bot=android_gn_rel -m tryserver.webrtc
R=stefan@webrtc.org
TBR=magjed@webrtc.org

Review URL: https://codereview.webrtc.org/1440873005 .

Cr-Commit-Position: refs/heads/master@{#10699}
2015-11-18 22:04:20 +00:00
1741770742 Implement a high-QP threshold for Android H.264.
Android hardware H.264 seems to keep a steady high-QP flow instead of
dropping frames, so framedrops aren't sufficient to detect a bad state
where downscaling would be beneficial.

BUG=webrtc:4968
R=magjed@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1364253002 .

Cr-Commit-Position: refs/heads/master@{#10078}
2015-09-25 15:03:37 +00:00
6e2ce6e1ae Allow for framerate reduction for HW encoder.
R=pbos@webrtc.org, stefan@webrtc.org
TBR=glaznev@google.com

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

Cr-Commit-Position: refs/heads/master@{#9573}
2015-07-13 23:26:40 +00:00
6a688f5265 Add default downscale threshold to QualityScaler.
Prevents downscaling below 160x90 or 90x160 to gain more quality.

BUG=4625
R=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1160403004.

Cr-Commit-Position: refs/heads/master@{#9480}
2015-06-22 06:03:07 +00:00
4765070b8d Rename I420VideoFrame to VideoFrame.
This is a mechanical change since it affects so many
files.
I420VideoFrame -> VideoFrame
and reformatted.

Rationale: in the next CL I420VideoFrame will
get an indication of Pixel Format (I420 for
starters) and of storage type: usually
UNOWNED, could be SHMEM, and in the near
future will be possibly TEXTURE. See
https://codereview.chromium.org/1154153003
for the change that happened in Cr.

BUG=4730, chromium:440843
R=jiayl@webrtc.org, niklas.enbom@webrtc.org, pthatcher@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9339}
2015-05-30 00:21:56 +00:00
98d8cf58ee Hardware VP8 encoding: Use QP as metric for resize.
Add vp8 frame header parser to get QP from vp8 bitstream.

BUG= 4273
R=glaznev@webrtc.org, marpan@google.com, pbos@webrtc.org
TBR=stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9256}
2015-05-21 18:11:53 +00:00
61b4d518af Dynamic resolution change for VP8 HW encode.
Off by default for now.

BUG=
R=glaznev@webrtc.org, stefan@webrtc.org
TBR=mflodman@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9045}
2015-04-21 22:29:53 +00:00
a0d7827b16 Add ability to downscale content to improve quality.
BUG=3712
R=marpan@google.com, stefan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7164 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-12 11:51:47 +00:00