aws-robotics / kinesisvideo-encoder-common

ROS packages for facilitating the use of AWS cloud services.
GNU Lesser General Public License v2.1
9 stars 12 forks source link

Backoff to software encoding if codec isn't available #35

Closed ryanewel closed 5 years ago

ryanewel commented 5 years ago

Signed-off-by: Ryan Newell ryanewel@amazon.com

Issue #, if available: Related to https://github.com/aws-robotics/kinesisvideo-encoder-common/issues/2 and implements suggestion 1 from https://github.com/aws-robotics/kinesisvideo-encoder-common/issues/23 Description of changes: Tries to open the hardware codec before deciding if it's available.

This change was manually tested on a raspberry Pi 3B+ running Ubuntu Mate 18.04 armhf.

Tested the following cases:

  1. Specified a valid codec (hevc_amf) that wasn't installed on the raspberry Pi. It correctly switched to software encoding
  2. Specified a valid codec that was on the raspberry Pi, but ffmpeg was incorrectly configured so that it couldn't be used. The node correctly switched to software encoding
  3. Specified a valid codec that was on the raspberry Pi and ffmpeg was configured to use. The node correctly used hardware encoding.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 5 years ago

Codecov Report

Merging #35 into master will increase coverage by 2.31%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
+ Coverage   76.41%   78.72%   +2.31%     
==========================================
  Files           3        3              
  Lines         195      188       -7     
==========================================
- Hits          149      148       -1     
+ Misses         46       40       -6
Flag Coverage Δ
#ROS_1 78.72% <100%> (+7.07%) :arrow_up:
#ROS_2 78.6% <100%> (+2.32%) :arrow_up:
#dashing 78.6% <100%> (+2.32%) :arrow_up:
#kinetic 74.33% <11.11%> (+2.68%) :arrow_up:
#melodic 78.6% <100%> (?)
Impacted Files Coverage Δ
h264_encoder_core/src/h264_encoder.cpp 84.84% <100%> (+2.87%) :arrow_up:

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 973f91d...38b5fb4. Read the comment docs.

mm318 commented 5 years ago

Ideally, I would like us to not call avcodec_open2() more times than necessary.

AAlon commented 5 years ago

Could you increment the version in package.xml to 2.0.3? Thanks! Edit: actually we already incremented to 2.0.2 without releasing, so no need.