Re: [FFmpeg-devel] [PATCH] avdevice/decklink: add support for selecting devices based on their unique ID
On 9/21/18 3:35 AM, Marton Balint wrote: > Also bump the API version requirement to 10.9.5, because on olders versions > there were some reports of crashes using the undocumented, yet available > BMDDeckLinkDeviceHandle. If we are using an undocumented API feature, then there is a higher risk of this feature not working in some future versions of DeckLink drivers as well. I would suggest using this undocumented API call under an 'if' condition, which is controlled by a command line option for selecting based on unique ID. In that way setups which prefers stability can choose to not use this feature. > > Signed-off-by: Marton Balint > --- > configure | 2 +- > doc/indevs.texi | 3 ++- > doc/outdevs.texi| 3 ++- > libavdevice/decklink_common.cpp | 59 > - > libavdevice/decklink_common.h | 1 - > 5 files changed, 45 insertions(+), 23 deletions(-) > > diff --git a/configure b/configure > index 25120337de..64a519a8b3 100755 > --- a/configure > +++ b/configure > @@ -6043,7 +6043,7 @@ done > enabled cuda_sdk && require cuda_sdk cuda.h cuCtxCreate -lcuda > enabled chromaprint && require chromaprint chromaprint.h > chromaprint_get_version -lchromaprint > enabled decklink && { require_headers DeckLinkAPI.h && > - { test_cpp_condition DeckLinkAPIVersion.h > "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API > version must be >= 10.6.1."; } } > + { test_cpp_condition DeckLinkAPIVersion.h > "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API > version must be >= 10.9.5."; } } > enabled libndi_newtek && require_headers Processing.NDI.Lib.h > enabled frei0r&& require_headers frei0r.h > enabled gmp && require gmp gmp.h mpz_export -lgmp > diff --git a/doc/indevs.texi b/doc/indevs.texi > index 5d4c02c597..ed2784be9f 100644 > --- a/doc/indevs.texi > +++ b/doc/indevs.texi > @@ -267,7 +267,8 @@ audio track. > > @item list_devices > If set to @option{true}, print a list of devices and exit. > -Defaults to @option{false}. > +Defaults to @option{false}. Alternatively you can use the @code{-sources} > +option of ffmpeg to list the available input devices. > > @item list_formats > If set to @option{true}, print a list of supported formats and exit. > diff --git a/doc/outdevs.texi b/doc/outdevs.texi > index 34c508a970..2518f9b559 100644 > --- a/doc/outdevs.texi > +++ b/doc/outdevs.texi > @@ -140,7 +140,8 @@ device with @command{-list_formats 1}. Audio sample rate > is always 48 kHz. > > @item list_devices > If set to @option{true}, print a list of devices and exit. > -Defaults to @option{false}. > +Defaults to @option{false}. Alternatively you can use the @code{-sinks} > +option of ffmpeg to list the available output devices. > > @item list_formats > If set to @option{true}, print a list of supported formats and exit. > diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp > index 503417bb35..b88d6c6219 100644 > --- a/libavdevice/decklink_common.cpp > +++ b/libavdevice/decklink_common.cpp > @@ -77,15 +77,25 @@ static IDeckLinkIterator > *decklink_create_iterator(AVFormatContext *avctx) > return iter; > } > > -HRESULT ff_decklink_get_display_name(IDeckLink *This, const char > **displayName) > +int decklink_get_attr_string(IDeckLink *dl, BMDDeckLinkAttributeID cfg_id, > const char **s) > { > -DECKLINK_STR tmpDisplayName; > -HRESULT hr = This->GetDisplayName(); > -if (hr != S_OK) > -return hr; > -*displayName = DECKLINK_STRDUP(tmpDisplayName); > -DECKLINK_FREE(tmpDisplayName); > -return hr; > +DECKLINK_STR tmp; > +HRESULT hr; > +IDeckLinkAttributes *attr; > +*s = NULL; > +if (dl->QueryInterface(IID_IDeckLinkAttributes, (void **)) != S_OK) > +return AVERROR_EXTERNAL; > +hr = attr->GetString(cfg_id, ); > +attr->Release(); > +if (hr == S_OK) { > +*s = DECKLINK_STRDUP(tmp); > +DECKLINK_FREE(tmp); > +if (!*s) > +return AVERROR(ENOMEM); > +} else if (hr == E_FAIL) { > +return AVERROR_EXTERNAL; > +} > +return 0; > } > > static int decklink_select_input(AVFormatContext *avctx, > BMDDeckLinkConfigurationID cfg_id) > @@ -276,11 +286,17 @@ int ff_decklink_list_devices(AVFormatContext *avctx, > while (ret == 0 && iter->Next() == S_OK) { > IDeckLinkOutput *output_config; > IDeckLinkInput *input_config; > -const char *displayName; > +const char *display_name = NULL; > +const char *unique_name = NULL; > AVDeviceInfo *new_device = NULL; > int add = 0; > > -ff_decklink_get_display_name(dl, ); > +ret = decklink_get_attr_string(dl, BMDDeckLinkDisplayName, > _name); > +if (ret < 0) > +goto
Re: [FFmpeg-devel] [PATCH] libavcodec/vp8dec: fix the multi-thread HWAccel decode error
On Thu, 2018-08-09 at 15:09 +0800, Jun Zhao wrote: > the root cause is update_dimentions call get_pixel_format will Typo? s/dimentions/dimensions. And I see the same typo a few times in this log. > trigger the hwaccel_uninit/hwaccel_init , in current context, What is the decode error? Could you document the error a little or a link to the issue? > there are 3 situations in the update_dimentions(): > 1. First time calling. No matter single thread or multithread, >get_pixel_format() should be called after dimentions were >set; > 2. Dimention changed at the runtime. Dimention need to be >updated when macroblocks_base is already allocated, According to the code, ff_set_dimensions is called to overwrite previously setup dimensions when height is changed no matter s->macroblocks_base is allocated or not. I think the HW frames and context should be re-created as well for this case But I am curious why height and width are treated differently in this condition: if (width != s->avctx->width || ((width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) && s->macroblocks_base || height != s->avctx->height) { ... ff_set_dimensions(...); } The condition for updating dimensions is simple in VP9: if (!(s->pix_fmt == s->gf_fmt && w == s->w && h == s->h)) { ff_set_dimensions(...); ... } >get_pixel_format() should be called to recreate new frames >according to updated dimention; > 3. Multithread first time calling. After decoder init, the >other threads will call update_dimentions() at first time >to allocate macroblocks_base and set dimentions. >But get_pixel_format() is shouldn't be called due to low >level frames and context are already created. > In this fix, we only call update_dimentions as need. > > Signed-off-by: Wang, Shaofei > Reviewed-by: Jun, Zhao > --- > libavcodec/vp8.c |7 +-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > index 3adfeac..18d1ada 100644 > --- a/libavcodec/vp8.c > +++ b/libavcodec/vp8.c > @@ -187,7 +187,7 @@ static av_always_inline > int update_dimensions(VP8Context *s, int width, int height, int is_vp7) > { > AVCodecContext *avctx = s->avctx; > -int i, ret; > +int i, ret, dim_reset = 0; > > if (width != s->avctx->width || ((width+15)/16 != s->mb_width || > (height+15)/16 != s->mb_height) && s->macroblocks_base || > height != s->avctx->height) { > @@ -196,9 +196,12 @@ int update_dimensions(VP8Context *s, int width, int > height, int is_vp7) > ret = ff_set_dimensions(s->avctx, width, height); > if (ret < 0) > return ret; > + > +dim_reset = (s->macroblocks_base != NULL); > } > > -if (!s->actually_webp && !is_vp7) { > +if ((s->pix_fmt == AV_PIX_FMT_NONE || dim_reset) && > + !s->actually_webp && !is_vp7) { > s->pix_fmt = get_pixel_format(s); > if (s->pix_fmt < 0) > return AVERROR(EINVAL); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avdevice/decklink: add support for selecting devices based on their unique ID
Also bump the API version requirement to 10.9.5, because on olders versions there were some reports of crashes using the undocumented, yet available BMDDeckLinkDeviceHandle. Signed-off-by: Marton Balint --- configure | 2 +- doc/indevs.texi | 3 ++- doc/outdevs.texi| 3 ++- libavdevice/decklink_common.cpp | 59 - libavdevice/decklink_common.h | 1 - 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 25120337de..64a519a8b3 100755 --- a/configure +++ b/configure @@ -6043,7 +6043,7 @@ done enabled cuda_sdk && require cuda_sdk cuda.h cuCtxCreate -lcuda enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && - { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } } + { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } } enabled libndi_newtek && require_headers Processing.NDI.Lib.h enabled frei0r&& require_headers frei0r.h enabled gmp && require gmp gmp.h mpz_export -lgmp diff --git a/doc/indevs.texi b/doc/indevs.texi index 5d4c02c597..ed2784be9f 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -267,7 +267,8 @@ audio track. @item list_devices If set to @option{true}, print a list of devices and exit. -Defaults to @option{false}. +Defaults to @option{false}. Alternatively you can use the @code{-sources} +option of ffmpeg to list the available input devices. @item list_formats If set to @option{true}, print a list of supported formats and exit. diff --git a/doc/outdevs.texi b/doc/outdevs.texi index 34c508a970..2518f9b559 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -140,7 +140,8 @@ device with @command{-list_formats 1}. Audio sample rate is always 48 kHz. @item list_devices If set to @option{true}, print a list of devices and exit. -Defaults to @option{false}. +Defaults to @option{false}. Alternatively you can use the @code{-sinks} +option of ffmpeg to list the available output devices. @item list_formats If set to @option{true}, print a list of supported formats and exit. diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 503417bb35..b88d6c6219 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -77,15 +77,25 @@ static IDeckLinkIterator *decklink_create_iterator(AVFormatContext *avctx) return iter; } -HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName) +int decklink_get_attr_string(IDeckLink *dl, BMDDeckLinkAttributeID cfg_id, const char **s) { -DECKLINK_STR tmpDisplayName; -HRESULT hr = This->GetDisplayName(); -if (hr != S_OK) -return hr; -*displayName = DECKLINK_STRDUP(tmpDisplayName); -DECKLINK_FREE(tmpDisplayName); -return hr; +DECKLINK_STR tmp; +HRESULT hr; +IDeckLinkAttributes *attr; +*s = NULL; +if (dl->QueryInterface(IID_IDeckLinkAttributes, (void **)) != S_OK) +return AVERROR_EXTERNAL; +hr = attr->GetString(cfg_id, ); +attr->Release(); +if (hr == S_OK) { +*s = DECKLINK_STRDUP(tmp); +DECKLINK_FREE(tmp); +if (!*s) +return AVERROR(ENOMEM); +} else if (hr == E_FAIL) { +return AVERROR_EXTERNAL; +} +return 0; } static int decklink_select_input(AVFormatContext *avctx, BMDDeckLinkConfigurationID cfg_id) @@ -276,11 +286,17 @@ int ff_decklink_list_devices(AVFormatContext *avctx, while (ret == 0 && iter->Next() == S_OK) { IDeckLinkOutput *output_config; IDeckLinkInput *input_config; -const char *displayName; +const char *display_name = NULL; +const char *unique_name = NULL; AVDeviceInfo *new_device = NULL; int add = 0; -ff_decklink_get_display_name(dl, ); +ret = decklink_get_attr_string(dl, BMDDeckLinkDisplayName, _name); +if (ret < 0) +goto next; +ret = decklink_get_attr_string(dl, BMDDeckLinkDeviceHandle, _name); +if (ret < 0) +goto next; if (show_outputs) { if (dl->QueryInterface(IID_IDeckLinkOutput, (void **)_config) == S_OK) { @@ -303,8 +319,8 @@ int ff_decklink_list_devices(AVFormatContext *avctx, goto next; } -new_device->device_name = av_strdup(displayName); -new_device->device_description = av_strdup(displayName); +new_device->device_name = av_strdup(unique_name ? unique_name : display_name); +new_device->device_description = av_strdup(display_name);
[FFmpeg-devel] [PATCH 2/4] avformat/udp: use factorized ip functions
Signed-off-by: Marton Balint --- libavformat/Makefile | 4 +- libavformat/udp.c| 123 +-- 2 files changed, 23 insertions(+), 104 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index ccb39b5469..467ae2d87e 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -609,8 +609,8 @@ TLS-OBJS-$(CONFIG_OPENSSL) += tls_openssl.o TLS-OBJS-$(CONFIG_SECURETRANSPORT) += tls_securetransport.o TLS-OBJS-$(CONFIG_SCHANNEL) += tls_schannel.o OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o $(TLS-OBJS-yes) -OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o -OBJS-$(CONFIG_UDPLITE_PROTOCOL) += udp.o +OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o ip.o +OBJS-$(CONFIG_UDPLITE_PROTOCOL) += udp.o ip.o OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o # external library protocols diff --git a/libavformat/udp.c b/libavformat/udp.c index bbdeda05fe..3c413a2a05 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -41,6 +41,7 @@ #include "network.h" #include "os_support.h" #include "url.h" +#include "ip.h" #ifdef __APPLE__ #include "TargetConditionals.h" @@ -109,6 +110,7 @@ typedef struct UDPContext { struct sockaddr_storage local_addr_storage; char *sources; char *block; +IPSourceFilters filters; } UDPContext; #define OFFSET(x) offsetof(UDPContext, x) @@ -236,39 +238,9 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr,struct so return 0; } -static struct addrinfo *udp_resolve_host(URLContext *h, - const char *hostname, int port, - int type, int family, int flags) -{ -struct addrinfo hints = { 0 }, *res = 0; -int error; -char sport[16]; -const char *node = 0, *service = "0"; - -if (port > 0) { -snprintf(sport, sizeof(sport), "%d", port); -service = sport; -} -if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) { -node = hostname; -} -hints.ai_socktype = type; -hints.ai_family = family; -hints.ai_flags = flags; -if ((error = getaddrinfo(node, service, , ))) { -res = NULL; -av_log(h, AV_LOG_ERROR, "getaddrinfo(%s, %s): %s\n", - node ? node : "unknown", - service, - gai_strerror(error)); -} - -return res; -} - static int udp_set_multicast_sources(URLContext *h, int sockfd, struct sockaddr *addr, - int addr_len, char **sources, + int addr_len, struct sockaddr_storage *sources, int nb_sources, int include) { #if HAVE_STRUCT_GROUP_SOURCE_REQ && defined(MCAST_BLOCK_SOURCE) && !defined(_WIN32) && (!defined(TARGET_OS_TV) || !TARGET_OS_TV) @@ -278,16 +250,10 @@ static int udp_set_multicast_sources(URLContext *h, for (i = 0; i < nb_sources; i++) { struct group_source_req mreqs; int level = addr->sa_family == AF_INET ? IPPROTO_IP : IPPROTO_IPV6; -struct addrinfo *sourceaddr = udp_resolve_host(h, sources[i], 0, - SOCK_DGRAM, AF_UNSPEC, - 0); -if (!sourceaddr) -return AVERROR(ENOENT); mreqs.gsr_interface = 0; memcpy(_group, addr, addr_len); -memcpy(_source, sourceaddr->ai_addr, sourceaddr->ai_addrlen); -freeaddrinfo(sourceaddr); +memcpy(_source, [i], sizeof(*sources)); if (setsockopt(sockfd, level, include ? MCAST_JOIN_SOURCE_GROUP : MCAST_BLOCK_SOURCE, @@ -308,22 +274,14 @@ static int udp_set_multicast_sources(URLContext *h, } for (i = 0; i < nb_sources; i++) { struct ip_mreq_source mreqs; -struct addrinfo *sourceaddr = udp_resolve_host(h, sources[i], 0, - SOCK_DGRAM, AF_UNSPEC, - 0); -if (!sourceaddr) -return AVERROR(ENOENT); -if (sourceaddr->ai_addr->sa_family != AF_INET) { -freeaddrinfo(sourceaddr); -av_log(NULL, AV_LOG_ERROR, "%s is of incorrect protocol family\n", - sources[i]); +if (sources[i].ss_family != AF_INET) { +av_log(NULL, AV_LOG_ERROR, "Source/block address %d is of incorrect protocol family\n", i + 1); return AVERROR(EINVAL); } mreqs.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr; mreqs.imr_interface.s_addr = INADDR_ANY; -mreqs.imr_sourceaddr.s_addr = ((struct sockaddr_in *)sourceaddr->ai_addr)->sin_addr.s_addr; -freeaddrinfo(sourceaddr); +mreqs.imr_sourceaddr.s_addr = ((struct sockaddr_in
[FFmpeg-devel] [PATCH 1/4] avformat/ip: factorize some IP filtering and resolving functions to a new file
These are based on the very similar UDP and RTP protocol functions. Signed-off-by: Marton Balint --- libavformat/ip.c | 165 +++ libavformat/ip.h | 70 +++ 2 files changed, 235 insertions(+) create mode 100644 libavformat/ip.c create mode 100644 libavformat/ip.h diff --git a/libavformat/ip.c b/libavformat/ip.c new file mode 100644 index 00..ec8cf283dd --- /dev/null +++ b/libavformat/ip.c @@ -0,0 +1,165 @@ +/* + * IP common code + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software * Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "ip.h" + +static int compare_addr(const struct sockaddr_storage *a, +const struct sockaddr_storage *b) +{ +if (a->ss_family != b->ss_family) +return 1; +if (a->ss_family == AF_INET) { +return (((const struct sockaddr_in *)a)->sin_addr.s_addr != +((const struct sockaddr_in *)b)->sin_addr.s_addr); +} + +#if HAVE_STRUCT_SOCKADDR_IN6 +if (a->ss_family == AF_INET6) { +const uint8_t *s6_addr_a = ((const struct sockaddr_in6 *)a)->sin6_addr.s6_addr; +const uint8_t *s6_addr_b = ((const struct sockaddr_in6 *)b)->sin6_addr.s6_addr; +return memcmp(s6_addr_a, s6_addr_b, 16); +} +#endif +return 1; +} + +int ff_ip_check_source_lists(struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s) +{ +int i; +if (s->nb_exclude_addrs) { +for (i = 0; i < s->nb_exclude_addrs; i++) { +if (!compare_addr(source_addr_ptr, >exclude_addrs[i])) +return 1; +} +} +if (s->nb_include_addrs) { +for (i = 0; i < s->nb_include_addrs; i++) { +if (!compare_addr(source_addr_ptr, >include_addrs[i])) +return 0; +} +return 1; +} +return 0; +} + +struct addrinfo *ff_ip_resolve_host(void *log_ctx, +const char *hostname, int port, +int type, int family, int flags) +{ +struct addrinfo hints = { 0 }, *res = 0; +int error; +char sport[16]; +const char *node = 0, *service = "0"; + +if (port > 0) { +snprintf(sport, sizeof(sport), "%d", port); +service = sport; +} +if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) { +node = hostname; +} +hints.ai_socktype = type; +hints.ai_family = family; +hints.ai_flags= flags; +if ((error = getaddrinfo(node, service, , ))) { +res = NULL; +av_log(log_ctx, AV_LOG_ERROR, "getaddrinfo(%s, %s): %s\n", + node ? node : "unknown", + service, + gai_strerror(error)); +} + +return res; +} + + +static int ip_parse_addr_list(void *log_ctx, char *buf, + struct sockaddr_storage **address_list_ptr, + int *address_list_size_ptr) +{ +struct addrinfo *ai = NULL; +char tmp = '\0', *p = buf, *next; + +/* Resolve all of the IPs */ + +while (p && p[0]) { +next = strchr(p, ','); + +if (next) { +tmp = *next; +*next = '\0'; +} + +ai = ff_ip_resolve_host(log_ctx, p, 0, SOCK_DGRAM, AF_UNSPEC, 0); +if (!ai) +return AVERROR(EINVAL); + +if (next) { +*next = tmp; +p = next + 1; +} else { +p = NULL; +} + +if (ai) { +struct sockaddr_storage source_addr = {0}; +memcpy(_addr, ai->ai_addr, ai->ai_addrlen); +freeaddrinfo(ai); +av_dynarray2_add((void **)address_list_ptr, address_list_size_ptr, sizeof(source_addr), (uint8_t *)_addr); +if (!*address_list_ptr) +return AVERROR(ENOMEM); +} +} + +return 0; +} + +static int ip_parse_sources_and_blocks(void *log_ctx, char *buf, IPSourceFilters *filters, int parse_include_list) +{ +int ret; +if (parse_include_list) +ret = ip_parse_addr_list(log_ctx, buf, >include_addrs, >nb_include_addrs); +else +ret = ip_parse_addr_list(log_ctx, buf, >exclude_addrs, >nb_exclude_addrs); + +if (ret >= 0 && filters->nb_include_addrs &&
[FFmpeg-devel] [PATCH 4/4] avformat/udp: add support for generic source filtering
This allows getting data only from a specific source IP. This is useful not only for unicast but for multicast as well because multicast source subscriptions do not act as source filters for the incoming packets. Signed-off-by: Marton Balint --- doc/protocols.texi | 8 libavformat/udp.c | 17 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index fad6c44c24..7173bb173a 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1569,12 +1569,12 @@ For receiving, this gives the benefit of only receiving packets from the specified peer address/port. @item sources=@var{address}[,@var{address}] -Only receive packets sent to the multicast group from one of the -specified sender IP addresses. +Only receive packets sent from the specified addresses. In case of multicast, +also subscribe to multicast traffic coming from these addresses only. @item block=@var{address}[,@var{address}] -Ignore packets sent to the multicast group from the specified -sender IP addresses. +Ignore packets sent from the specified addresses. In case of multicast, also +exclude the source addresses in the multicast subscription. @item fifo_size=@var{units} Set the UDP receiving circular buffer size, expressed as a number of diff --git a/libavformat/udp.c b/libavformat/udp.c index 3c413a2a05..2c82769b90 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -458,13 +458,15 @@ static void *circular_buffer_task_rx( void *_URLContext) } while(1) { int len; +struct sockaddr_storage addr; +socklen_t addr_len; pthread_mutex_unlock(>mutex); /* Blocking operations are always cancellation points; see "General Information" / "Thread Cancelation Overview" in Single Unix. */ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, _cancelstate); -len = recv(s->udp_fd, s->tmp+4, sizeof(s->tmp)-4, 0); +len = recvfrom(s->udp_fd, s->tmp+4, sizeof(s->tmp)-4, 0, (struct sockaddr *), _len); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, _cancelstate); pthread_mutex_lock(>mutex); if (len < 0) { @@ -474,6 +476,8 @@ static void *circular_buffer_task_rx( void *_URLContext) } continue; } +if (ff_ip_check_source_lists(, >filters)) +continue; AV_WL32(s->tmp, len); if(av_fifo_space(s->fifo) < len + 4) { @@ -926,6 +930,8 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) { UDPContext *s = h->priv_data; int ret; +struct sockaddr_storage addr; +socklen_t addr_len; #if HAVE_PTHREAD_CANCEL int avail, nonblock = h->flags & AVIO_FLAG_NONBLOCK; @@ -976,9 +982,12 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) if (ret < 0) return ret; } -ret = recv(s->udp_fd, buf, size, 0); - -return ret < 0 ? ff_neterrno() : ret; +ret = recvfrom(s->udp_fd, buf, size, 0, (struct sockaddr *), _len); +if (ret < 0) +return ff_neterrno(); +if (ff_ip_check_source_lists(, >filters)) +return AVERROR(EINTR); +return ret; } static int udp_write(URLContext *h, const uint8_t *buf, int size) -- 2.16.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] avformat/rtpproto: use factorized ip functions
Signed-off-by: Marton Balint --- libavformat/Makefile | 2 +- libavformat/rtpproto.c | 126 - 2 files changed, 11 insertions(+), 117 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 467ae2d87e..e0222535c1 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -596,7 +596,7 @@ OBJS-$(CONFIG_RTMPS_PROTOCOL)+= rtmpproto.o rtmpdigest.o rtmppkt.o OBJS-$(CONFIG_RTMPT_PROTOCOL)+= rtmpproto.o rtmpdigest.o rtmppkt.o OBJS-$(CONFIG_RTMPTE_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o OBJS-$(CONFIG_RTMPTS_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o -OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o +OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o ip.o OBJS-$(CONFIG_SCTP_PROTOCOL) += sctp.o OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o OBJS-$(CONFIG_SUBFILE_PROTOCOL) += subfile.o diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index c01d9cea18..9ffd89ce49 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -32,6 +32,7 @@ #include "rtp.h" #include "rtpproto.h" #include "url.h" +#include "ip.h" #include #include "internal.h" @@ -45,8 +46,8 @@ typedef struct RTPContext { const AVClass *class; URLContext *rtp_hd, *rtcp_hd, *fec_hd; -int rtp_fd, rtcp_fd, nb_ssm_include_addrs, nb_ssm_exclude_addrs; -struct sockaddr_storage **ssm_include_addrs, **ssm_exclude_addrs; +int rtp_fd, rtcp_fd; +IPSourceFilters filters; int write_to_source; struct sockaddr_storage last_rtp_source, last_rtcp_source; socklen_t last_rtp_source_len, last_rtcp_source_len; @@ -126,45 +127,6 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri) return 0; } -static struct addrinfo* rtp_resolve_host(const char *hostname, int port, - int type, int family, int flags) -{ -struct addrinfo hints = { 0 }, *res = 0; -int error; -char service[16]; - -snprintf(service, sizeof(service), "%d", port); -hints.ai_socktype = type; -hints.ai_family = family; -hints.ai_flags= flags; -if ((error = getaddrinfo(hostname, service, , ))) { -res = NULL; -av_log(NULL, AV_LOG_ERROR, "rtp_resolve_host: %s\n", gai_strerror(error)); -} - -return res; -} - -static int compare_addr(const struct sockaddr_storage *a, -const struct sockaddr_storage *b) -{ -if (a->ss_family != b->ss_family) -return 1; -if (a->ss_family == AF_INET) { -return (((const struct sockaddr_in *)a)->sin_addr.s_addr != -((const struct sockaddr_in *)b)->sin_addr.s_addr); -} - -#if HAVE_STRUCT_SOCKADDR_IN6 -if (a->ss_family == AF_INET6) { -const uint8_t *s6_addr_a = ((const struct sockaddr_in6 *)a)->sin6_addr.s6_addr; -const uint8_t *s6_addr_b = ((const struct sockaddr_in6 *)b)->sin6_addr.s6_addr; -return memcmp(s6_addr_a, s6_addr_b, 16); -} -#endif -return 1; -} - static int get_port(const struct sockaddr_storage *ss) { if (ss->ss_family == AF_INET) @@ -186,25 +148,6 @@ static void set_port(struct sockaddr_storage *ss, int port) #endif } -static int rtp_check_source_lists(RTPContext *s, struct sockaddr_storage *source_addr_ptr) -{ -int i; -if (s->nb_ssm_exclude_addrs) { -for (i = 0; i < s->nb_ssm_exclude_addrs; i++) { -if (!compare_addr(source_addr_ptr, s->ssm_exclude_addrs[i])) -return 1; -} -} -if (s->nb_ssm_include_addrs) { -for (i = 0; i < s->nb_ssm_include_addrs; i++) { -if (!compare_addr(source_addr_ptr, s->ssm_include_addrs[i])) -return 0; -} -return 1; -} -return 0; -} - /** * add option to url of the form: * "http://host:port/path?option1=val1=val2... @@ -252,48 +195,6 @@ static void build_udp_url(RTPContext *s, url_add_option(buf, buf_size, "block=%s", exclude_sources); } -static void rtp_parse_addr_list(URLContext *h, char *buf, -struct sockaddr_storage ***address_list_ptr, -int *address_list_size_ptr) -{ -struct addrinfo *ai = NULL; -struct sockaddr_storage *source_addr; -char tmp = '\0', *p = buf, *next; - -/* Resolve all of the IPs */ - -while (p && p[0]) { -next = strchr(p, ','); - -if (next) { -tmp = *next; -*next = '\0'; -} - -ai = rtp_resolve_host(p, 0, SOCK_DGRAM, AF_UNSPEC, 0); -if (ai) { -source_addr = av_mallocz(sizeof(struct sockaddr_storage)); -if (!source_addr) { -freeaddrinfo(ai); -break; -} - -memcpy(source_addr, ai->ai_addr, ai->ai_addrlen); -freeaddrinfo(ai); -dynarray_add(address_list_ptr,
Re: [FFmpeg-devel] fate/mov : use do_md5sum for mov-faststart-4gb-overflow test
On 9/20/2018 1:56 PM, Martin Vignali wrote: > Hello, > > Following suggestion of Hendrik Leppkes > > the patch in attach fix for me the test mov-faststart-4gb-overflow > (os 10.12) > > Can be test with : > make fate-mov-faststart-4gb-overflow SAMPLES=fate-suite > > Martin Should be ok. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 09/10] doc/examples/vaapi_transcode: Fix the typo
On Thu, Sep 20, 2018 at 08:25:09AM +0800, myp...@gmail.com wrote: > On Thu, Sep 20, 2018 at 12:08 AM Michael Niedermayer > wrote: > > > > Signed-off-by: Michael Niedermayer > > --- > > doc/examples/vaapi_transcode.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/doc/examples/vaapi_transcode.c b/doc/examples/vaapi_transcode.c > > index 6f0cf9d258..279d20f636 100644 > > --- a/doc/examples/vaapi_transcode.c > > +++ b/doc/examples/vaapi_transcode.c > > @@ -179,7 +179,7 @@ static int dec_enc(AVPacket *pkt, AVCodec *enc_codec) > > } > > /* set AVCodecContext Parameters for encoder, here we keep > > them stay > > * the same as decoder. > > - * xxx: now the the sample can't handle resolution change case. > > + * xxx: now the sample can't handle resolution change case. > > */ > > encoder_ctx->time_base = av_inv_q(decoder_ctx->framerate); > > encoder_ctx->pix_fmt = AV_PIX_FMT_VAAPI; > > -- > > 2.19.0 > > > LGTM, tks will apply thx -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 4.1
On Thu, Sep 20, 2018 at 3:52 PM Tobias Rapp wrote: > > On 20.09.2018 12:26, Martin Vignali wrote: > > Hello, > > > > In current git, the qt faststart test doesn't pass for me (clang os 10.12), > > maybe need to be fix before the release. > > > > CCtools/qt-faststart.o > > LDtools/qt-faststart > > TESTmov-faststart-4gb-overflow > > --- -2018-09-20 12:18:23.0 +0200 > > +++ tests/data/fate/mov-faststart-4gb-overflow2018-09-20 > > 12:18:23.0 +0200 > > @@ -1 +0,0 @@ > > -bc875921f151871e787c4b4023269b29 > > Test mov-faststart-4gb-overflow failed. Look at > > tests/data/fate/mov-faststart-4gb-overflow.err for details. > > make: *** [fate-mov-faststart-4gb-overflow] Error 1 > > > > ./tests/fate-run.sh: line 387: md5sum: command not found > > The error message seems to indicate that not all required utilities are > installed in your local environment, i.e. the "md5sum" binary is either > not installed or not available in $PATH to the FATE script. > The test should probably be using do_md5sum (from md5.sh) instead, which supports a variety of other md5 utilities. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_sr: Fix coverity CID 1439584
Hi, This patch fixes coverity CID 1439584. From a724bece3c18df551f874673c268aa01702b4576 Mon Sep 17 00:00:00 2001 From: Pedro Arthur Date: Thu, 20 Sep 2018 11:48:20 -0300 Subject: [PATCH] avfilter/vf_sr: Fix coverity CID 1439584 --- libavfilter/vf_sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index c1ae6c5ff2..077ccc799c 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -250,7 +250,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } -sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(_context->output.data), +sws_scale(sr_context->sws_contexts[2], (const uint8_t *[4]){(const uint8_t *)sr_context->output.data, 0, 0, 0}, (const int[4]){sr_context->sws_output_linesize, 0, 0, 0}, 0, out->height, (uint8_t * const*)out->data, out->linesize); -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 4.1
On 20/09/2018 00:32, Michael Niedermayer wrote: On Wed, Sep 19, 2018 at 10:31:19PM +0200, Marton Balint wrote: On Fri, 14 Sep 2018, Michael Niedermayer wrote: Hi all its almost 5 months since 4.0 so its time to make a new release. Are there any suggestions for a name ? If not ill pick something from unused past suggestions. If there are no objections i will likely make that release in the next weeks Whatever happened to Coverity, it would be nice make it work again and fix some issues reported there before the release... well, i wonder too what happened. I thought the coverity stuff was automated now. Did something get stuck ? coverity displays "Last Build Status: Running. Your build is currently being analyzed" should i try to terminate it ? or was there an issue with the submitting and someone just fixed that ? The automated builds are still running fine, but something on their end got horribly stuck, and so far every attempt of mine to contact them was ignored. If we have an official contact that could ask them what's going on, that would be very nice. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 4.1
Hello, In current git, the qt faststart test doesn't pass for me (clang os 10.12), maybe need to be fix before the release. CCtools/qt-faststart.o LDtools/qt-faststart TESTmov-faststart-4gb-overflow --- -2018-09-20 12:18:23.0 +0200 +++ tests/data/fate/mov-faststart-4gb-overflow2018-09-20 12:18:23.0 +0200 @@ -1 +0,0 @@ -bc875921f151871e787c4b4023269b29 Test mov-faststart-4gb-overflow failed. Look at tests/data/fate/mov-faststart-4gb-overflow.err for details. make: *** [fate-mov-faststart-4gb-overflow] Error 1 ./tests/fate-run.sh: line 387: md5sum: command not found Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] fate/mov : use do_md5sum for mov-faststart-4gb-overflow test
Hello, Following suggestion of Hendrik Leppkes the patch in attach fix for me the test mov-faststart-4gb-overflow (os 10.12) Can be test with : make fate-mov-faststart-4gb-overflow SAMPLES=fate-suite Martin 0001-fate-mov-use-do_md5sum-for-mov-faststart-4gb-overflo.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 4.1
On 20.09.2018 12:26, Martin Vignali wrote: Hello, In current git, the qt faststart test doesn't pass for me (clang os 10.12), maybe need to be fix before the release. CCtools/qt-faststart.o LDtools/qt-faststart TESTmov-faststart-4gb-overflow --- -2018-09-20 12:18:23.0 +0200 +++ tests/data/fate/mov-faststart-4gb-overflow2018-09-20 12:18:23.0 +0200 @@ -1 +0,0 @@ -bc875921f151871e787c4b4023269b29 Test mov-faststart-4gb-overflow failed. Look at tests/data/fate/mov-faststart-4gb-overflow.err for details. make: *** [fate-mov-faststart-4gb-overflow] Error 1 ./tests/fate-run.sh: line 387: md5sum: command not found The error message seems to indicate that not all required utilities are installed in your local environment, i.e. the "md5sum" binary is either not installed or not available in $PATH to the FATE script. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel