Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video encoder timing test #110

Merged
merged 9 commits into from
Oct 29, 2020
Merged

Conversation

jennuine
Copy link
Contributor

Test that verifies video encoder timing, which uses VideoEncoder to encode several frames to a video file and verifies the duration using the Video class with a new Duration() function.

@jennuine jennuine requested review from mjcarroll and iche033 October 28, 2020 16:21
@codecov
Copy link

codecov bot commented Oct 28, 2020

Codecov Report

Merging #110 into video_encoder_timing will increase coverage by 1.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                   Coverage Diff                    @@
##           video_encoder_timing     #110      +/-   ##
========================================================
+ Coverage                 73.90%   75.20%   +1.29%     
========================================================
  Files                        69       69              
  Lines                      9427     9429       +2     
========================================================
+ Hits                       6967     7091     +124     
+ Misses                     2460     2338     -122     
Impacted Files Coverage Δ
av/src/Video.cc 53.39% <100.00%> (+53.39%) ⬆️
av/src/VideoEncoder.cc 71.94% <0.00%> (+24.82%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6eeff9c...67db98b. Read the comment docs.

jennuine and others added 6 commits October 28, 2020 11:52
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
@jennuine jennuine force-pushed the encoder_timing_test branch from 797aa0e to 4a8a4b4 Compare October 28, 2020 18:52
av/src/Video.cc Outdated Show resolved Hide resolved
test/integration/encoder_timing.cc Outdated Show resolved Hide resolved
test/integration/encoder_timing.cc Outdated Show resolved Hide resolved
@mjcarroll
Copy link
Contributor

I believe that the Windows failure here is somewhat expected, being that av wasn't currently being built. The integration test needs to be dependent on that component being successfully built.

Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
durationTest(vidEncoder, video, 30, 2);
durationTest(vidEncoder, video, 25, 5);

delete [] kFrame;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you either want to:

a) Allocate and deallocate this frame completely within the test, and pass it to duration test.
b) Allocate the deallocate the frame globally and don't do any memory management in the test.

Mixing the two could potentially make it easy to introduce bugs if more tests are ever added here.

Since this is also an array, you may consider using std::array<unsigned char, kSize*kSize>, or a std::vector to not have to deal with memory allocation at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. Better? 39ccc6a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just looks like you need to include <array> to make MacOS happy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 67db98b. Is there a way to check things like this beforehand?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes codecheck can catch it. There are some explicit tools that will do it as well such as: https://include-what-you-use.org/

In this case it's generally good practice to do, but some compilers are a bit more picky about it. There are many cases where an extra iteration or two may be spent appeasing Windows or Mac...

Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
@mjcarroll mjcarroll merged commit f59b60a into video_encoder_timing Oct 29, 2020
@mjcarroll mjcarroll deleted the encoder_timing_test branch October 29, 2020 20:04
mjcarroll pushed a commit that referenced this pull request Oct 29, 2020
Test that verifies video encoder timing, which uses VideoEncoder to encode several frames to a video file and verifies the duration using the Video class with a new Duration() function.

Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>
@peci1 peci1 mentioned this pull request Oct 30, 2020
iche033 added a commit that referenced this pull request Nov 16, 2020
* fix frame number in video encoding

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* encode duplicate frames to ensure continuous pts

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* fix resetting video recording

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* Video encoder timing test (#110)

Test that verifies video encoder timing, which uses VideoEncoder to encode several frames to a video file and verifies the duration using the Video class with a new Duration() function.

Signed-off-by: Jenn Nguyen <jenn@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>

* Little fixes for video encoder (#115)

* VideoEncoder: Reset also timePrev and timeStart.

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>

* Do not skip the very first frame in case the first timestamp should really be zero.

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>

* Disable AV integration test when component not available (#124)

This disables an integration test that depends on the `av` component when that component is not build.  This is currently the case on Windows where the `ffmpeg` dependencies are not in the buildfarm.

Signed-off-by: Michael Carroll <michael@openrobotics.org>

Co-authored-by: Jenn Nguyen <jenn@openrobotics.org>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: Louise Poubel <louise@openrobotics.org>
Co-authored-by: Martin Pecka <peckama2@fel.cvut.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants