Re: [FFmpeg-devel] The log level of "co located POCs unavailable" should not be ERROR

2019-03-01 Thread Yukun Guo
On Fri, 1 Mar 2019 at 05:30, Michael Niedermayer wrote:
> When data is missing (in live streaming or otherwise) it under
> almost all cases cannot be losslessly recovered. So this use matches
> the definition

Yes, this is reasonable. But then "Frame num gap" should be of ERROR
level too. H.264 standard states if there is a frame num gap, the
decoder should infer an unintentional loss of pictures, assuming
gaps_in_frame_num_value_allowed_flag = 0. But it is possible that
FFmpeg encounters a frame loss but does not print any error messages,
because the error concealment procedure
(https://github.com/FFmpeg/FFmpeg/blob/n4.1.1/libavcodec/h264_slice.c#L1577)
will clone the previous frame in place of the missing one.

Also, regarding to the error concealment, why isn't
`short_ref[0].field_poc` copied for cloned frames? The unset field_poc
causes "co located POCs unavailable" error, despite
`ref_list[1][0].poc` is valid when doing spatial direct predition.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/http: reconnect when connect reset by peer

2019-03-01 Thread Michael Niedermayer
On Fri, Mar 01, 2019 at 09:39:14AM +, lmzeng(曾令明) wrote:
> diff --git a/libavformat/http.c b/libavformat/http.c
> old mode 100644
> new mode 100755
> index ed0eb1c..400df94
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -253,6 +253,7 @@ static int http_open_cnx(URLContext *h, AVDictionary 
> **options)
>  HTTPAuthType cur_auth_type, cur_proxy_auth_type;
>  HTTPContext *s = h->priv_data;
>  int location_changed, attempts = 0, redirects = 0;
> +int retry = 0;
>  redo:
>  av_dict_copy(options, s->chained_options, 0);
> 
> @@ -260,9 +261,21 @@ redo:
>  cur_proxy_auth_type = s->auth_state.auth_type;

It seems git does not like this patch 

Applying: avformat/http: reconnect when connect reset by peer
error: corrupt patch at line 14
error: could not build fake ancestor
Patch failed at 0001 avformat/http: reconnect when connect reset by peer
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/libvpxenc: add VP8 support for ROI-based encoding

2019-03-01 Thread James Zern
On Fri, Mar 1, 2019 at 4:51 AM Derek Buitenhuis
 wrote:
>
> On 01/03/2019 03:18, Guo, Yejun wrote:
> > yes, that's the reason I pending VP9 work. As for VP8 ROI, another thinking
> > is to first push vp8 roi, since libvpx is an external dependency and we 
> > don't
> > know the time when it is available for vp9 roi. Anyway, I'm open to both.
>
> Presumably the forthcoming VP9 ROI stuff would have to be under a version
> check anyway, unlike the VP8 path?
>

Yes, that only came about with 1.8.0 (which looks to have at least 1
bug). This can go forward, I didn't expect the discussion to change
anything for vp8, I only thought it might be simpler to serialize
things as the discussion around its use might effect the
implementation here.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mpegtsenc: factorize writing registration_descriptor

2019-03-01 Thread Marton Balint



On Sun, 24 Feb 2019, Carl Eugen Hoyos wrote:


Looks fine if tested.



Thanks, applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] avformat/utils: be more strict about stream specifiers

2019-03-01 Thread Marton Balint



On Sun, 24 Feb 2019, Marton Balint wrote:




On Tue, 19 Feb 2019, Carl Eugen Hoyos wrote:


2019-02-18 22:43 GMT+01:00, Marton Balint :



On Sun, 17 Feb 2019, Carl Eugen Hoyos wrote:


2019-02-17 20:55 GMT+01:00, Marton Balint :

This reworks the code to be more strict about accepting
stream specifiers. From now on we strictly enforce the
syntax in the documentation up until the decisive part of
the stream specifier. Therefore matching stream specifiers
always need to be correct, non matching specifiers only
need to be correct until the decisive part.


Could you give an example for something that changes
behaviour with this patch?


ffmpeg -f lavfi -i testsrc -codec:voohoo mpeg2video out.avi

Example for the next patch:

ffmpeg -f lavfi -i testsrc -codec:a:xxx mpeg2video out.avi


Thank you!


Ping for the series, will apply soon..


Applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/avpacket: add some assertions to ensure pkt->data is not null if pkt->size > 0

2019-03-01 Thread Marton Balint



On Sun, 24 Feb 2019, Marton Balint wrote:




On Sun, 17 Feb 2019, Marton Balint wrote:


