rtsp: Don't warn about unparsed time ranges

Message ID 1429734260-38952-1-git-send-email-martin@martin.st
State Committed
Commit eb7ddb5066843ab16caf33b05eafb2576648b797
Headers show

Commit Message

Martin Storsjö April 22, 2015, 8:24 p.m.
This reverts most of 4e54432164.

This avoids warnings about "Invalid interval start specification 'now'"
for live rtsp streams.

We only try to parse some of the many valid values for time ranges
in RTSP - the other ones are fully valid but not interesting for the
use case in rtsp.c, so we shouldn't warn about them.

(Parsing the time ranges is needed to allow seeking, but e.g. setting
the current realtime clock for the start time doesn't make sense.
av_parse_time has got a different mode for parsing absolute times
as well, which can handle the special case "now", but that doesn't
make much sense for this particular use in rtsp.c.)
---
 libavformat/rtsp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Thomas Volkert April 22, 2015, 9:04 p.m. | #1
Am 22.04.2015 um 22:24 schrieb Martin Storsjö:
> This reverts most of 4e54432164.
Could we reword this to something like "This removes the debug output 
which were introduced by 4e54432164 - the error handling remains like it 
was."?
(This empasizes that the change in error handling is not removed as well 
- I had this impression before I had compared both commits.)

>
> This avoids warnings about "Invalid interval start specification 'now'"
> for live rtsp streams.
>
> We only try to parse some of the many valid values for time ranges
> in RTSP - the other ones are fully valid but not interesting for the
> use case in rtsp.c, so we shouldn't warn about them.
>
> (Parsing the time ranges is needed to allow seeking, but e.g. setting
> the current realtime clock for the start time doesn't make sense.
> av_parse_time has got a different mode for parsing absolute times
> as well, which can handle the special case "now", but that doesn't
> make much sense for this particular use in rtsp.c.)
> ---
>   libavformat/rtsp.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 70b948d..1b60b4f 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -169,15 +169,12 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
>       *end = AV_NOPTS_VALUE;
>   
>       get_word_sep(buf, sizeof(buf), "-", &p);
> -    if (av_parse_time(start, buf, 1) < 0) {
> -        av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", buf);
> +    if (av_parse_time(start, buf, 1) < 0)
>           return;
> -    }
>       if (*p == '-') {
>           p++;
>           get_word_sep(buf, sizeof(buf), "-", &p);
> -        if (av_parse_time(end, buf, 1) < 0)
> -            av_log(NULL, AV_LOG_ERROR, "Invalid interval end specification '%s'\n", buf);
> +        av_parse_time(end, buf, 1);
>       }
>   }

LGTM

BR,
Thomas.
Martin Storsjö April 23, 2015, 7:41 a.m. | #2
On Wed, 22 Apr 2015, Thomas Volkert wrote:

>
> Am 22.04.2015 um 22:24 schrieb Martin Storsjö:
>> This reverts most of 4e54432164.
> 
> Could we reword this to something like "This removes the debug output which 
> were introduced by 4e54432164 - the error handling remains like it was."?
> (This empasizes that the change in error handling is not removed as well - I 
> had this impression before I had compared both commits.)

Sure, changed the commit message locally like this.

// Martin

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 70b948d..1b60b4f 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -169,15 +169,12 @@  static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
     *end = AV_NOPTS_VALUE;
 
     get_word_sep(buf, sizeof(buf), "-", &p);
-    if (av_parse_time(start, buf, 1) < 0) {
-        av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", buf);
+    if (av_parse_time(start, buf, 1) < 0)
         return;
-    }
     if (*p == '-') {
         p++;
         get_word_sep(buf, sizeof(buf), "-", &p);
-        if (av_parse_time(end, buf, 1) < 0)
-            av_log(NULL, AV_LOG_ERROR, "Invalid interval end specification '%s'\n", buf);
+        av_parse_time(end, buf, 1);
     }
 }