Skip to content
Snippets Groups Projects
Commit 72768049 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Tristan Matthews
Browse files

video: require SDP custom_io support

Refs #61482

Change-Id: I5dbde5b6f423ec535a27e6451112993aaa4d61e7
parent 66748e5f
No related branches found
No related tags found
No related merge requests found
...@@ -354,7 +354,7 @@ AS_IF([test "x$enable_video" != "xno"], ...@@ -354,7 +354,7 @@ AS_IF([test "x$enable_video" != "xno"],
PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files])) PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS" LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 53.2.0,, AC_MSG_ERROR([Missing libavformat development files])) PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 54.20.3,, AC_MSG_ERROR([Missing libavformat development files]))
PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files])) PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))
......
...@@ -110,7 +110,8 @@ ifndef HAVE_ANDROID ...@@ -110,7 +110,8 @@ ifndef HAVE_ANDROID
PKGS += libav PKGS += libav
endif endif
endif endif
ifeq ($(call need_pkg,"libavcodec >= 53.5.0 libavformat >= 53.2.0 libswscale libavdevice >= 53.0.0 libavutil >= 51.0.0"),)
ifeq ($(call need_pkg,"libavcodec >= 53.5.0 libavformat >= 54.20.3 libswscale libavdevice >= 53.0.0 libavutil >= 51.0.0"),)
PKGS_FOUND += libav PKGS_FOUND += libav
endif endif
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
(LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
#define HAVE_SDP_CUSTOM_IO LIBAVFORMAT_VERSION_CHECK(54,20,3,59,103)
extern "C" { extern "C" {
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
...@@ -75,6 +73,10 @@ extern "C" { ...@@ -75,6 +73,10 @@ extern "C" {
#include "libav_utils.h" #include "libav_utils.h"
#if !LIBAVFORMAT_VERSION_CHECK(54,20,3,59,103)
#error "Used libavformat doesn't support sdp custom_io"
#endif
#if !LIBAVUTIL_VERSION_CHECK(51, 42, 0, 74, 100) && !defined(FF_API_PIX_FMT) #if !LIBAVUTIL_VERSION_CHECK(51, 42, 0, 74, 100) && !defined(FF_API_PIX_FMT)
#define AVPixelFormat PixelFormat #define AVPixelFormat PixelFormat
#define PIXEL_FORMAT(FMT) PIX_FMT_ ## FMT #define PIXEL_FORMAT(FMT) PIX_FMT_ ## FMT
......
...@@ -118,7 +118,6 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port) ...@@ -118,7 +118,6 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port)
memcpy(addr, res->ai_addr, res->ai_addrlen); memcpy(addr, res->ai_addr, res->ai_addrlen);
*addr_len = res->ai_addrlen; *addr_len = res->ai_addrlen;
#if HAVE_SDP_CUSTOM_IO
// bind socket so that we send from and receive // bind socket so that we send from and receive
// on local port // on local port
if (bind(udp_fd, reinterpret_cast<sockaddr*>(addr), *addr_len) < 0) { if (bind(udp_fd, reinterpret_cast<sockaddr*>(addr), *addr_len) < 0) {
...@@ -127,7 +126,6 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port) ...@@ -127,7 +126,6 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port)
close(udp_fd); close(udp_fd);
udp_fd = -1; udp_fd = -1;
} }
#endif
freeaddrinfo(res0); freeaddrinfo(res0);
...@@ -180,14 +178,7 @@ void SocketPair::openSockets(const char *uri, int local_rtp_port) ...@@ -180,14 +178,7 @@ void SocketPair::openSockets(const char *uri, int local_rtp_port)
sizeof(path)); sizeof(path));
const int rtcp_port = rtp_port + 1; const int rtcp_port = rtp_port + 1;
#if HAVE_SDP_CUSTOM_IO
const int local_rtcp_port = local_rtp_port + 1; const int local_rtcp_port = local_rtp_port + 1;
#else
SFL_WARN("libavformat too old for socket reuse, using random source ports");
local_rtp_port = 0;
const int local_rtcp_port = 0;
#endif
sockaddr_storage rtp_addr, rtcp_addr; sockaddr_storage rtp_addr, rtcp_addr;
socklen_t rtp_len, rtcp_len; socklen_t rtp_len, rtcp_len;
......
...@@ -78,9 +78,7 @@ VideoDecoder::setOptions(const std::map<std::string, std::string>& options) ...@@ -78,9 +78,7 @@ VideoDecoder::setOptions(const std::map<std::string, std::string>& options)
extract(options, "video_size"); extract(options, "video_size");
extract(options, "channel"); extract(options, "channel");
extract(options, "loop"); extract(options, "loop");
#if HAVE_SDP_CUSTOM_IO
extract(options, "sdp_flags"); extract(options, "sdp_flags");
#endif
} }
int VideoDecoder::openInput(const std::string &source_str, int VideoDecoder::openInput(const std::string &source_str,
......
...@@ -102,12 +102,9 @@ bool VideoReceiveThread::setup() ...@@ -102,12 +102,9 @@ bool VideoReceiveThread::setup()
videoDecoder_->setInterruptCallback(interruptCb, this); videoDecoder_->setInterruptCallback(interruptCb, this);
if (input == SDP_FILENAME) { if (input == SDP_FILENAME) {
#if HAVE_SDP_CUSTOM_IO // Force custom_io so the SDP demuxer will not open any UDP connections
// custom_io so the SDP demuxer will not open any UDP connections // We need it to use ICE transport.
args_["sdp_flags"] = "custom_io"; args_["sdp_flags"] = "custom_io";
#else
SFL_WARN("libavformat too old for custom SDP demuxing");
#endif
EXIT_IF_FAIL(not stream_.str().empty(), "No SDP loaded"); EXIT_IF_FAIL(not stream_.str().empty(), "No SDP loaded");
videoDecoder_->setIOContext(&sdpContext_); videoDecoder_->setIOContext(&sdpContext_);
...@@ -119,10 +116,8 @@ bool VideoReceiveThread::setup() ...@@ -119,10 +116,8 @@ bool VideoReceiveThread::setup()
"Could not open input \"%s\"", input.c_str()); "Could not open input \"%s\"", input.c_str());
if (input == SDP_FILENAME) { if (input == SDP_FILENAME) {
#if HAVE_SDP_CUSTOM_IO
// Now replace our custom AVIOContext with one that will read packets // Now replace our custom AVIOContext with one that will read packets
videoDecoder_->setIOContext(demuxContext_); videoDecoder_->setIOContext(demuxContext_);
#endif
} }
// FIXME: this is a hack because our peer sends us RTP before // FIXME: this is a hack because our peer sends us RTP before
...@@ -182,9 +177,7 @@ int VideoReceiveThread::readFunction(void *opaque, uint8_t *buf, int buf_size) ...@@ -182,9 +177,7 @@ int VideoReceiveThread::readFunction(void *opaque, uint8_t *buf, int buf_size)
void VideoReceiveThread::addIOContext(SocketPair &socketPair) void VideoReceiveThread::addIOContext(SocketPair &socketPair)
{ {
#if HAVE_SDP_CUSTOM_IO
demuxContext_ = socketPair.createIOContext(); demuxContext_ = socketPair.createIOContext();
#endif
} }
bool VideoReceiveThread::decodeFrame() bool VideoReceiveThread::decodeFrame()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment