diff mbox

[FFmpeg-devel,v2] libavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimeline element.

Message ID 1533946857-11282-1-git-send-email-raut.sanil@gmail.com
State Accepted
Commit 551a029a181abe2b7b6f16e9631423a12e9fcae9
Headers show

Commit Message

sanilraut Aug. 11, 2018, 12:20 a.m. UTC
Hi,
The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element.

Example streams:
1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd
2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd

---
 libavformat/dashdec.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Liu Steven Aug. 12, 2018, 8:35 a.m. UTC | #1
> On Aug 11, 2018, at 08:20, sanil <raut.sanil@gmail.com> wrote:
> 
> Hi,
> The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element.
> 
> Example streams:
> 1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd
> 2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd
> 
> ---
> libavformat/dashdec.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5730252..f851bbf 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -259,6 +259,12 @@ static int64_t get_segment_start_time_based_on_timeline(struct representation *p
>                 goto finish;
> 
>             start_time += pls->timelines[i]->duration;
> +
> +            if (pls->timelines[i]->repeat == -1) {
> +                start_time = pls->timelines[i]->duration * cur_seq_no;
> +                goto finish;
> +            }
> +
>             for (j = 0; j < pls->timelines[i]->repeat; j++) {
>                 num++;
>                 if (num == cur_seq_no)
> @@ -1322,7 +1328,12 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
>         int i = 0;
>         num = pls->first_seq_no + pls->n_timelines - 1;
>         for (i = 0; i < pls->n_timelines; i++) {
> -            num += pls->timelines[i]->repeat;
> +            if (pls->timelines[i]->repeat == -1) {
> +                int length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale;
> +                num =  c->period_duration / length_of_each_segment;
> +            } else {
> +                num += pls->timelines[i]->repeat;
> +            }
>         }
>     } else if (c->is_live && pls->fragment_duration) {
>         num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale)  / pls->fragment_duration;
> -- 
> Thanks,
> 
> 2.7.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


will apply


Thanks
Steven
diff mbox

Patch

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 5730252..f851bbf 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -259,6 +259,12 @@  static int64_t get_segment_start_time_based_on_timeline(struct representation *p
                 goto finish;
 
             start_time += pls->timelines[i]->duration;
+
+            if (pls->timelines[i]->repeat == -1) {
+                start_time = pls->timelines[i]->duration * cur_seq_no;
+                goto finish;
+            }
+
             for (j = 0; j < pls->timelines[i]->repeat; j++) {
                 num++;
                 if (num == cur_seq_no)
@@ -1322,7 +1328,12 @@  static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
         int i = 0;
         num = pls->first_seq_no + pls->n_timelines - 1;
         for (i = 0; i < pls->n_timelines; i++) {
-            num += pls->timelines[i]->repeat;
+            if (pls->timelines[i]->repeat == -1) {
+                int length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale;
+                num =  c->period_duration / length_of_each_segment;
+            } else {
+                num += pls->timelines[i]->repeat;
+            }
         }
     } else if (c->is_live && pls->fragment_duration) {
         num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale)  / pls->fragment_duration;