This should fix the following Coverity false positives:

Coverity CID #1405450.
Coverity CID #1430930.

Signed-off-by: Marton Balint 


Ping for the series, will apply soon.


Applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegtsenc: write format_identifier HEVC for HEVC streams

2019-03-01 Thread Marton Balint



On Mon, 25 Feb 2019, Carl Eugen Hoyos wrote:






Am 24.02.2019 um 23:39 schrieb Marton Balint :


On Sat, 23 Feb 2019, Carl Eugen Hoyos wrote:

Hi Marton!


Am 23.02.2019 um 20:36 schrieb Marton Balint :
This improves compatibility with some consumer TVs which apparently either
search a HEVC descriptor (which our mpegts muxer can't generate) or a format
specifier.
Since the HEVC format specifier is not registered (but used in the wild), it is
not written if strict_std_compliance is higher than normal.




This fixes the issue in ticket #7744.


Could you test yourself?

If not, please wait for the OP to comment.


User confirmed via email that the patch indeed fixed LG TV play.


Thank you!

No more comments from me, Carl Eugen


Thanks, applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] New active mailing list maintainer needed

2019-03-01 Thread Lou Logan
Would any developer like to volunteer to take care of the mailing lists? I'm 
retiring from it. Here are the usual tasks:

* Clear the ffmpeg-devel moderation ideally on a daily basis. It isn't time 
consuming but involves approving legit messages/patches (first check to see if 
it is not a duplicate submission which is a common occurrence), 
approving/rejecting oversized messages, rejecting misplaced messages while 
directing the user to the correct list, and clearing the unending spam.

* Reply to messages to *-ow...@ffmpeg.org. Some of these are legit questions 
requesting mailing list help. Many are from users blindly sending to the wrong 
address. I'm guessing there are usually just a few per month.

* Investigate issues reported by users. It would be helpful if you have/get 
access to the server to view mail logs.

* Occasionally send removal requests to blocklists.

* Maintain mailing-list-faq.html.

It would be best if you have some mail related experience but it's not 
necessary. Most of all you need to be patient, able to tolerate repetition, and 
be able to communicate normally without being rude or overly terse. You also 
need to be impartial and not use the mailing list as a personal tool to censor 
or ban someone you don't like.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Added ff_v210_planar_unpack_aligned_avx2

2019-03-01 Thread Michael Stoner
The AVX2 code leverages VPERMD to process 12 pixels/iteration.  This is my 
first patch submission so any comments are greatly appreciated.

-Mike

Tested on Skylake (Win32 & Win64)
1920x1080 input frame
=
C code - 440 fps
SSSE3  - 920 fps
AVX- 930 fps
AVX2   - 1040 fps

Regression tested at 1920x1080, 1280x720, and 352x288
---
 libavcodec/v210dec.c   | 10 -
 libavcodec/x86/v210-init.c |  8 
 libavcodec/x86/v210.asm| 83 +-
 3 files changed, 81 insertions(+), 20 deletions(-)

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index ddc5dbe8be..166cec7a4a 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -119,7 +119,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 const uint32_t *src = (const uint32_t*)psrc;
 uint32_t val;
 
-w = (avctx->width / 6) * 6;
+w = (avctx->width / 12) * 12;
 s->unpack_frame(src, y, u, v, w);
 
 y += w;
@@ -127,6 +127,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 v += w >> 1;
 src += (w << 1) / 3;
 
+if (w < avctx->width - 5) {
+READ_PIXELS(u, y, v);
+READ_PIXELS(y, u, y);
+READ_PIXELS(v, y, u);
+READ_PIXELS(y, v, y);
+w += 6;
+}
+
 if (w < avctx->width - 1) {
 READ_PIXELS(u, y, v);
 
diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c
index d64dbca1a8..cb9a6cbd6a 100644
--- a/libavcodec/x86/v210-init.c
+++ b/libavcodec/x86/v210-init.c
@@ -21,9 +21,11 @@
 
 extern void ff_v210_planar_unpack_unaligned_ssse3(const uint32_t *src, 
uint16_t *y, uint16_t *u, uint16_t *v, int width);
 extern void ff_v210_planar_unpack_unaligned_avx(const uint32_t *src, uint16_t 
*y, uint16_t *u, uint16_t *v, int width);
+extern void ff_v210_planar_unpack_unaligned_avx2(const uint32_t *src, uint16_t 
*y, uint16_t *u, uint16_t *v, int width);
 
 extern void ff_v210_planar_unpack_aligned_ssse3(const uint32_t *src, uint16_t 
*y, uint16_t *u, uint16_t *v, int width);
 extern void ff_v210_planar_unpack_aligned_avx(const uint32_t *src, uint16_t 
*y, uint16_t *u, uint16_t *v, int width);
+extern void ff_v210_planar_unpack_aligned_avx2(const uint32_t *src, uint16_t 
*y, uint16_t *u, uint16_t *v, int width);
 
 av_cold void ff_v210_x86_init(V210DecContext *s)
 {
@@ -36,6 +38,9 @@ av_cold void ff_v210_x86_init(V210DecContext *s)
 
 if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
 s->unpack_frame = ff_v210_planar_unpack_aligned_avx;
+
+if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
+s->unpack_frame = ff_v210_planar_unpack_aligned_avx2;
 }
 else {
 if (cpu_flags & AV_CPU_FLAG_SSSE3)
@@ -43,6 +48,9 @@ av_cold void ff_v210_x86_init(V210DecContext *s)
 
 if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
 s->unpack_frame = ff_v210_planar_unpack_unaligned_avx;
+
+if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
+s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2;
 }
 #endif
 }
