Commit Graph

647 Commits

Author SHA1 Message Date
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Lior Mualem baec6d8aff ffserver: Fixed ffserver to support large ffm files
ffm_read_write_index returns a 64bit value,

Github: Closes #185
2016-03-08 11:39:29 +01:00
Oliver Collyer a2f8beef2d ffserver&ffm: Fixed issues preventing ffserver write_index and files_size from being set correctly which was breaking ffserver streaming.
I discovered that ffserver streaming was broken (it seems like it has been since 20th November) and I opened a ticket for this (https://trac.ffmpeg.org/ticket/5250 <https://trac.ffmpeg.org/ticket/5250>).

I spent yesterday learning git bisect (with the kind help of cehoyos) to painstakingly track down the cause. This was made more difficult due to the presence of a segfault in ffserver during the period where the bug was introduced so I first had to identify when and how that was fixed and then retrospectively apply that fix again for each step of the second git bisect to find the actual bug.

Anyway, the fruits of my labour are the innocent looking patch below to correct a couple of typos and define a valid range for two variables.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-21 12:59:07 +01:00
Carl Eugen Hoyos e5c16e38fe ffserver: Cast time_t value when using it in a format string.
Fixes ticket #5103.
2015-12-29 16:00:34 +01:00
Reynaldo H. Verdejo Pinochet b25ac3c999 ffserver: add a doctype heading to our HTML pages
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-27 00:09:16 -08:00
Reynaldo H. Verdejo Pinochet daaa535867 ffserver: HTML encode msgs instead of blindly stripping chars out
Fixes weirdness like our "??filename? not found" 404.

None of the chars being used from the previously blacklisted
list needs to be scaped on an UTF-8 document context

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-27 00:09:16 -08:00
Reynaldo H. Verdejo Pinochet 0e5c1dc9a3 ffserver: make our 404 explicitly HTML5/UTF-8
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-27 00:09:16 -08:00
Reynaldo H. Verdejo Pinochet ae2ed20b59 ffserver: refactor build_feed_streams()
* Avoid excesive nesting that made it really hard to follow
* Drop unneeded vars
* Factor out codec compatibility check routine
* Ensure inputs are closed and contexts are freed as needed
  before returning

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-19 01:52:20 -08:00
Reynaldo H. Verdejo Pinochet 4ba148a6ea ffserver: refactor build_file_streams()
Avoid unneeded nesting, drop redundant var

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-19 01:52:20 -08:00
Reynaldo H. Verdejo Pinochet 532a283383 ffserver: unify exit path from build_feed_streams()
Exit from main on build_feed_streams() failures & use
standard EXIT_ codes on error out/normal exit.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-19 01:52:20 -08:00
Reynaldo H. Verdejo Pinochet 0bdf84b6b0 ffserver: explicitly use time_t for uptime calc
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-15 10:04:59 -08:00
Reynaldo H. Verdejo Pinochet dadb95142b ffserver: free pathname before bailing out
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-15 10:04:59 -08:00
Reynaldo H. Verdejo Pinochet 1fa81430ca ffserver: use EXIT_FAILURE on failed child fork()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-15 10:04:59 -08:00
Reynaldo H. Verdejo Pinochet eb68c35670 ffserver: be explicit on failed fork() msg
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-15 10:04:59 -08:00
Reynaldo H. Verdejo Pinochet 5a31f2318b ffserver: allocate AVStream's internal too
Avoids segfault at init_muxer() (mux.c) due to a
null pointer dereference on the recently
introduced AVStream->internal

Fixes: #5059 (https://trac.ffmpeg.org/ticket/5059)

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-15 10:04:49 -08:00
Michael Niedermayer a00cc2e40d ffserver: Clear avio context after closing it in rtp_new_av_stream()
Suggested-by: "Reynaldo H. Verdejo Pinochet" <reynaldo@osg.samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-30 23:31:12 +01:00
Michael Niedermayer 40063a900b ffserver: Clear avio context after closing it
Fixes: ==13287== Invalid read of size 4
==13287==    at 0x45161A: flush_buffer (aviobuf.c:143)
==13287==    by 0x451971: avio_flush (aviobuf.c:200)
==13287==    by 0x512CCF: av_write_trailer (mux.c:1016)
==13287==    by 0x41A5E0: close_connection (ffserver.c:853)
==13287==    by 0x421EDC: rtsp_cmd_interrupt (ffserver.c:3245)
==13287==    by 0x420B9C: rtsp_parse_request (ffserver.c:2854)
==13287==    by 0x41A9C2: handle_connection (ffserver.c:930)
==13287==    by 0x41A04B: http_server (ffserver.c:700)
==13287==    by 0x423A60: main (ffserver.c:3897)
==13287==  Address 0xb6cd258 is 88 bytes inside a block of size 192 free'd
==13287==    at 0x4C2B5D9: free (vg_replace_malloc.c:446)
==13287==    by 0x1004DAC: av_free (mem.c:239)
==13287==    by 0x454835: avio_close_dyn_buf (aviobuf.c:1170)
==13287==    by 0x41F385: http_prepare_data (ffserver.c:2368)
==13287==    by 0x41F59B: http_send_data (ffserver.c:2416)
==13287==    by 0x41ABE2: handle_connection (ffserver.c:986)
==13287==    by 0x41A04B: http_server (ffserver.c:700)
==13287==    by 0x423A60: main (ffserver.c:3897)

Reviewed-by: "Reynaldo H. Verdejo Pinochet" <reynaldo@osg.samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-30 23:31:12 +01:00
Nicolas George 15206ffdbe ffserver: add NULL context to ff_rtsp_parse_line().
Needed after f62fe53/2c17fb6.
2015-11-29 17:02:04 +01:00
Michael Niedermayer e33d372023 ffserver: Use AVOption API to access ffm demuxer instead of direct access depending on ABI
server_attached is newly added so the demuxer knows if there is an attached server
that can update the write index. This is needed to fix a infinite loop

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-20 20:03:12 +01:00
Michael Niedermayer 2ec18db75c ffserver: Replace one malloc(AVStream) by avformat_new_stream()
This fixes a null pointer dereference from the recently introduced
AVStream->internal

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 21:26:50 +01:00
Michael Niedermayer 64e220beb5 ffserver: Do not add or rescale AV_NOPTS_VALUE from the demuxer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 15:13:37 +01:00
Ganesh Ajjanagadde 6c2dbff7f0 ffserver: fix incorrect strlcpy usage
Somewhat ironic that this "safe" interface is actually being used
unsafely here. This fixes the usage preventing potential null pointer
dereference, where the old code was doubly broken: ctime can return
NULL, and ctime can return an arbitrarily long buffer.

Reviewed-by: Mark Harris <mark.hsj@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-09 19:30:26 -05:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Reynaldo H. Verdejo Pinochet fe95b0eb8f ffserver: avoid leaking pathname at exit
Fixes Coverity CID 1325681

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-10-04 22:31:22 -07:00
Reynaldo H. Verdejo Pinochet 84b4998dbd ffserver: fix up rate units in server messages
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-10-04 15:58:35 -07:00
Reynaldo H. Verdejo Pinochet d8c714cb24 ffserver: wrap around bandwidth exceeded msg text
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-10-04 15:58:35 -07:00
Reynaldo H. Verdejo Pinochet 8a9089948f ffserver: wrap around too-busy message text
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-10-04 15:58:35 -07:00
Reynaldo H. Verdejo Pinochet 3388bcced4 ffserver: unify exit path in _write_index()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-10-04 15:58:35 -07:00
Reynaldo H. Verdejo Pinochet c677b42f79 ffserver: explicitly free() duped filename
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-09-18 16:24:38 -07:00
Reynaldo H. Verdejo Pinochet fb349359dc ffserver: start dropping all unneededly harcoded str lengths
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-09-18 16:24:33 -07:00
Michael Niedermayer 7404f3bdb9 lavc: Switch bitrate to 64bit unless compatibility with avconv was requested. 2015-09-15 18:02:43 +02:00
Reynaldo H. Verdejo Pinochet 314bc20d7a ffserver: remove redundant comment, clarify another one
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-09-11 18:33:29 -07:00
Reynaldo H. Verdejo Pinochet 2580395e1c ffserver: unify exit path in http_server()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-09-11 18:33:13 -07:00
Reynaldo H. Verdejo Pinochet 9a168e9371 ffserver: unify fail path in socket_open_listen()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-09-11 18:08:08 -07:00
Ganesh Ajjanagadde 92b1a0fa9e ffserver: cast PID to int64_t before printing
Unfortunately, there is no portable format specifier for PID's.
Furthermore, it is not safe to assume pid_t <= 32 bit in size,
see e.g http://unix.derkeiler.com/Mailing-Lists/AIX-L/2010-08/msg00008.html.
Right now, it is ok to assume pid_t <= 32 bit in size, but this may change in the future.
Also, this patch fixes warning due to lack of an appropriate cast from
http://fate.ffmpeg.org/report.cgi?time=20150820233505&slot=x86-opensolaris-gcc4.3.
Note that this method of handling pid_t is in line with what nginx does.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-21 15:47:54 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Michael Niedermayer c719b7a42b ffserver: add (), fix order of operations
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 11:40:00 +02:00
Reynaldo H. Verdejo Pinochet b16b8c815c ffserver: drop superfluous else clause
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-07-26 23:53:08 -03:00
Reynaldo H. Verdejo Pinochet c75bc268a2 ffserver: simplify assignment with ternary
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-07-26 23:11:37 -03:00
Reynaldo H. Verdejo Pinochet 2ea642ff4b ffserver: move decl to start of func
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-07-26 22:29:47 -03:00
Reynaldo H. Verdejo Pinochet 08724da976 ffserver: make statement block unconditional by exiting early
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-24 19:17:51 -03:00
Reynaldo H. Verdejo Pinochet 36a617c162 ffserver: make statement block unconditional by exiting early
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-24 19:17:51 -03:00
Reynaldo H. Verdejo Pinochet 469c335c55 ffserver: unify comment formating & drop unneeded braces
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-24 19:17:51 -03:00
Reynaldo H. Verdejo Pinochet 1714fe2990 ffserver: factor out stream params printing
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-24 19:17:51 -03:00
Reynaldo H. Verdejo Pinochet 89234deaa2 ffserver: simplify URLContext cleanup
Drop unneeded var and avoid checking for NULL twice as
ffurl_closep() already does this.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-24 19:17:51 -03:00
Reynaldo H. Verdejo Pinochet 6504047f82 ffserver: drop unneeded else branching
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-21 19:06:00 -03:00
Reynaldo H. Verdejo Pinochet 758c7a5cbc ffserver: drop unneeded else branching
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-21 19:06:00 -03:00
Reynaldo H. Verdejo Pinochet 683f57354d ffserver: drop unneeded else branching
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-21 19:06:00 -03:00
Reynaldo H. Verdejo Pinochet d8a04d916b ffserver: formating
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-06-21 19:06:00 -03:00
Caligula useraccount 3b89a67315 ffserver: Use singlejpeg muxer for jpeg
Fixes Ticket4218

Based on patch by: Otávio Ribeiro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 03:36:22 +02:00