On 11 Nov 2014, at 0:56, Timothy Gu wrote:

> Real name please.

Changed the patches to used my realname now.

> These are two unrelated changes and should therefore be split into two
> patches.

Splitted them up into two different patches

>> -    if (NOT_EMPTY(s->content_type))
>> -        av_dict_set(&opt_dict, "content_type", s->content_type, 0);
>> +    av_dict_set(&opt_dict, "content_type", s->content_type, 0);
>
>
> This change LGTM.

Changed it, since this would break my later check if no content-type
was set by the user.

>> +       av_dict_set(&opt_dict, "send_expect_100", "1", 0);
>
>
> Not sure about this one.

Why not? This is needed for proper error reporting. Modified it,
so that it is only used for non-legacy PUT requests. It would
work with SOURCE requests too, but only because the http
implementation of ffmpeg isn't that strict about it and it's
better not to rely on this in my opinion.


From 7793d03db264e16ada19f8bc772e1be15466ce34 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epira...@gmail.com>
Date: Tue, 11 Nov 2014 01:51:23 +0100
Subject: [PATCH 1/2] Icecast: always send a content-type

use a default (audio/mpeg for historical reason) if none. Required since 
Icecast 2.4.1
Not using AVOption default because this breaks content-type warnings (needs to
detect if no type was set by the user)
---
 libavformat/icecast.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/icecast.c b/libavformat/icecast.c
index 7d60e44..7472416 100644
--- a/libavformat/icecast.c
+++ b/libavformat/icecast.c
@@ -117,6 +117,8 @@ static int icecast_open(URLContext *h, const char *uri, int 
flags)
     av_dict_set(&opt_dict, "chunked_post", "0", 0);
     if (NOT_EMPTY(s->content_type))
         av_dict_set(&opt_dict, "content_type", s->content_type, 0);
+    else
+        av_dict_set(&opt_dict, "content_type", "audio/mpeg", 0);
     if (NOT_EMPTY(s->user_agent))
         av_dict_set(&opt_dict, "user_agent", s->user_agent, 0);
 
-- 
2.1.0

From dd8853c36b84aa738521e4b80d43877b5a8a0bbc Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epira...@gmail.com>
Date: Tue, 11 Nov 2014 02:10:22 +0100
Subject: [PATCH 2/2] Icecast: Use 100-continue if possible for proper error
 handling

Using 100-continue ffmpeg will only send data if the server confirms it,
so if there is an error with auth or mounpoint, this allows that it is
properly reported to the user. Else ffmpeg sends data and just quits at
some point without an error message.
---
 libavformat/icecast.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/icecast.c b/libavformat/icecast.c
index 7472416..973c0c2 100644
--- a/libavformat/icecast.c
+++ b/libavformat/icecast.c
@@ -119,6 +119,7 @@ static int icecast_open(URLContext *h, const char *uri, int 
flags)
         av_dict_set(&opt_dict, "content_type", s->content_type, 0);
     else
         av_dict_set(&opt_dict, "content_type", "audio/mpeg", 0);
+    av_dict_set(&opt_dict, "send_expect_100", s->legacy_icecast ? "0" : "1", 
0);
     if (NOT_EMPTY(s->user_agent))
         av_dict_set(&opt_dict, "user_agent", s->user_agent, 0);
 
-- 
2.1.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to