diff --git a/libavcodec/x86/v210.asm b/libavcodec/x86/v210.asm
index c24c765e5b..09449c93aa 100644
--- a/libavcodec/x86/v210.asm
+++ b/libavcodec/x86/v210.asm
@@ -22,52 +22,87 @@
 
 %include "libavutil/x86/x86util.asm"
 
-SECTION_RODATA
+SECTION_RODATA 32
+
+v210_mult: times 8 dw 64,4
+v210_mask: times 8 dd 0x3ff
+v210_luma_shuf: times 2 db 8,9,0,1,2,3,12,13,4,5,6,7,-1,-1,-1,-1
+v210_chroma_shuf1: times 2 db 0,1,8,9,6,7,-1,-1,2,3,4,5,12,13,-1,-1
+
+; for AVX2 version only
+v210_luma_permute: dd 0,1,2,4,5,6,7,7
+v210_chroma_permute: dd 0,1,4,5,2,3,6,7
+v210_chroma_shuf2: times 2 db 0,1,2,3,4,5,8,9,10,11,12,13,-1,-1,-1,-1
 
-v210_mask: times 4 dd 0x3ff
-v210_mult: dw 64,4,64,4,64,4,64,4
-v210_luma_shuf: db 8,9,0,1,2,3,12,13,4,5,6,7,-1,-1,-1,-1
-v210_chroma_shuf: db 0,1,8,9,6,7,-1,-1,2,3,4,5,12,13,-1,-1
 
 SECTION .text
 
 %macro v210_planar_unpack 1
 
 ; v210_planar_unpack(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t 
*v, int width)
-cglobal v210_planar_unpack_%1, 5, 5, 7
+cglobal v210_planar_unpack_%1, 5, 5, 10
 movsxdifnidn r4, r4d
 lear1, [r1+2*r4]
 addr2, r4
 addr3, r4
 negr4
 
-mova   m3, [v210_mult]
-mova   m4, [v210_mask]
-mova   m5, [v210_luma_shuf]
-mova   m6, [v210_chroma_shuf]
+mova   m3, [v210_luma_shuf]
+mova   m4, [v210_chroma_shuf1]
+
+%if cpuflag(avx2)
+mova   m5, [v210_luma_permute]  ; VPERMD constant must be in a register
+mova   m6, [v210_chroma_permute]; VPERMD constant must be in a register
+mova   m7, [v210_chroma_shuf2]
+%endif
+
+%if ARCH_X86_64
+mova   m8, [v210_mult]
+mova   m9, [v210_mask]
+%endif
+
 .loop:
 %ifidn %1, unaligned
-movu   m0, [r0]
+movu   m0, [r0]; yB v5 yA  u5 y9 v4  y8 u4 y7  v3 y6 
u3  y5 v2 y4  u2 y3 v1  y2 u1 y1  v0 

[FFmpeg-devel] [PATCH] avcodec/imm4: add support for mid-stream size changes

2019-03-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/imm4.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index b72f0be28e..aeb29f5d44 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -41,7 +41,6 @@ typedef struct IMM4Context {
 uint8_t *bitstream;
 int bitstream_size;
 
-int changed_size;
 int factor;
 unsigned lo;
 unsigned hi;
@@ -370,6 +369,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 IMM4Context *s = avctx->priv_data;
 GetBitContext *gb = >gb;
 AVFrame *frame = data;
+int width, height;
 unsigned type;
 int ret, scaled;
 
@@ -391,9 +391,11 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 avctx->color_range = AVCOL_RANGE_JPEG;
 
+width = avctx->width;
+height = avctx->height;
+
 scaled = avpkt->data[8];
 if (scaled < 2) {
-int width, height;
 int mode = avpkt->data[10];
 
 switch (mode) {
@@ -422,18 +424,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 height = 576;
 break;
 }
-
-if (s->changed_size == 1 &&
-(avctx->width != width || avctx->height != height)) {
-av_log(avctx, AV_LOG_ERROR, "Frame size change is unsupported.\n");
-return AVERROR_INVALIDDATA;
-}
-ret = ff_set_dimensions(avctx, width, height);
-if (ret < 0)
-return ret;
 }
 
-s->changed_size = 1;
 skip_bits_long(gb, 24 * 8);
 type = get_bits_long(gb, 32);
 s->hi = get_bits(gb, 16);
@@ -453,6 +445,17 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 return AVERROR_PATCHWELCOME;
 }
 
+if (!frame->key_frame &&
+(avctx->width != width ||
+ avctx->height != height)) {
+av_log(avctx, AV_LOG_ERROR, "Frame size change is unsupported.\n");
+return AVERROR_INVALIDDATA;
+}
+
+ret = ff_set_dimensions(avctx, width, height);
+if (ret < 0)
+return ret;
+
 if ((ret = ff_get_buffer(avctx, frame, frame->key_frame ? 
AV_GET_BUFFER_FLAG_REF : 0)) < 0)
 return ret;
 
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fate.sh: Add support for lines that are comments

2019-03-01 Thread Michael Niedermayer
On Thu, Feb 21, 2019 at 11:17:37PM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fate.sh | 5 +
>  1 file changed, 5 insertions(+)

will apply patchset

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()

2019-03-01 Thread Michael Niedermayer
On Tue, Feb 19, 2019 at 02:13:00AM +0100, Michael Niedermayer wrote:
> Fixes: runtime error: signed integer overflow: 2147483598 + 128 cannot be 
> represented in type 'int'
> Fixes: 
> 12926/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5705100733972480
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/jpeg2000dwt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/libvpxenc: add VP8 support for ROI-based encoding

2019-03-01 Thread Derek Buitenhuis
On 01/03/2019 03:18, Guo, Yejun wrote:
> yes, that's the reason I pending VP9 work. As for VP8 ROI, another thinking
> is to first push vp8 roi, since libvpx is an external dependency and we don't
> know the time when it is available for vp9 roi. Anyway, I'm open to both.

Presumably the forthcoming VP9 ROI stuff would have to be under a version
check anyway, unlike the VP8 path?

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/http: reconnect when connect reset by peer

2019-03-01 Thread Liu Steven


