diff mbox

[FFmpeg-devel] avformat/hlsenc: fix too many open files bug

Message ID 20170119022038.6909-1-lq@chinaffmpeg.org
State Accepted
Commit 1c1031003b053e819185881ba512ebdffdbf637f
Headers show

Commit Message

Liu Steven Jan. 19, 2017, 2:20 a.m. UTC
When use http method to delete the old segments,
there is only io_open, hove not io_close yet,
this patch is used to fix it

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

殷焦元 Jan. 19, 2017, 3:22 a.m. UTC | #1
I test the new patch, it is OK.

Thanks


Yin Jiaoyuan


At 2017-01-19 10:20:38, "Steven Liu" <lq@chinaffmpeg.org> wrote:
>When use http method to delete the old segments,
>there is only io_open, hove not io_close yet,
>this patch is used to fix it
>
>Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>---
> libavformat/hlsenc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>index 1f4bf8b..85d3955 100644
>--- a/libavformat/hlsenc.c
>+++ b/libavformat/hlsenc.c
>@@ -300,6 +300,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
>             av_dict_set(&options, "method", "DELETE", 0);
>             if ((ret = hls->avf->io_open(hls->avf, &out, path, AVIO_FLAG_WRITE, &options)) < 0)
>                 goto fail;
>+            ff_format_io_close(hls->avf, &out);
>         } else if (unlink(path) < 0) {
>             av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
>                                      path, strerror(errno));
>@@ -322,6 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
>                     av_free(sub_path);
>                     goto fail;
>                 }
>+                ff_format_io_close(hls->avf, &out);
>             } else if (unlink(sub_path) < 0) {
>                 av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
>                                          sub_path, strerror(errno));
>-- 
>2.10.1.382.ga23ca1b.dirty
>
>
>
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Steven Liu Jan. 20, 2017, 5:05 a.m. UTC | #2
2017-01-19 11:22 GMT+08:00 殷焦元 <yinjiaoyuan@163.com>:

> I test the new patch, it is OK.
>
> Thanks
>
>
> Yin Jiaoyuan
>
>
> At 2017-01-19 10:20:38, "Steven Liu" <lq@chinaffmpeg.org> wrote:
> >When use http method to delete the old segments,
> >there is only io_open, hove not io_close yet,
> >this patch is used to fix it
> >
> >Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> >---
> > libavformat/hlsenc.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> >diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> >index 1f4bf8b..85d3955 100644
> >--- a/libavformat/hlsenc.c
> >+++ b/libavformat/hlsenc.c
> >@@ -300,6 +300,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
> >             av_dict_set(&options, "method", "DELETE", 0);
> >             if ((ret = hls->avf->io_open(hls->avf, &out, path,
> AVIO_FLAG_WRITE, &options)) < 0)
> >                 goto fail;
> >+            ff_format_io_close(hls->avf, &out);
> >         } else if (unlink(path) < 0) {
> >             av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s:
> %s\n",
> >                                      path, strerror(errno));
> >@@ -322,6 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
> >                     av_free(sub_path);
> >                     goto fail;
> >                 }
> >+                ff_format_io_close(hls->avf, &out);
> >             } else if (unlink(sub_path) < 0) {
> >                 av_log(hls, AV_LOG_ERROR, "failed to delete old segment
> %s: %s\n",
> >                                          sub_path, strerror(errno));
> >--
> >2.10.1.382.ga23ca1b.dirty
> >
> >
> >
> >_______________________________________________
> >ffmpeg-devel mailing list
> >ffmpeg-devel@ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Applied


Thanks
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 1f4bf8b..85d3955 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -300,6 +300,7 @@  static int hls_delete_old_segments(HLSContext *hls) {
             av_dict_set(&options, "method", "DELETE", 0);
             if ((ret = hls->avf->io_open(hls->avf, &out, path, AVIO_FLAG_WRITE, &options)) < 0)
                 goto fail;
+            ff_format_io_close(hls->avf, &out);
         } else if (unlink(path) < 0) {
             av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
                                      path, strerror(errno));
@@ -322,6 +323,7 @@  static int hls_delete_old_segments(HLSContext *hls) {
                     av_free(sub_path);
                     goto fail;
                 }
+                ff_format_io_close(hls->avf, &out);
             } else if (unlink(sub_path) < 0) {
                 av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
                                          sub_path, strerror(errno));