...
 
Commits (21)
language:
- cpp
- python
# This config file for Travis CI utilizes ros-industrial/industrial_ci package.
# For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst
dist: trusty
sudo: required
services:
- docker
language: generic
python:
- "2.7"
compiler:
- gcc
notifications:
email:
on_success: always
on_failure: always
env:
matrix:
- ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true
- ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0
matrix:
allow_failures:
- env: ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0
branches:
only:
- master
- develop
install:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install python-catkin-pkg python-rosdep ros-hydro-catkin ros-hydro-catkin -qq
- sudo rosdep init
- rosdep update
- mkdir -p /tmp/ws/src
- ln -s `pwd` /tmp/ws/src/package
- cd /tmp/ws/src
- git clone https://github.com/WPI-RAIL/async_web_server_cpp.git
- cd /tmp/ws
- rosdep install --from-paths src --ignore-src --rosdistro hydro -y
- git clone https://github.com/ros-industrial/industrial_ci.git .ci_config
script:
- source /opt/ros/hydro/setup.bash
- catkin_make
- catkin_make install
- source .ci_config/travis.sh
......@@ -2,6 +2,29 @@
Changelog for package web_video_server
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.0.7 (2017-11-20)
------------------
* Ffmpeg 3 (`#43 <https://github.com/RobotWebTools/web_video_server/issues/43>`_)
* Correct use of deprecated parameters
codec_context\_->rc_buffer_aggressivity marked as "currently useless", so removed
codec_context\_->frame_skip_threshold access through new priv_data api
* New names for pixel formats
* AVPicture is deprecated, use AVFrame
* Switch to non-deprecated free functions
* Use new encoding api for newer versions
* codec_context is deprecated, use packet flags
* Update travis configuration to test against kinetic (`#44 <https://github.com/RobotWebTools/web_video_server/issues/44>`_)
* fixed misuse of remove_if (`#35 <https://github.com/RobotWebTools/web_video_server/issues/35>`_)
* Merge pull request `#33 <https://github.com/RobotWebTools/web_video_server/issues/33>`_ from achim-k/patch-1
web_video_server: fix bool function not returning
This fix is required when compiling the package with `clang`. Otherwise a SIGILL (Illegal instruction) is triggered.
* Contributors: Hans-Joachim Krauch, Jan, Jihoon Lee, russelhowe
0.0.6 (2017-01-17)
------------------
* Fixed topic list to display all image topics, fixing Issue `#18 <https://github.com/RobotWebTools/web_video_server/issues/18>`_.
* Contributors: Eric
0.0.5 (2016-10-13)
------------------
* Merge pull request `#23 <https://github.com/RobotWebTools/web_video_server/issues/23>`_ from iki-wgt/develop
......
......@@ -15,6 +15,7 @@ extern "C"
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
#include <libavutil/mathematics.h>
#include <libavutil/imgutils.h>
}
namespace web_video_server
......@@ -43,7 +44,6 @@ protected:
private:
AVFrame* frame_;
AVFrame* bgr_frame_;
struct SwsContext* sws_context_;
ros::Time first_image_timestamp_;
boost::mutex encode_mutex_;
......@@ -51,6 +51,10 @@ private:
std::string format_name_;
std::string codec_name_;
std::string content_type_;
int bitrate_;
int qmin_;
int qmax_;
int gop_;
uint8_t* io_buffer_; // custom IO buffer
};
......
<?xml version="1.0"?>
<package>
<name>web_video_server</name>
<version>0.0.5</version>
<version>0.0.7</version>
<description>HTTP Streaming of ROS Image Topics in Multiple Formats</description>
<maintainer email="rctoris@wpi.edu">Russell Toris</maintainer>
......
......@@ -11,7 +11,7 @@ H264Streamer::H264Streamer(const async_web_server_cpp::HttpRequest& request,
* ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
* no latency improvements observed with ultrafast instead of medium
*/
preset_ = request.get_query_param_value_or_default("preset", "medium");
preset_ = request.get_query_param_value_or_default("preset", "ultrafast");
}
H264Streamer::~H264Streamer()
......@@ -22,6 +22,10 @@ void H264Streamer::initializeEncoder()
{
av_opt_set(codec_context_->priv_data, "preset", preset_.c_str(), 0);
av_opt_set(codec_context_->priv_data, "tune", "zerolatency", 0);
av_opt_set_int(codec_context_->priv_data, "crf", 20, 0);
av_opt_set_int(codec_context_->priv_data, "bufsize", 100, 0);
av_opt_set_int(codec_context_->priv_data, "keyint", 30, 0);
av_opt_set_int(codec_context_->priv_data, "g", 1, 0);
// container format options
if (!strcmp(format_context_->oformat->name, "mp4")) {
......
This diff is collapsed.
......@@ -43,11 +43,7 @@ Vp8Streamer::Vp8Streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle& nh) :
LibavStreamer(request, connection, nh, "webm", "libvpx", "video/webm")
{
quality_ = request.get_query_param_value_or_default("quality", "realtime"); // no observable difference to "good"
bitrate_ = request.get_query_param_value_or_default<int>("bitrate", 100000);
qmin_ = request.get_query_param_value_or_default<int>("qmin", -1);
qmax_ = request.get_query_param_value_or_default<int>("qmax", -1);
gop_ = request.get_query_param_value_or_default<int>("gop", -1);
quality_ = request.get_query_param_value_or_default("quality", "realtime");
}
Vp8Streamer::~Vp8Streamer()
{
......@@ -55,21 +51,6 @@ Vp8Streamer::~Vp8Streamer()
void Vp8Streamer::initializeEncoder()
{
// Codec options
av_opt_set(codec_context_->priv_data, "end-usage", "cbr", 0); // cbr sliiightly faster (maybe) than vbr and cq
av_opt_set_int(codec_context_->priv_data, "cpu-used", 4, 0); // higher means less cpu load, lower quality and lower latency (no difference for 4+)
codec_context_->bit_rate = bitrate_;
if (gop_ != -1)
codec_context_->gop_size = gop_;
//codec_context_->max_b_frames = 0;
// Quality settings
if (qmin_ != -1)
codec_context_->qmin = qmin_;
if (qmax_ != -1)
codec_context_->qmax = qmax_;
// Advanced codec tuning (TODO: the following does not seem to have any effect)
typedef std::map<std::string, std::string> AvOptMap;
AvOptMap av_opt_map;
av_opt_map["quality"] = quality_;
......@@ -92,8 +73,7 @@ void Vp8Streamer::initializeEncoder()
av_opt_set_int(codec_context_->priv_data, "bufsize", bufsize, 0);
av_opt_set_int(codec_context_->priv_data, "buf-initial", bufsize, 0);
av_opt_set_int(codec_context_->priv_data, "buf-optimal", bufsize, 0);
codec_context_->rc_buffer_aggressivity = 0.5; // TODO: deprecated
codec_context_->frame_skip_threshold = 10;
av_opt_set_int(codec_context_->priv_data, "skip_threshold", 10, 0);
}
Vp8StreamerType::Vp8StreamerType() :
......
......@@ -14,13 +14,13 @@ Vp9Streamer::~Vp9Streamer()
void Vp9Streamer::initializeEncoder()
{
// codec options set up to provide somehow reasonable performance in cost of poor quality
// should be updated as soon as VP9 encoding matures
av_opt_set_int(codec_context_->priv_data, "pass", 1, 0);
av_opt_set_int(codec_context_->priv_data, "speed", 8, 0);
av_opt_set_int(codec_context_->priv_data, "cpu-used", 8, 0); // 8 is max
codec_context_->bit_rate = 0; // variable bitrate
av_opt_set_int(codec_context_->priv_data, "crf", 59, 0); // 0..63 (higher is lower quality)
av_opt_set_int(codec_context_->priv_data, "cpu-used", 4, 0); // 8 is max
av_opt_set_int(codec_context_->priv_data, "crf", 20, 0); // 0..63 (higher is lower quality)
}
Vp9StreamerType::Vp9StreamerType() :
......
......@@ -30,11 +30,14 @@ static bool ros_connection_logger(async_web_server_cpp::HttpServerRequestHandler
try
{
forward(request, connection, begin, end);
return true;
}
catch (std::exception &e)
{
ROS_WARN_STREAM("Error Handling Request: " << e.what());
return false;
}
return false;
}
WebVideoServer::WebVideoServer(ros::NodeHandle &nh, ros::NodeHandle &private_nh) :
......@@ -98,8 +101,8 @@ void WebVideoServer::cleanup_inactive_streams()
if (lock)
{
typedef std::vector<boost::shared_ptr<ImageStreamer> >::iterator itr_type;
itr_type new_end = std::remove_if(image_subscribers_.begin(), image_subscribers_.end(),
boost::bind(&ImageStreamer::isInactive, _1));
itr_type new_end = std::partition(image_subscribers_.begin(), image_subscribers_.end(),
!boost::bind(&ImageStreamer::isInactive, _1));
if (__verbose)
{
for (itr_type itr = new_end; itr < image_subscribers_.end(); ++itr)
......