Commit graph

676 commits

Author SHA1 Message Date
Ilya Nikolaevskiy
2ec0c650e9 Set inter_pic_predicted video codec flag in vp9 encoder correctly
This flag only needs to be set in kOn interlayer prediction mode, because
in all others, if new layer is enabled - a keyframe is generated.

Also, use external reference control in that case, because libvpx creates
rtp-incompatible references in that case.

Bug: webrtc:10180
Change-Id: I0fad188fa8cd424f831bac219769dbad3a788b1d
Reviewed-on: https://webrtc-review.googlesource.com/c/118041
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26316}
2019-01-18 11:31:43 +00:00
Sebastian Jansson
ecb6897ade Adds repeating task class.
This CL adds a single class to manage the use case of having a task
that repeats itself by a fixed or variable interval. It replaces the
repeating task previously locally defined for rtp transport controller
send as well as the cancelable periodic task. Furthermore, it is
introduced where one off repeating tasks were created before.

It provides the currently used functionality of the cancelable periodic
task, but not some of the unused features, such as allowing cancellation
of tasks before they are started and cancellation of a task after the
owning task queue has been destroyed.

Bug: webrtc:9883
Change-Id: Ifa7edee836c2a64fce16a7d0f682eb09c879eaca
Reviewed-on: https://webrtc-review.googlesource.com/c/116182
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26313}
2019-01-18 10:55:41 +00:00
Erik Språng
dbdd8395f7 Add ability for VideoEncoder to signal frame rate allocation.
This CL add new data to the VideoEncoder::EncoderInfo struct, indicating
how the encoder intends to allocate frames across spatial and temporal
layers.

This metadata will be used in upcoming CLs to control how the encoder's
rate controller performs.

Bug: webrtc:10155
Change-Id: Id56fae04bae5f230d1a985171097d7ca83a3be8a
Reviewed-on: https://webrtc-review.googlesource.com/c/117900
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26300}
2019-01-17 15:40:53 +00:00
Niels Möller
24871e4cbe Rename EncodedImage::_buffer --> buffer_, and make private
Bug: webrtc:9378
Change-Id: I0a0636077b270a7c73bafafb958132fa648aca70
Reviewed-on: https://webrtc-review.googlesource.com/c/117722
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26294}
2019-01-17 12:38:15 +00:00
Niels Möller
375b346b30 Delete all logic related to VCMDecodeErrorMode
Bug: webrtc:8064
Change-Id: I345f342a314d88390fff8b305b121076b45a51e8
Reviewed-on: https://webrtc-review.googlesource.com/c/116692
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26283}
2019-01-16 15:41:07 +00:00
Niels Möller
77536a2b81 Rename EncodedImage::_length --> size_, and make private.
Use size() accessor function. Also replace most nearby uses of _buffer
with data().

Bug: webrtc:9378
Change-Id: I1ac3459612f7c6151bd057d05448da1c4e1c6e3d
Reviewed-on: https://webrtc-review.googlesource.com/c/116783
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26273}
2019-01-16 07:40:47 +00:00
Mirta Dvornicic
ccc1b57e32 Poll is_hardware_accelerated from VideoEncoder instead of VideoEncoderFactory.
Currently, CPU overuse settings for HW encoders are sometimes being used
even though the actual encoder is a SW encoder, e.g. in case of SW fallback
when the encoder is initialized. Polling is_hardware_accelerated after the
encoder has been created and initialized will improve choosing the correct
CPU overuse settings.

Bug: webrtc:10065
Change-Id: Ic6bd67630a040b5a121c13fa63dd074006973929
Reviewed-on: https://webrtc-review.googlesource.com/c/116688
Commit-Queue: Mirta Dvornicic <mirtad@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26266}
2019-01-15 14:12:12 +00:00
Ilya Nikolaevskiy
173d198020 Revert "Ensure correct decoding for unfiltered KSVC streams"
This reverts commit cd7c21bfad.

Reason for revert: Regression in VP9 tests on perf bots

Original change's description:
> Ensure correct decoding for unfiltered KSVC streams
> 
> Set render timestamp for all frames in the superframe.
> 
> Bug: chromium:912122
> Change-Id: Ic9604620da9fb4176ad5c21b95df47fca8ddea31
> Reviewed-on: https://webrtc-review.googlesource.com/c/116985
> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26247}

TBR=ilnik@webrtc.org,philipel@webrtc.org

Change-Id: I2d137d36d343bc0204ab80edb3cd55a3f89bbc33
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:912122
Reviewed-on: https://webrtc-review.googlesource.com/c/117564
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26262}
2019-01-15 12:19:30 +00:00
Elad Alon
e4b5023f65 Avoid repeated semi-expensive field_trials read in frame_buffer2.cc
Bug: webrtc:10202
Change-Id: Ib8bfe7c1d62bc5091a8bfb2ce137ba749f9042e6
Reviewed-on: https://webrtc-review.googlesource.com/c/117361
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26261}
2019-01-15 12:12:01 +00:00
Ilya Nikolaevskiy
49ea47b90e Fix fuzzer identified crash in DecodeFramesHistory
Bug: chromium:921933,chromium:921935
Change-Id: I10f2a4783a717d9541bfc9f9bc0c76eaa2e62f30
Reviewed-on: https://webrtc-review.googlesource.com/c/117562
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26258}
2019-01-15 10:26:13 +00:00
Mirko Bonadei
ee0a85cee2 Roll //third_party/ffmpeg and disable H264 when MSVC is used.
FFmpeg hasn't been rolled since [1] in order to avoid to break MSVC
trybots (//third_party/ffmpeg dropped MSVC support, in theory it is
possible to bring the support back but some work is needed every time
//third_party/ffmpeg gets updated).

Not rolling //third_party/ffmpeg is not enough to keep the Chromium
Roll working because -Wstring-plus-int becomes more chatty with clang 350768
and it has been suppressed in //third_party/ffmpeg/BUILD.gn [2].

Since WebRTC needs to update clang, //third_party/ffmpeg needs to be
updated. The only way to do it without fixing MSVC errors in
//third_party/ffmpeg is to enforce rtc_use_h264=False when MSVC is used.

PSA: https://groups.google.com/forum/#!topic/discuss-webrtc/cfkPPq5nvNE.

[1] - https://webrtc-review.googlesource.com/78402
[2] - https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1376376

Bug: webrtc:9213
Change-Id: I36bd7fb2db21012760e4ff7a791d81350e402ec0
Reviewed-on: https://webrtc-review.googlesource.com/c/116982
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26257}
2019-01-15 10:25:01 +00:00
Ilya Nikolaevskiy
cd7c21bfad Ensure correct decoding for unfiltered KSVC streams
Set render timestamp for all frames in the superframe.

Bug: chromium:912122
Change-Id: Ic9604620da9fb4176ad5c21b95df47fca8ddea31
Reviewed-on: https://webrtc-review.googlesource.com/c/116985
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26247}
2019-01-14 16:06:38 +00:00
Ilya Nikolaevskiy
13717842df Introduce DecodedFramesHistory class and use it in FrameBuffer
This is a space efficient way to store more records about decoded frames,
which is needed for long term references.

Bug: webrtc:9710
Change-Id: I051d59d34a966d48db011142466d9cd15304b7d9
Reviewed-on: https://webrtc-review.googlesource.com/c/116792
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26240}
2019-01-14 13:09:39 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Niels Möller
6bb5ab9740 Reland "Refactor and remove media_optimization::MediaOptimization."
This reverts commit 6613f8e98a.

Reason for revert: This change seemed innocent after all, so undoing speculative revert.

Original change's description:
> Revert "Refactor and remove media_optimization::MediaOptimization."
> 
> This reverts commit 07276e4f89.
> 
> Reason for revert: Speculative revert due to downstream crashes.
> 
> Original change's description:
> > Refactor and remove media_optimization::MediaOptimization.
> > 
> > This CL removes MediaOptmization and folds some of its functionality
> > into VideoStreamEncoder.
> > 
> > The FPS tracking is now handled by a RateStatistics instance. Frame
> > dropping is still handled by FrameDropper. Both of these now live
> > directly in VideoStreamEncoder.
> > There is no intended change in behavior from this CL, but due to a new
> > way of measuring frame rate, some minor perf changes can be expected.
> > 
> > A small change in behavior is that OnBitrateUpdated is now called
> > directly rather than on the next frame. Since both encoding frame and
> > setting rate allocations happen on the encoder worker thread, there's
> > really no reason to cache bitrates and wait until the next frame.
> > An edge case though is that if a new bitrate is set before the first
> > frame, we must remember that bitrate and then apply it after the video
> > bitrate allocator has been first created.
> > 
> > In addition to existing unit tests, manual tests have been used to
> > confirm that frame dropping works as expected with misbehaving encoders.
> > 
> > Bug: webrtc:10164
> > Change-Id: I7ee9c8d3c4f2bcf23c8c420310b05a4d35d94744
> > Reviewed-on: https://webrtc-review.googlesource.com/c/115620
> > Commit-Queue: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26147}
> 
> TBR=nisse@webrtc.org,sprang@webrtc.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: webrtc:10164
> Change-Id: Ie0dae19dd012bc09e793c9661a45823fd760c20c
> Reviewed-on: https://webrtc-review.googlesource.com/c/116780
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26191}

TBR=nisse@webrtc.org,sprang@webrtc.org

Change-Id: Ieda1fad301de002460bb0bf5a75267ea065176a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10164
Reviewed-on: https://webrtc-review.googlesource.com/c/116960
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26213}
2019-01-11 10:46:33 +00:00
Niels Möller
9c843906ca Delete VCMEncodedFrame methods Buffer and MutableBuffer
Replaced by inherited method EncodedImage::data().

Bug: webrtc:9378
Change-Id: I4ec75148f578c72ffb407f9cbf6b4232cc9cfcf6
Reviewed-on: https://webrtc-review.googlesource.com/c/116962
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26212}
2019-01-11 10:10:12 +00:00
Ilya Nikolaevskiy
6551faf089 Refactor FrameBuffer to store decoded frames history separately
This will allow to increase the stored decoded frames history size and
optimize it to reduce memory consumption.

Bug: webrtc:9710
Change-Id: I82be0eb376c5d0b61ad5d754e6a37d606b4df29d
Reviewed-on: https://webrtc-review.googlesource.com/c/116686
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26200}
2019-01-10 15:11:15 +00:00
Elad Alon
69321ddfb5 Make FrameBuffer support an unlimited number of dependents per frame
Bug: webrtc:10190
Change-Id: I59680ec0dc05bc77dcbef50ddbb83ce2bcd91f7e
Reviewed-on: https://webrtc-review.googlesource.com/c/116788
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26196}
2019-01-10 14:36:47 +00:00
Niels Möller
977cd17316 Make VCMDecodeErrorMode optional when calling VideoCodingModule::SetReceiverRobustnessMode
This is a preparation for deleting other modes than
VCMDecodeErrorMode::kNoErrors.

Bug: webrtc:8064
Change-Id: I614f8012f306c5d59e72bdb851b582c286cdd130
Reviewed-on: https://webrtc-review.googlesource.com/c/116781
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26195}
2019-01-10 14:06:10 +00:00
Niels Möller
2874672671 Delete method VideoCodingModule::SetVideoProtection
Bug: webrtc:8064
Change-Id: I2a6ed11bf1415e4e0d199733f9d9a659afec0fe8
Reviewed-on: https://webrtc-review.googlesource.com/c/116689
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26194}
2019-01-10 13:32:07 +00:00
Niels Möller
6613f8e98a Revert "Refactor and remove media_optimization::MediaOptimization."
This reverts commit 07276e4f89.

Reason for revert: Speculative revert due to downstream crashes.

Original change's description:
> Refactor and remove media_optimization::MediaOptimization.
> 
> This CL removes MediaOptmization and folds some of its functionality
> into VideoStreamEncoder.
> 
> The FPS tracking is now handled by a RateStatistics instance. Frame
> dropping is still handled by FrameDropper. Both of these now live
> directly in VideoStreamEncoder.
> There is no intended change in behavior from this CL, but due to a new
> way of measuring frame rate, some minor perf changes can be expected.
> 
> A small change in behavior is that OnBitrateUpdated is now called
> directly rather than on the next frame. Since both encoding frame and
> setting rate allocations happen on the encoder worker thread, there's
> really no reason to cache bitrates and wait until the next frame.
> An edge case though is that if a new bitrate is set before the first
> frame, we must remember that bitrate and then apply it after the video
> bitrate allocator has been first created.
> 
> In addition to existing unit tests, manual tests have been used to
> confirm that frame dropping works as expected with misbehaving encoders.
> 
> Bug: webrtc:10164
> Change-Id: I7ee9c8d3c4f2bcf23c8c420310b05a4d35d94744
> Reviewed-on: https://webrtc-review.googlesource.com/c/115620
> Commit-Queue: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26147}

TBR=nisse@webrtc.org,sprang@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:10164
Change-Id: Ie0dae19dd012bc09e793c9661a45823fd760c20c
Reviewed-on: https://webrtc-review.googlesource.com/c/116780
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26191}
2019-01-10 11:39:24 +00:00
Åsa Persson
862025352b Minor changes to TestVideoReceiver.
Moved common code to helper method.

Bug: none
Change-Id: Iafae1a6e96c9d38cab8dd7d410d9f8717ee1ecb2
Reviewed-on: https://webrtc-review.googlesource.com/c/91862
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26185}
2019-01-10 08:15:28 +00:00
philipel
8b6995b3d4 Avoid creating frames with packets of different timestamps.
Bug: None
Change-Id: Ieca71f844d546c2e97b95131153913f138842acd
Reviewed-on: https://webrtc-review.googlesource.com/c/116680
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26176}
2019-01-09 12:19:05 +00:00
Steve Anton
40d55331d7 Include absl/memory/memory.h if absl::make_unique is used
Tbr: kwiberg@webrtc.org
Bug: None
Change-Id: Iaf4533d2ce0e80b351a8a664ef8cf7ba0e5ec583
Reviewed-on: https://webrtc-review.googlesource.com/c/115746
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Yves Gerey <yvesg@google.com>
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26168}
2019-01-08 20:08:32 +00:00
Sergey Silkin
d716fb9ecb Reland "Refactor rate profile update."
This is a reland of b6cdfdc165

Original change's description:
> Refactor rate profile update.
>
> RateProfile::frame_num specifies frame at which this rate profile
> should be applied.
>
> Bug: none
> Change-Id: I003ee43f44299a49d83f547558284817bfaeacc0
> Reviewed-on: https://webrtc-review.googlesource.com/c/115242
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Seth Hampson <shampson@webrtc.org>
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26080}

TBR=ilnik@webrtc.org,shampson@webrtc.org

Bug: none
Change-Id: I6ccbb32efe3d52c97e73e248ce5f06d672c9fba5
Reviewed-on: https://webrtc-review.googlesource.com/c/116286
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26155}
2019-01-08 10:35:42 +00:00
Sergey Silkin
08223c1576 Revert "Reland "Refactor rate profile update.""
This reverts commit 77aedaee69.

Reason for revert: breaks VideoCodecTestVideoToolbox tests.

Original change's description:
> Reland "Refactor rate profile update."
> 
> This is a reland of b6cdfdc165
> 
> Original change's description:
> > Refactor rate profile update.
> > 
> > RateProfile::frame_num specifies frame at which this rate profile
> > should be applied.
> > 
> > Bug: none
> > Change-Id: I003ee43f44299a49d83f547558284817bfaeacc0
> > Reviewed-on: https://webrtc-review.googlesource.com/c/115242
> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> > Reviewed-by: Seth Hampson <shampson@webrtc.org>
> > Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26080}
> 
> Bug: none
> Change-Id: I2604878d0bbee0f2182ad74e3cc29546310b76f3
> Reviewed-on: https://webrtc-review.googlesource.com/c/115401
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Seth Hampson <shampson@webrtc.org>
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26145}

TBR=ilnik@webrtc.org,shampson@webrtc.org,ssilkin@webrtc.org

Change-Id: Ib53eae70c380eefa303ddb01441f23e32f06b3ad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://webrtc-review.googlesource.com/c/116285
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26148}
2019-01-07 15:41:17 +00:00
Erik Språng
07276e4f89 Refactor and remove media_optimization::MediaOptimization.
This CL removes MediaOptmization and folds some of its functionality
into VideoStreamEncoder.