> 在 2019年3月1日,下午5:39,lmzeng(曾令明)  写道:
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> old mode 100644
> new mode 100755
> index ed0eb1c..400df94
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -253,6 +253,7 @@ static int http_open_cnx(URLContext *h, AVDictionary 
> **options)
> HTTPAuthType cur_auth_type, cur_proxy_auth_type;
> HTTPContext *s = h->priv_data;
> int location_changed, attempts = 0, redirects = 0;
> +int retry = 0;
> redo:
> av_dict_copy(options, s->chained_options, 0);
> 
> @@ -260,9 +261,21 @@ redo:
> cur_proxy_auth_type = s->auth_state.auth_type;
> 
> location_changed = http_open_cnx_internal(h, options);
> -if (location_changed < 0)
> +if (location_changed < 0) {
> +if (s->reconnect && retry++ < 3 &&
why don’t use option looks like ‘retry_times' instead the 3?
> +((location_changed == AVERROR(ECONNRESET)) || (location_changed 
> == AVERROR(EPIPE)) ||
> +(location_changed == AVERROR(ENETRESET)) || (location_changed == 
> AVERROR(ECONNREFUSED)) ||
> +(location_changed == AVERROR(ETIMEDOUT {
> +if (ff_network_sleep_interruptible(1000U*1000, 
> >interrupt_callback) != AVERROR(ETIMEDOUT)) {
> +goto fail;
> +}
> +if (s->hd) {
> +ffurl_closep(>hd);
> +}
> +goto redo;
> +}
> goto fail;
> -
> +}
> attempts++;
> if (s->http_code == 401) {
> if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) &&
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] avformat/http: reconnect when connect reset by peer

2019-03-01 Thread 曾令明
diff --git a/libavformat/http.c b/libavformat/http.c
old mode 100644
new mode 100755
index ed0eb1c..400df94
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -253,6 +253,7 @@ static int http_open_cnx(URLContext *h, AVDictionary 
**options)
 HTTPAuthType cur_auth_type, cur_proxy_auth_type;
 HTTPContext *s = h->priv_data;
 int location_changed, attempts = 0, redirects = 0;
+int retry = 0;
 redo:
 av_dict_copy(options, s->chained_options, 0);

@@ -260,9 +261,21 @@ redo:
 cur_proxy_auth_type = s->auth_state.auth_type;

 location_changed = http_open_cnx_internal(h, options);
-if (location_changed < 0)
+if (location_changed < 0) {
+if (s->reconnect && retry++ < 3 &&
+((location_changed == AVERROR(ECONNRESET)) || (location_changed == 
AVERROR(EPIPE)) ||
+(location_changed == AVERROR(ENETRESET)) || (location_changed == 
AVERROR(ECONNREFUSED)) ||
+(location_changed == AVERROR(ETIMEDOUT {
+if (ff_network_sleep_interruptible(1000U*1000, 
>interrupt_callback) != AVERROR(ETIMEDOUT)) {
+goto fail;
+}
+if (s->hd) {
+ffurl_closep(>hd);
+}
+goto redo;
+}
 goto fail;
-
+}
 attempts++;
 if (s->http_code == 401) {
 if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) &&

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/1] avformat/dashenc: Added #EXT-X-PROGRAM-DATE-TIME to HLS playlists

2019-03-01 Thread joepadmiraal
This is the second attempt for a patch that adds the #EXT-X-PROGRAM-DATE-TIME 
tag to HLS playlists when using the Dash muxer.
This time it is not increasing calculation complexity as time progresses.

joepadmiraal (1):
  avformat/dashenc: Added #EXT-X-PROGRAM-DATE-TIME to HLS playlists

 libavformat/dashenc.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

--
2.17.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/1] avformat/dashenc: Added #EXT-X-PROGRAM-DATE-TIME to HLS playlists

2019-03-01 Thread joepadmiraal
---
 libavformat/dashenc.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index c5e882f4ae..4ee4a0cf72 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -61,6 +61,7 @@ typedef struct Segment {
 int64_t start_pos;
 int range_length, index_length;
 int64_t time;
+double prog_date_time;
 int64_t duration;
 int n;
 } Segment;
@@ -122,6 +123,7 @@ typedef struct DASHContext {
 int64_t last_duration;
 int64_t total_duration;
 char availability_start_time[100];
+int64_t start_time_ms;
 char dirname[1024];
 const char *single_file_name;  /* file names as specified in options */
 const char *init_seg_name;
@@ -433,6 +435,8 @@ static void write_hls_media_playlist(OutputStream *os, 
AVFormatContext *s,
 const char *proto = avio_find_protocol_name(c->dirname);
 int use_rename = proto && !strcmp(proto, "file");
 int i, start_index, start_number;
+time_t start_time_s = c->start_time_ms / 1000;
+double prog_date_time = 0;
 
 get_start_index_number(os, c, _index, _number);
 
@@ -467,11 +471,21 @@ static void write_hls_media_playlist(OutputStream *os, 
AVFormatContext *s,
 
 for (i = start_index; i < os->nb_segments; i++) {
 Segment *seg = os->segments[i];
+double duration = (double) seg->duration / timescale;
+
+if (prog_date_time == 0) {
+if (os->nb_segments == 1)
+prog_date_time = start_time_s;
+else
+prog_date_time = seg->prog_date_time;
+}
+seg->prog_date_time = prog_date_time;
+
 ret = ff_hls_write_file_entry(c->m3u8_out, 0, c->single_file,
-(double) seg->duration / timescale, 0,
+duration, 0,
 seg->range_length, seg->start_pos, NULL,
 c->single_file ? os->initfile : seg->file,
-NULL);
+_date_time);
 if (ret < 0) {
 av_log(os->ctx, AV_LOG_WARNING, "ff_hls_write_file_entry get 
error\n");
 }
@@ -1592,9 +1606,12 @@ static int dash_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 os->first_pts = pkt->pts;
 os->last_pts = pkt->pts;
 
-if (!c->availability_start_time[0])
+if (!c->availability_start_time[0]) {
+int64_t start_time_us = av_gettime();
+c->start_time_ms = start_time_us / 1000;
 format_date_now(c->availability_start_time,
 sizeof(c->availability_start_time));
+}
 
 if (!os->availability_time_offset && pkt->duration) {
 int64_t frame_duration = av_rescale_q(pkt->duration, st->time_base,
-- 
2.17.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel