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

Issue 2741953002: Step #4: Run VideoProcessor integration test batch mode on task queue. (Closed)

Created:
3 years, 9 months ago by brandtr
Modified:
3 years, 4 months ago
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, zhengzhonghou_agora.io, video-team_agora.io, stefan-webrtc, mflodman, srte
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Run VideoProcessor integration test batch mode on task queue. Since the AndroidMediaEncoder nowadays must be run on a task queue, this CL changes the batch mode (which is always used for HW codecs) to call the VideoProcessor on a task queue. Further, it changes the PlotVideoProcessorIntegrationTest to be parameterized over codec implementation. BUG=webrtc:6634

Patch Set 1 #

Patch Set 2 : Nits. #

Patch Set 3 : Depend on base:rtc_task_queue. #

Patch Set 4 : Rebase. #

Total comments: 6

Patch Set 5 : Rebase. #

Patch Set 6 : Rebase. #

Patch Set 7 : Rebase. #

Patch Set 8 : Rebase. #

Patch Set 9 : tommi comments 1: Add thread safety annotations. #

Total comments: 12

Patch Set 10 : Post callbacks on task queue, if needed. #

Patch Set 11 : sprang comments 1. #

Patch Set 12 : Fix gn. #

Total comments: 10

Patch Set 13 : Clean up usage of FrameInfos. #

Patch Set 14 : Rebase this old CL. #

Patch Set 15 : Rebased and reworked. #

Patch Set 16 : Fixes. #

Patch Set 17 : Fix gn again. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+399 lines, -165 lines) Patch
M webrtc/modules/video_coding/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +4 lines, -0 lines 0 comments Download
M webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +12 lines, -10 lines 0 comments Download
M webrtc/modules/video_coding/codecs/test/videoprocessor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 chunks +132 lines, -62 lines 0 comments Download
M webrtc/modules/video_coding/codecs/test/videoprocessor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10 chunks +41 lines, -12 lines 0 comments Download
M webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 chunks +124 lines, -32 lines 0 comments Download
M webrtc/modules/video_coding/codecs/test/videoprocessor_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +86 lines, -49 lines 0 comments Download

Messages

Total messages: 19 (3 generated)
brandtr
Rebase.
3 years, 9 months ago (2017-03-10 09:44:48 UTC) #2
brandtr
With this CL, we can finally run the PlotVideoProcessor tests on Android HW codecs. iOS ...
3 years, 9 months ago (2017-03-10 09:50:55 UTC) #3
brandtr
This time with reviewers.... == With this CL, we can finally run the PlotVideoProcessor tests ...
3 years, 9 months ago (2017-03-10 09:51:19 UTC) #5
tommi
drive by suggestion https://codereview.webrtc.org/2741953002/diff/60001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc File webrtc/modules/video_coding/codecs/test/videoprocessor.cc (right): https://codereview.webrtc.org/2741953002/diff/60001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc#newcode209 webrtc/modules/video_coding/codecs/test/videoprocessor.cc:209: encoder_->RegisterEncodeCompleteCallback(nullptr); On 2017/03/10 09:50:54, brandtr wrote: ...
3 years, 9 months ago (2017-03-10 09:57:12 UTC) #6
brandtr
On 2017/03/10 09:57:12, tommi (webrtc) wrote: > drive by suggestion > > https://codereview.webrtc.org/2741953002/diff/60001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc > File ...
3 years, 9 months ago (2017-03-10 10:14:30 UTC) #7
brandtr
Rebase.
3 years, 9 months ago (2017-03-10 12:23:04 UTC) #8
brandtr
Rebase.
3 years, 9 months ago (2017-03-10 15:22:13 UTC) #9
brandtr
Rebase.
3 years, 9 months ago (2017-03-13 08:49:03 UTC) #10
brandtr
Rebase.
3 years, 9 months ago (2017-03-17 13:46:52 UTC) #11
sprang_webrtc
https://codereview.webrtc.org/2741953002/diff/160001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc File webrtc/modules/video_coding/codecs/test/videoprocessor.cc (right): https://codereview.webrtc.org/2741953002/diff/160001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc#newcode163 webrtc/modules/video_coding/codecs/test/videoprocessor.cc:163: VideoProcessorImpl::~VideoProcessorImpl() = default; nit: Could you declare ~VideoProcessor and ...
3 years, 9 months ago (2017-03-20 19:36:17 UTC) #12
brandtr
Addressed tommi and sprang comments 1. tommi: Would you mind taking a second look on ...
3 years, 9 months ago (2017-03-21 09:40:54 UTC) #14
tommi
https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc File webrtc/modules/video_coding/codecs/test/videoprocessor.cc (right): https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_coding/codecs/test/videoprocessor.cc#newcode214 webrtc/modules/video_coding/codecs/test/videoprocessor.cc:214: RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_); if DeregisterCallbacks() is always followed by deleting the ...
3 years, 9 months ago (2017-03-21 10:03:27 UTC) #15
brandtr
Clean up usage of FrameInfos.
3 years, 9 months ago (2017-03-27 11:17:38 UTC) #16
brandtr
Fixes.
3 years, 5 months ago (2017-06-28 07:34:52 UTC) #17
brandtr
Fix gn again.
3 years, 5 months ago (2017-06-28 07:47:23 UTC) #18
brandtr
3 years, 5 months ago (2017-06-28 09:40:25 UTC) #19
Rebased and updated. Please take a look again :)

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
File webrtc/modules/video_coding/codecs/test/videoprocessor.cc (right):

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
webrtc/modules/video_coding/codecs/test/videoprocessor.cc:214:
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
On 2017/03/21 10:03:27, tommi (webrtc) wrote:
> if DeregisterCallbacks() is always followed by deleting the object, we could
> just merge the two and post a task to delete the object on the task queue.

The calling of Deinit() is not directly followed by the destruction, and that's
why it's useful to have this separate method.

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
webrtc/modules/video_coding/codecs/test/videoprocessor.cc:318:
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
On 2017/03/21 10:03:27, tommi (webrtc) wrote:
> nit: keep these checks at the top of each function for consistency. same
below.

Done.

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
File webrtc/modules/video_coding/codecs/test/videoprocessor.h (right):

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
webrtc/modules/video_coding/codecs/test/videoprocessor.h:142: virtual void
DeregisterCallbacks() = 0;
On 2017/03/21 10:03:27, tommi (webrtc) wrote:
> Add documentation?
> (e.g. if there is a condition that must be met before calling this method,
what
> callbacks are unregistered, if there's a post condition such as no other
methods
> should be called etc).
> 
> If DeregisterCallbacks matches with Init(), then it would be good to call that
> out and even change the name to something like Term, Terminate or
> Uninitialize().  Having said that - could all the work done in Init() be done
in
> the constructor?

Documentation added. Semantics and name have changed to better match the
::Release() semantics of the underlying encoder.

The work done in Init() could be done in the ctor, but the work done in
Release() could not be done in the dtor. The reason for the latter being that we
want to ensure that the encoding/decoding is completely done (i.e., no lingering
frames anywhere) when we access the state of |this|, at the end of a measurement
run.

I'm keeping Init/Release this way, as it matches how we init and release the
codecs.

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
webrtc/modules/video_coding/codecs/test/videoprocessor.h:217:
task_queue_(rtc::TaskQueue::Current()) {}
On 2017/03/21 10:03:27, tommi (webrtc) wrote:
> if task_queue_ should never be null, please DCHECK that in the ctor so that we
> catch the error as early as possible

|task_queue_| can be null when the VideoProcessor is operated on a "normal"
thread. This happens in the SW codec tests on the bots, but not in the manual HW
codec tests on device.

The next step should be to split up these tests, so we don't have to make this
distinction.

https://codereview.webrtc.org/2741953002/diff/220001/webrtc/modules/video_cod...
webrtc/modules/video_coding/codecs/test/videoprocessor.h:225: if (task_queue_ &&
!task_queue_->IsCurrent()) {
On 2017/03/21 10:03:27, tommi (webrtc) wrote:
> it feels to me that the class has too many ways of operating.  I'd prefer to
> either require a task queue or not. If it requires a task queue, we should
never
> need to check if task_queue_ is null.  It would also be good to either never
> have to Post or always, inside this function.  If OnEncodedImage is always
> called outside the task queue, we shouldn't have to check if it is, etc.
Rather
> DCHECK the expected condition.

I agree that it is messy. The underlying reason is our lack of guarantees for
what thread is being used for the codec callbacks. This is currently my
impression of how things are implemented:

Encoders
==
- SW VP8 calls OnEncodedImage synchronously (+)
- Android MediaCodec calls OnEncodedImage from a recurring task running on an
external task queue
- iOS VideoToolbox calls OnEncodedImage from an internal GCD task queue (*)

Decoders
==
- SW VP8 calls Decoded synchronously (+)
- Android MediaCodec calls Decoded from an internal thread (*)
- iOS VideoToolbox calls Decoded from an internal GCD task queue (*)

For the cases marked by (+), this class is not created on a task queue, and the
callbacks are directly forwarded. For the cases marked by (*), this class is
created on a task queue but the callbacks are arriving on some other thread, so
this class posts the callbacks on the correct task queue. For the final case
(Android encode), the callback is arriving on the same task queue as the class
was created on, so it is directly forwarded.

By splitting up the bot tests from the manual tests, I might be able to clean
this up and require the VideoProcessor to run on a task queue at all times.

Powered by Google App Engine
This is Rietveld 408576698