upipe / upipe Goto Github PK
View Code? Open in Web Editor NEWUpipe dataflow framework
Home Page: http://upipe.org/
License: Other
Upipe dataflow framework
Home Page: http://upipe.org/
License: Other
Upipe is a flexible dataflow framework. It is primarily designed to be the core of a multimedia player, transcoder or streamer. The framework organizes the processing of incoming data buffer inside a pipeline of modules. It exposes core types for buffers and modules (called "pipes"), and the API of communication between pipes and between the application and pipes. The API documentation is written as a mkdoc file. Install mkdoc (http://www.nongnu.org/mkdoc/) and type ./configure && make doc The latest code is available from: http://upipe.org/ Upipe core libraries are distributed under the MIT license. The Upipe framers library (which contains code typically used by demuxes) is distributed under the LGPLv2.1+ license. The Upipe filters library is distributed under the LGPLv2.1+ license. The Upipe transport stream library is distributed under the LGPLv2.1+ license. For non-LGPL uses, please contact [email protected].
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffebfff700 (LWP 2968)]
udict_inline_next (attr=0x7fffe401b29a ".\b") at udict_P
225 return attr + attr_sizes[shorthand->base_type] + 1;
(gdb) bt
#0 udict_inline_next (attr=0x7fffe401b29a ".\b") at udict_inline.c:225
#1 0x0000000000430920 in udict_inline_find (udict=, name=name@entry=0x0, type=type@entry=UDICT_TYPE_PIC_KEY) at udict_inline.c:257
#2 0x0000000000430981 in _udict_inline_get (udict=, name=0x0, type=UDICT_TYPE_PIC_KEY, size_p=0x0) at udict_inline.c:306
#3 0x0000000000431289 in udict_inline_get (attr_p=, size_p=, type=, name=,
udict=<optimised out>) at udict_inline.c:353
#4 udict_inline_control (udict=0x7fffe401c7f8, command=0, args=0x7500632d) at udict_inline.c:527
#5 0x00000000004c1fe9 in udict_control_va (args=0x7fffebffea18, command=2, udict=) at ../../include/upipe/udict.h:234
#6 udict_control (udict=, command=command@entry=2) at ../../include/upipe/udict.h:249
#7 0x00000000004c4145 in udict_get (p=0x0, size_p=0x0, type=UDICT_TYPE_PIC_KEY, name=0x0, udict=) at ../../include/upipe/udict.h:297
#8 udict_get_void (type=UDICT_TYPE_PIC_KEY, name=0x0, p=0x0, udict=) at ../../include/upipe/udict.h:348
#9 uref_attr_get_void (uref=, p=0x0, name=0x0, type=UDICT_TYPE_PIC_KEY) at ../../include/upipe/uref_attr.h:125
#10 uref_pic_get_key (uref=0xad5280) at ../../include/upipe/uref_pic.h:45
#11 upipe_avcdec_set_time_attributes (upipe=upipe@entry=0x7fffe401b9b0, uref=uref@entry=0xad5280) at upipe_avcodec_decode.c:718
#12 0x00000000004c9d4d in upipe_avcdec_output_pic (upump_p=0xb474b8, upipe=0xb474b8) at upipe_avcodec_decode.c:863
#13 upipe_avcdec_decode_avpkt (upipe=upipe@entry=0x7fffe401b9b0, avpkt=avpkt@entry=0x7fffebffecb0, upump_p=upump_p@entry=0xb474b8)
at upipe_avcodec_decode.c:980
#14 0x00000000004cad93 in upipe_avcdec_decode (upipe=0x7fffe401b9b0, uref=0x7fffec027a30, upump_p=0xb474b8) at upipe_avcodec_decode.c:1075
#15 0x0000000000674687 in upipe_input (upump_p=, uref=0x7fffec027a30, upipe=0x7fffe401b9b0) at ../../include/upipe/upipe.h:944
#16 upipe_fdec_bin_input (upipe=, uref=0x7fffec027a30, upump_p=) at upipe_filter_decode.c:108
#17 0x000000000045df81 in upipe_input (upump_p=0xb474b8, uref=0x7fffec027a30, upipe=0xb42d48) at ../../include/upipe/upipe.h:944
#18 upipe_qsrc_output (upump_p=0xb474b8, uref=0x7fffec027a30, upipe=) at upipe_queue_source.c:93
#19 upipe_qsrc_input (upipe=, uref=0x7fffec027a30, upump_p=0xb474b8) at upipe_queue_source.c:167
#20 0x00007ffff7bcfe45 in ev_invoke_pending () from /usr/lib/x86_64-linux-gnu/libev.so.4
#21 0x00007ffff7bd2fe7 in ev_run () from /usr/lib/x86_64-linux-gnu/libev.so.4
#22 0x000000000046698c in upipe_pthread_start (_pthread_ctx=0xaadaa0) at upipe_pthread_transfer.c:106
#23 0x00007ffff6767182 in start_thread (arg=0x7fffebfff700) at pthread_create.c:312
#24 0x00007ffff649447d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
I have an error during build:
upipe_rtcp.c:45:33: fatal error: bitstream/ietf/rtcp.h: No such file or directory
I solved using flag on configure: --disable-rtcp
But it can be fine to check header presence during configure.
I'm not sure why I've just stumbled into this problem. Maybe tasn is a new package dependency on my system. Whatever. When I correct that in the installed pc file I discovered that I also need to add libgcrypt.
I would try to solve the issue myself but I'm not sure how to modify libupipe_ts.pc.in to do it conditionally.
I just tried to compiler against my own ffmpeg build.
Add to add --disable-shared 1st
Now when linking i get missing members in AVFrame
type
get_buffer
release_buffer
In a simple TS with one video es and one audio es, having the pcr_pid set equal to the video pid, led to a file that has some packet with random_access_filed = 1 but no pcr.
According to ISO/IEC 13818-1 "In the PCR_PID the random_access_indicator may only be set to '1' in Transport Stream packet containing the PCR fields."
I saw that the random access field is triggered in the multiplexer by the presence of the random field in the uref currently passing in the multiplexer, and that this field is set by the framer when it founds an IDR (I am using a h264 video stream).
A small and ugly patch in upipe_ts_encaps just where the tsaf_set_randomaccess is called can fix this (avoiding to set the random access field if there is no pcr), but I am not able to find and information related to the pcr_pid within the encapsulator, so maybe I am not getting the point of where it is managed.
Is this the point where the thing should be managed so I can write my own patch to propagate the pcr_pid information to the encapsulator and use it beside the tsaf_set_randomaccess or should it be addressed in a different way?
/home/james/src/upipe/lib/upipe-av/upipe_avcodec_encode.c:80:10: fatal error: bitstream/mpeg/h264.h: No such file or directory
80 | #include <bitstream/mpeg/h264.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
Connecting the ts_mux to a file sink wrapped in a sink_worker causes a delay in allocating the encapsulator's ubuf_mgr.
In the resulting TS file the very first (2 or 3) PSISI signalling are collapsed in consecutive packets.
Easily reproducible modifying upipe_ts_test.c
libav 9.10 shared and pic. same with libav 12.
In file included from upipe_sws.c:48:0:
../../include/upipe-av/upipe_av_pixfmt.h: In function ‘upipe_av_pixfmt_to_flow_def’:
../../include/upipe-av/upipe_av_pixfmt.h:208:14: error: ‘AV_PIX_FMT_RGBA64BE’ undeclared (first use in this function)
case AV_PIX_FMT_RGBA64BE:
^
../../include/upipe-av/upipe_av_pixfmt.h:208:14: note: each undeclared identifier is reported only once for each function it appears in
../../include/upipe-av/upipe_av_pixfmt.h: In function ‘upipe_av_pixfmt_from_flow_def’:
../../include/upipe-av/upipe_av_pixfmt.h:265:9: error: ‘AV_PIX_FMT_RGBA64BE’ undeclared (first use in this function)
AV_PIX_FMT_RGBA64BE,
^
In file included from upipe_sws_thumbs.c:47:0:
../../include/upipe-av/upipe_av_pixfmt.h: In function ‘upipe_av_pixfmt_to_flow_def’:
../../include/upipe-av/upipe_av_pixfmt.h:208:14: error: ‘AV_PIX_FMT_RGBA64BE’ undeclared (first use in this function)
case AV_PIX_FMT_RGBA64BE:
^
../../include/upipe-av/upipe_av_pixfmt.h:208:14: note: each undeclared identifier is reported only once for each function it appears in
../../include/upipe-av/upipe_av_pixfmt.h: In function ‘upipe_av_pixfmt_from_flow_def’:
../../include/upipe-av/upipe_av_pixfmt.h:265:9: error: ‘AV_PIX_FMT_RGBA64BE’ undeclared (first use in this function)
AV_PIX_FMT_RGBA64BE,
^
make[3]: *** [libupipe_swscale_la-upipe_sws_thumbs.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [libupipe_swscale_la-upipe_sws.lo] Error 1
make[3]: Leaving directory /home/cedric/install/upipe-0.5/lib/upipe-swscale' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory
/home/cedric/install/upipe-0.5/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/cedric/install/upipe-0.5'
make: *** [all] Error 2
The current last version is:
0.5 (5 Feb 2018)
The project is dead?
It is possible to release a new version?
Thanks in advance.
upipe_glx_sink_clean_glx is called before uprobe_gl_sink_clean, and glDeleteTextures is called inside uprobe_gl_sink_clean, which has no effect since the OpenGL context was destroyed already.
Not sure whether the following patch is appropriate or not:
diff --git a/include/upipe-gl/upipe_gl_sink_common.h b/include/upipe-gl/upipe_gl_sink_common.h
index bdd03dba..269aa1b4 100644
--- a/include/upipe-gl/upipe_gl_sink_common.h
+++ b/include/upipe-gl/upipe_gl_sink_common.h
@@ -44,6 +44,8 @@ enum uprobe_gl_sink_event {
/** init GL context (int SIGNATURE, int width, int height) */
UPROBE_GL_SINK_INIT,
+ /** terminate GL context (int SIGNATURE) */
+ UPROBE_GL_SINK_TERMINATE,
/** render GL (int SIGNATURE, struct uref*) */
UPROBE_GL_SINK_RENDER,
/** reshape GL (int SIGNATURE, int width, int height) */
diff --git a/lib/upipe-gl/uprobe_gl_sink.c b/lib/upipe-gl/uprobe_gl_sink.c
index 2a3ea0d1..55bfcbbe 100644
--- a/lib/upipe-gl/uprobe_gl_sink.c
+++ b/lib/upipe-gl/uprobe_gl_sink.c
@@ -178,6 +178,16 @@ static void uprobe_gl_sink_init2(struct uprobe *uprobe,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
+static void uprobe_gl_sink_terminate(struct uprobe *uprobe,
+ struct upipe *upipe)
+{
+ struct uprobe_gl_sink *uprobe_gl_sink = uprobe_gl_sink_from_uprobe(uprobe);
+ if (uprobe_gl_sink->texture) {
+ glDeleteTextures(1, &uprobe_gl_sink->texture);
+ uprobe_gl_sink->texture = 0;
+ }
+}
+
/** @internal @This catches events thrown by pipes.
*
* @param uprobe pointer to probe
@@ -204,6 +214,10 @@ static int uprobe_gl_sink_throw(struct uprobe *uprobe,
uprobe_gl_sink_init2(uprobe, upipe, w, h);
return UBASE_ERR_NONE;
}
+ case UPROBE_GL_SINK_TERMINATE: {
+ uprobe_gl_sink_terminate(uprobe, upipe);
+ return UBASE_ERR_NONE;
+ }
case UPROBE_GL_SINK_RENDER: {
unsigned int signature = va_arg(args, unsigned int);
assert(signature == UPIPE_GL_SINK_SIGNATURE);
@@ -248,7 +262,10 @@ uprobe_gl_sink_init(struct uprobe_gl_sink *uprobe_gl_sink,
*/
static void uprobe_gl_sink_clean(struct uprobe_gl_sink *uprobe_gl_sink)
{
- glDeleteTextures(1, &uprobe_gl_sink->texture);
+ if (uprobe_gl_sink->texture) {
+ glDeleteTextures(1, &uprobe_gl_sink->texture);
+ uprobe_gl_sink->texture = 0;
+ }
struct uprobe *uprobe = &uprobe_gl_sink->uprobe;
uprobe_clean(uprobe);
}
These need a mechanism to set video uref attributes since they are not streams and need to be frame accurately attached with the video.
Meuuh suggests upipe_setattr pipe for this.
Line 194 in 1c99aef
s
variable which is used in the outer loop to parse several RTCP messages in a single packet, causing it to exit prematurely and ignore subsequent RTCP messages. The rtp
pointer is erroneously overwritten as well, line 168.Would it be possible to get a example of how rist_rx and rist_tx should be used to support video streaming?
I currently have 4 docker containers:
Container1 (172.20.0.50) - starts stream:
ffmpeg -re -stream_loop -1 -i /data/a2.mp4 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -r 24 -x264opts keyint=24:no-scenecut -g 24 -keyint_min 24 -profile:v baseline -preset veryfast -acodec aac -b:a 48k -ac 1 -ar 44100 -bsf:a aac_adtstoasc -f mpegts udp://172.20.0.60:5006
Container2 (172.20.0.60) - RIST sender
./rist_tx -d 172.20.0.60:5006 172.20.0.70:5008 1000
Container3 (172.20.0.70) - RIST receiver
./rist_rx -d 172.20.0.70:5008 172.20.0.80:5010 1000
Container4 (172.20.0.80) - listens to the stream
ffprobe -i udp://172.20.0.80:5010
This does not work. Container 3 appears to listen to UDP 5009, but not 5008.
Would it be possible to get an example of how rist_tx and rist_rx should be chained?
NB: pointing Container1 directly to Container4 works as expected
tsan complains, and I am not sure if it shows a real problem or not.
I prefer to ask for advice before diving in there :)
upipe configured with gcc 6.2.0 (ubuntu 16.10)
./configure --enable-static --disable-shared CFLAGS="-fPIE -fsanitize=thread -O2 -g -fno-omit-frame-pointer" CXXFLAGS="-fPIE -fsanitize=thread -O2 -g -fno-omit-frame-pointer" LDFLAGS="-fsanitize=thread -pie"
Running on 3.19.0-39-generic from Ubuntu 15.04, because 3.19.0-40 and later have Linux commit d1fd836dcf00d2028c700c7e44d2c23404062c90
Supporting these kernels need a recent llvm patch so I just used an older kernel.
You might need to disable ASLR as well:
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
Although it seems to work for 3.19.0-39 even with ASLR enabled
==================
WARNING: ThreadSanitizer: data race (pid=18188)
Read of size 2 at 0x7d840001ccd2 by thread T1:
#0 uring_fifo_find ../../include/upipe/uring.h:333 (uplay+0x000000c94b8c)
#1 uring_fifo_pop ../../include/upipe/uring.h:371 (uplay+0x000000c94b8c)
#2 ufifo_pop_internal ../../include/upipe/ufifo.h:97 (uplay+0x000000c94b8c)
#3 uqueue_pop_internal ../../include/upipe/uqueue.h:162 (uplay+0x000000c94b8c)
#4 upipe_xfer_mgr_worker /home/fun/upipe/lib/upipe-modules/upipe_transfer.c:538 (uplay+0x000000c94b8c)
#5 upump_common_dispatch /home/fun/upipe/lib/upipe/upump_common.c:146 (uplay+0x000000caaffe)
#6 upump_ev_dispatch_io /home/fun/upipe/lib/upump-ev/upump_ev.c:90 (uplay+0x00000010a77d)
#7 ev_invoke_pending <null> (libev.so.4+0x000000003d72)
#8 upipe_pthread_start /home/fun/upipe/lib/upipe-pthread/upipe_pthread_transfer.c:109 (uplay+0x000000186609)
#9 <null> <null> (libtsan.so.0+0x0000000245a9)
Previous write of size 2 at 0x7d840001ccd2 by main thread:
#0 uring_fifo_push ../../include/upipe/uring.h:411 (uplay+0x000000c97dc6)
#1 ufifo_push ../../include/upipe/ufifo.h:85 (uplay+0x000000c97dc6)
#2 uqueue_push ../../include/upipe/uqueue.h:138 (uplay+0x000000c97dc6)
#3 upipe_xfer_mgr_send /home/fun/upipe/lib/upipe-modules/upipe_transfer.c:589 (uplay+0x000000c97dc6)
#4 upipe_xfer_control /home/fun/upipe/lib/upipe-modules/upipe_transfer.c:447 (uplay+0x000000c9879a)
#5 upipe_control_nodbg_va ../../include/upipe/upipe.h:1033 (uplay+0x00000015e788)
#6 upipe_control_va ../../include/upipe/upipe.h:1051 (uplay+0x00000015e788)
#7 upipe_control ../../include/upipe/upipe.h:1109 (uplay+0x00000015e788)
#8 upipe_set_output ../../include/upipe/upipe.h:1150 (uplay+0x0000001609b0)
#9 _upipe_wsrc_alloc /home/fun/upipe/lib/upipe-modules/upipe_worker_source.c:231 (uplay+0x0000001609b0)
#10 upipe_alloc_va ../include/upipe/upipe.h:382 (uplay+0x0000000e31ab)
#11 upipe_alloc ../include/upipe/upipe.h:404 (uplay+0x0000000e31ab)
#12 upipe_wsrc_alloc ../include/upipe-modules/upipe_worker_source.h:121 (uplay+0x0000000e6874)
#13 uplay_start /home/fun/upipe/examples/uplay.c:567 (uplay+0x0000000e6874)
#14 upump_common_dispatch /home/fun/upipe/lib/upipe/upump_common.c:146 (uplay+0x000000caaffe)
#15 upump_ev_dispatch_idle /home/fun/upipe/lib/upump-ev/upump_ev.c:119 (uplay+0x00000010a7dd)
#16 ev_invoke_pending <null> (libev.so.4+0x000000003d72)
#17 __libc_start_main <null> (libc.so.6+0x0000000203f0)
Location is heap block of size 4592 at 0x7d840001cc00 allocated by main thread:
#0 malloc <null> (libtsan.so.0+0x000000026c3c)
#1 upipe_xfer_mgr_alloc /home/fun/upipe/lib/upipe-modules/upipe_transfer.c:678 (uplay+0x000000c98dfb)
#2 upipe_pthread_xfer_mgr_alloc /home/fun/upipe/lib/upipe-pthread/upipe_pthread_transfer.c:175 (uplay+0x000000186b4d)
#3 main /home/fun/upipe/examples/uplay.c:766 (uplay+0x0000000e24ba)
Thread T1 (tid=18190, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x0000000284f0)
#1 upipe_pthread_xfer_mgr_alloc /home/fun/upipe/lib/upipe-pthread/upipe_pthread_transfer.c:186 (uplay+0x000000186c06)
#2 main /home/fun/upipe/examples/uplay.c:766 (uplay+0x0000000e24ba)
SUMMARY: ThreadSanitizer: data race ../../include/upipe/uring.h:333 in uring_fifo_find
==================
And many other warnings
Could be a false report.
==12669== Conditional jump or move depends on uninitialised value(s)
==12669== at 0x378CE0: upipe_h264f_handle_slice (upipe_h264_framer.c:1430)
==12669== by 0x379179: upipe_h264f_handle_nal (upipe_h264_framer.c:1515)
==12669== by 0x37C054: upipe_h264f_end_annexb (upipe_h264_framer.c:2198)
==12669== by 0x37CB49: upipe_h264f_work_annexb (upipe_h264_framer.c:2427)
==12669== by 0x37DC97: upipe_h264f_handle (upipe_h264_framer.c:2725)
==12669== by 0x37DD18: upipe_h264f_input (upipe_h264_framer.c:2741)
upipe/lib/upipe-framers/upipe_h264_framer.c
Line 1430 in e95b1d5
bf
seems to be inited at when declared with bool bf = false;
so I guess that means it is upipe_h264f->bf
FYI "libgcrypt-dev" is needed as a dependency on Ubuntu 18.04 Server for ./bootstrap to succeed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.