...
 
Commits (11)
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,24 @@
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>`_.
......
......@@ -43,6 +43,8 @@ add_executable(${PROJECT_NAME}
src/image_streamer.cpp
src/libav_streamer.cpp
src/vp8_streamer.cpp
src/h264_streamer.cpp
src/vp9_streamer.cpp
src/multipart_stream.cpp
src/ros_compressed_streamer.cpp
src/jpeg_streamers.cpp)
......
#ifndef H264_STREAMERS_H_
#define H264_STREAMERS_H_
#include <image_transport/image_transport.h>
#include "web_video_server/libav_streamer.h"
#include "async_web_server_cpp/http_request.hpp"
#include "async_web_server_cpp/http_connection.hpp"
namespace web_video_server
{
class H264Streamer : public LibavStreamer
{
public:
H264Streamer(const async_web_server_cpp::HttpRequest& request, async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh);
~H264Streamer();
protected:
virtual void initializeEncoder();
std::string preset_;
};
class H264StreamerType : public LibavStreamerType
{
public:
H264StreamerType();
virtual boost::shared_ptr<ImageStreamer> create_streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh);
};
}
#endif
......@@ -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
......@@ -39,10 +40,10 @@ protected:
AVCodecContext* codec_context_;
AVStream* video_stream_;
AVDictionary* opt_; // container format options
private:
AVFrame* frame_;
AVPicture* picture_;
AVPicture* tmp_picture_;
struct SwsContext* sws_context_;
ros::Time first_image_timestamp_;
boost::mutex encode_mutex_;
......@@ -54,6 +55,8 @@ private:
int qmin_;
int qmax_;
int gop_;
uint8_t* io_buffer_; // custom IO buffer
};
class LibavStreamerType : public ImageStreamerType
......
#ifndef VP9_STREAMERS_H_
#define VP9_STREAMERS_H_
#include <image_transport/image_transport.h>
#include "web_video_server/libav_streamer.h"
#include "async_web_server_cpp/http_request.hpp"
#include "async_web_server_cpp/http_connection.hpp"
namespace web_video_server
{
class Vp9Streamer : public LibavStreamer
{
public:
Vp9Streamer(const async_web_server_cpp::HttpRequest& request, async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh);
~Vp9Streamer();
protected:
virtual void initializeEncoder();
};
class Vp9StreamerType : public LibavStreamerType
{
public:
Vp9StreamerType();
virtual boost::shared_ptr<ImageStreamer> create_streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh);
};
}
#endif
<?xml version="1.0"?>
<package>
<name>web_video_server</name>
<version>0.0.6</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>
......
#include "web_video_server/h264_streamer.h"
namespace web_video_server
{
H264Streamer::H264Streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle& nh) :
LibavStreamer(request, connection, nh, "mp4", "libx264", "video/mp4")
{
/* possible quality presets:
* 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", "ultrafast");
}
H264Streamer::~H264Streamer()
{
}
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")) {
// set up mp4 for streaming (instead of seekable file output)
av_dict_set(&opt_, "movflags", "+frag_keyframe+empty_moov+faststart", 0);
}
}
H264StreamerType::H264StreamerType() :
LibavStreamerType("mp4", "libx264", "video/mp4")
{
}
boost::shared_ptr<ImageStreamer> H264StreamerType::create_streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh)
{
return boost::shared_ptr<ImageStreamer>(new H264Streamer(request, connection, nh));
}
}
This diff is collapsed.
......@@ -73,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;
codec_context_->frame_skip_threshold = 10;
av_opt_set_int(codec_context_->priv_data, "skip_threshold", 10, 0);
}
Vp8StreamerType::Vp8StreamerType() :
......
#include "web_video_server/vp9_streamer.h"
namespace web_video_server
{
Vp9Streamer::Vp9Streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle& nh) :
LibavStreamer(request, connection, nh, "webm", "libvpx-vp9", "video/webm")
{
}
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", 4, 0); // 8 is max
av_opt_set_int(codec_context_->priv_data, "crf", 20, 0); // 0..63 (higher is lower quality)
}
Vp9StreamerType::Vp9StreamerType() :
LibavStreamerType("webm", "libvpx-vp9", "video/webm")
{
}
boost::shared_ptr<ImageStreamer> Vp9StreamerType::create_streamer(const async_web_server_cpp::HttpRequest& request,
async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh)
{
return boost::shared_ptr<ImageStreamer>(new Vp9Streamer(request, connection, nh));
}
}
......@@ -9,6 +9,8 @@
#include "web_video_server/ros_compressed_streamer.h"
#include "web_video_server/jpeg_streamers.h"
#include "web_video_server/vp8_streamer.h"
#include "web_video_server/h264_streamer.h"
#include "web_video_server/vp9_streamer.h"
#include "async_web_server_cpp/http_reply.hpp"
namespace web_video_server
......@@ -57,6 +59,8 @@ WebVideoServer::WebVideoServer(ros::NodeHandle &nh, ros::NodeHandle &private_nh)
stream_types_["mjpeg"] = boost::shared_ptr<ImageStreamerType>(new MjpegStreamerType());
stream_types_["ros_compressed"] = boost::shared_ptr<ImageStreamerType>(new RosCompressedStreamerType());
stream_types_["vp8"] = boost::shared_ptr<ImageStreamerType>(new Vp8StreamerType());
stream_types_["h264"] = boost::shared_ptr<ImageStreamerType>(new H264StreamerType());
stream_types_["vp9"] = boost::shared_ptr<ImageStreamerType>(new Vp9StreamerType());
handler_group_.addHandlerForPath("/", boost::bind(&WebVideoServer::handle_list_streams, this, _1, _2, _3, _4));
handler_group_.addHandlerForPath("/stream", boost::bind(&WebVideoServer::handle_stream, this, _1, _2, _3, _4));
......