The FPS tracking is now handled by a RateStatistics instance. Frame
dropping is still handled by FrameDropper. Both of these now live
directly in VideoStreamEncoder.
There is no intended change in behavior from this CL, but due to a new
way of measuring frame rate, some minor perf changes can be expected.

A small change in behavior is that OnBitrateUpdated is now called
directly rather than on the next frame. Since both encoding frame and
setting rate allocations happen on the encoder worker thread, there's
really no reason to cache bitrates and wait until the next frame.
An edge case though is that if a new bitrate is set before the first
frame, we must remember that bitrate and then apply it after the video
bitrate allocator has been first created.

In addition to existing unit tests, manual tests have been used to
confirm that frame dropping works as expected with misbehaving encoders.

Bug: webrtc:10164
Change-Id: I7ee9c8d3c4f2bcf23c8c420310b05a4d35d94744
Reviewed-on: https://webrtc-review.googlesource.com/c/115620
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26147}
2019-01-07 14:58:23 +00:00
Sergey Silkin
77aedaee69 Reland "Refactor rate profile update."
This is a reland of b6cdfdc165

Original change's description:
> Refactor rate profile update.
> 
> RateProfile::frame_num specifies frame at which this rate profile
> should be applied.
> 
> Bug: none
> Change-Id: I003ee43f44299a49d83f547558284817bfaeacc0
> Reviewed-on: https://webrtc-review.googlesource.com/c/115242
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Seth Hampson <shampson@webrtc.org>
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26080}

Bug: none
Change-Id: I2604878d0bbee0f2182ad74e3cc29546310b76f3
Reviewed-on: https://webrtc-review.googlesource.com/c/115401
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26145}
2019-01-07 11:18:26 +00:00
Niels Möller
357c2b7b94 Delete unused method VideoSender::EnableFrameDropper.
Bug: None
Change-Id: I03558e4c6ed63b52d42a36d89bb4c89f8210e449
Reviewed-on: https://webrtc-review.googlesource.com/c/115418
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26144}
2019-01-07 09:35:40 +00:00
Artem Titov
1ebfb6aac7 Introduce VideoFrame::id to keep track of frames inside application.
Also switch webrtc code from deprecated constructors to the builder API.

Change-Id: Ie325bf1e9b4ff1e413fef3431ced8ed9ff725107
Bug: webrtc:10138
Reviewed-on: https://webrtc-review.googlesource.com/c/114422
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26132}
2019-01-04 08:59:26 +00:00
Sergey Silkin
a1f78a4fa6 Revert "Refactor rate profile update."
This reverts commit b6cdfdc165.

Reason for revert: breaks downstream projects

Original change's description:
> Refactor rate profile update.
> 
> RateProfile::frame_num specifies frame at which this rate profile
> should be applied.
> 
> Bug: none
> Change-Id: I003ee43f44299a49d83f547558284817bfaeacc0
> Reviewed-on: https://webrtc-review.googlesource.com/c/115242
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Seth Hampson <shampson@webrtc.org>
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26080}

TBR=ilnik@webrtc.org,shampson@webrtc.org,ssilkin@webrtc.org

Change-Id: I5957a0169841008436d1db70403d3694bf25d5cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://webrtc-review.googlesource.com/c/115400
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26081}
2018-12-21 09:05:01 +00:00
Sergey Silkin
b6cdfdc165 Refactor rate profile update.
RateProfile::frame_num specifies frame at which this rate profile
should be applied.

Bug: none
Change-Id: I003ee43f44299a49d83f547558284817bfaeacc0
Reviewed-on: https://webrtc-review.googlesource.com/c/115242
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26080}
2018-12-21 08:32:35 +00:00
Sergey Silkin
61832dd018 Propagate spatial index to EncodedImage.
Set spatial index of assembled VP9 picture equal to spatial index of
its top spatial layer frame.

Bug: webrtc:10151
Change-Id: Iae40505864b14b01cc6787f8da99a9e3fe283956
Reviewed-on: https://webrtc-review.googlesource.com/c/115280
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26075}
2018-12-20 15:21:22 +00:00
Johannes Kron
a1bec23f6c Pass on explicit color space for VP8 and H264
Bug: webtc:8651
Change-Id: I9d478e7123e915bff858d725d6008fcfeeb0779d
Reviewed-on: https://webrtc-review.googlesource.com/c/114424
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26044}
2018-12-18 12:32:03 +00:00
Niels Möller
0fcf4b1dbd Delete unused I420 "codec"
Previous attempt: https://codereview.webrtc.org/1882733006/. There
might be some benefit of having dummy encoder/decoder available in
video_loopback.

Bug: webrtc:5791
Change-Id: Iec316296754178c92b18dd3cf92f67ce6aed9439
Reviewed-on: https://webrtc-review.googlesource.com/c/112596
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26043}
2018-12-18 12:30:58 +00:00
Fredrik Solenberg
41f3a43c74 Remove CodecInst pt.3
Finally remove CodecInst from common_types.h, including remaining code referencing it.

TBR=kwiberg

Bug: webrtc:7626
Change-Id: I5e6b949ae9093641e33972af8438d1126fc48556
Reviewed-on: https://webrtc-review.googlesource.com/c/114546
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26036}
2018-12-18 07:42:21 +00:00
Niels Möller
194d4d20fb Delete unused send-side methods of VideoCodingModule
Bug: webrtc:8064
Change-Id: Icb7a452dfefce01ff59f6568b4766d609c2725bf
Reviewed-on: https://webrtc-review.googlesource.com/c/14900
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26023}
2018-12-17 08:26:12 +00:00
Johannes Kron
f1ab9b9b3b Refactor creation of ColorSpace test data
Bug: webrtc:8651
Change-Id: I2ebb5fcdc260af19d04513ab5f3d76f81a3b4ca9
Reviewed-on: https://webrtc-review.googlesource.com/c/114282
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26012}
2018-12-14 10:15:10 +00:00
Erik Språng
d96b275cd6 Refactor EncodeParameters usage, remove unused rtt/loss
Bug: webrtc:10126
Change-Id: Ib93f5e65b25540576c026197f72a5902cf43fc16
Reviewed-on: https://webrtc-review.googlesource.com/c/114281
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26001}
2018-12-13 12:15:09 +00:00
Jiawei Ou
aa7bc7e0bb Create field trial for vp8 number of thread on iOS.
Without the added preprocessor check, iOS device will be using the desktop logic to determine the number of thread. This put iPhone 8 and iPhone X to use 3 threads and all other iPhones after iPhone 5 to use a single thread.
This CL added a preprocessor for WEBRTC_IOS to have it own thread number calculation logic. In which, the maximum number of thread is fetched from a field_trial and capped by the number of CPU available on the device.

Bug: webrtc:10005
Change-Id: I8c6257fcbf85b07bc986b5f733dbabb3feee37f7
Reviewed-on: https://webrtc-review.googlesource.com/c/110941
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25997}
2018-12-13 07:35:59 +00:00
Niels Möller
1d8307d706 Delete VideoCodec::targetBitrate
This member is unused by encoders.

Bug: None
Change-Id: I867013bfdb89f48782e84842de05bb57648e0b64
Reviewed-on: https://webrtc-review.googlesource.com/c/113882
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25988}
2018-12-12 12:48:15 +00:00
Emircan Uysaler
7b3a568f6a Reland 2: Add VP9 Profile 2 to default profiles
This is a reland of 4c0cc5bc5f
I added more Chrome checks for munging profiles in the below patch
that will allow us to land this without regressions.
https://chromium-review.googlesource.com/c/chromium/src/+/1366898

Original change's description:
> Reland Profile 2 to default profiles
>
> This is a reland after chrome browser tests are updated.
>
> Bug: webrtc:9376
> Change-Id: I818bf5d447da7901ffe49f2c452decb89196e829
> TBR: niklas.enbom@webrtc.org
> Reviewed-on: https://webrtc-review.googlesource.com/c/112060
> Reviewed-by: Emircan Uysaler <emircan@webrtc.org>
> Commit-Queue: Emircan Uysaler <emircan@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25778}

Bug: webrtc:9376
Change-Id: I8998537816a773961e519535c6afdde3801b5918
TBR: niklas.enbom@webrtc.org
Reviewed-on: https://webrtc-review.googlesource.com/c/113980
Commit-Queue: Emircan Uysaler <emircan@webrtc.org>
Reviewed-by: Emircan Uysaler <emircan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25977}
2018-12-11 23:38:26 +00:00
Elad Alon
f04feee41e Remove redundant return-statement in VCMGenericEncoder::RequestFrame
Bug: None
Change-Id: I0da8747729ec309a37146397d6bc1f32bf22c329
Reviewed-on: https://webrtc-review.googlesource.com/c/113660
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25947}
2018-12-10 13:54:39 +00:00
Sergey Silkin
8b9b5f98db Activate/deactivate VP9 spatial layers.
* Stop encoding spatial layers S(n >= N) if application deactivates
spatial layer N by setting RTCRtpEncodingParameters.active = false.

* Move calculation of padding bitrate to SvcRateAllocator class.

* Pad up to minimum required bitrate of base layer if ALR probing is
enabled.

Bug: webrtc:9350
Change-Id: I398284c943d43348def535c83263fc234c9767fa
Reviewed-on: https://webrtc-review.googlesource.com/c/113240
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25945}
2018-12-10 12:55:51 +00:00
Johannes Kron
b47ccc38e7 Add chroma siting to ColorSpace
Bug: webrtc:8651
Change-Id: I82263e8b6cdcc3ebf699f5e3ebbde04e46982efb
Reviewed-on: https://webrtc-review.googlesource.com/c/113424
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25944}
2018-12-10 11:19:35 +00:00
Ilya Nikolaevskiy
4348ce240a Calculate min and max receive timestamps for packets in a video frame
Bug: webrtc:10106
Change-Id: I1d3469abb1e7bb7c91a5912d7b781505526abaca
Reviewed-on: https://webrtc-review.googlesource.com/c/113507
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25935}
2018-12-07 16:22:34 +00:00
Niels Möller
48a79465ec Convert all webrtc code to not access EncodedImage::_size directly.
Read using capacity() method, write using set_buffer() method. This is
a preparation for making the member private, and renaming it to
capacity_.

Bug: webrtc:9378
Change-Id: I2f96679d052a83fe81be40301bd9863c87074640
Reviewed-on: https://webrtc-review.googlesource.com/c/113520
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25934}
2018-12-07 16:19:34 +00:00
Benjamin Wright
3f10ca8145 Always record receive timestamps even on when the invalid flag is set.
This change is based on a discussion for integrating a new statistic that
measures the delay between the first frame being received and the first frame
being decoded. To enable this in the context of FrameEncryption it makes sense
for packet receive timestamps to be unconditionally recorded.

Bug: webrtc:10105
Change-Id: I6b3b0118121db1fe5d4a4fb16cf5d94341cd2b1b
Reviewed-on: https://webrtc-review.googlesource.com/c/113487
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25931}
2018-12-07 12:29:45 +00:00
Ilya Nikolaevskiy
5546aef682 Vp9 flexible mode fixes
- Enable vp9 flexible mode in VideoEngine if 3 spatial layers are set.
- Enable flexible mode in loopback tools and quality tests.
- Reset first active spatial layer on keyframe in encoder.
- Ensure duplicate references are not set by the sender in video header.
- Set references manually for flexible mode in vp9 encoder.
- Delay new activated layers until next base layer frame.
- On receive side put each spatial layer as a separate frame to FrameBuffer
  and return several frames combined from FrameBuffer.

Bug: webrtc:10049,webrtc:9794,webrtc:9784
Change-Id: I01e69f134cc145deba666ccc92deb1d37a324ede
Reviewed-on: https://webrtc-review.googlesource.com/c/112289
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25895}
2018-12-04 15:36:28 +00:00
Niels Möller
ebad1770ab Include event_wrapper.h only where used.
It's currently used only by the VCMJitterBuffer and VCMReceiver
classes. Injection is needed by the VCMReceiverTimingTest test, which
defines a subclass(!) of EventWrapper.

Bug: webrtc:3380
Change-Id: I765be0ceac58e941928319cc426ba49f1cbdc5fa
Reviewed-on: https://webrtc-review.googlesource.com/c/113002
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25893}
2018-12-04 14:50:18 +00:00