[FFmpeg-cvslog] avformat/dashdec: use the current DASHContext for the rep_dest

Steven Liu git at videolan.org
Fri Nov 10 01:03:00 EET 2017


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Fri Nov 10 07:01:45 2017 +0800| [1b323c3f9c8997c4df8e843cb065f10d097ae18c] | committer: Steven Liu

avformat/dashdec: use the current DASHContext for the rep_dest

fix ticket id: #6820

Signed-off-by: Steven Liu <lq at onvideo.cn>
Tested-by: mrskman

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b323c3f9c8997c4df8e843cb065f10d097ae18c
---

 libavformat/dashdec.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index bc20fb7486..0e3afd2a3b 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1079,9 +1079,8 @@ static int64_t calc_min_seg_no(AVFormatContext *s, struct representation *pls)
     return num;
 }
 
-static int64_t calc_max_seg_no(struct representation *pls)
+static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
 {
-    DASHContext *c = pls->parent->priv_data;
     int64_t num = 0;
 
     if (pls->n_fragments) {
@@ -1101,21 +1100,21 @@ static int64_t calc_max_seg_no(struct representation *pls)
     return num;
 }
 
-static void move_timelines(struct representation *rep_src, struct representation *rep_dest)
+static void move_timelines(struct representation *rep_src, struct representation *rep_dest, DASHContext *c)
 {
     if (rep_dest && rep_src ) {
         free_timelines_list(rep_dest);
         rep_dest->timelines    = rep_src->timelines;
         rep_dest->n_timelines  = rep_src->n_timelines;
         rep_dest->first_seq_no = rep_src->first_seq_no;
-        rep_dest->last_seq_no = calc_max_seg_no(rep_dest);
+        rep_dest->last_seq_no = calc_max_seg_no(rep_dest, c);
         rep_src->timelines = NULL;
         rep_src->n_timelines = 0;
         rep_dest->cur_seq_no = rep_src->cur_seq_no;
     }
 }
 
-static void move_segments(struct representation *rep_src, struct representation *rep_dest)
+static void move_segments(struct representation *rep_src, struct representation *rep_dest, DASHContext *c)
 {
     if (rep_dest && rep_src ) {
         free_fragment_list(rep_dest);
@@ -1126,7 +1125,7 @@ static void move_segments(struct representation *rep_src, struct representation
         rep_dest->fragments    = rep_src->fragments;
         rep_dest->n_fragments  = rep_src->n_fragments;
         rep_dest->parent  = rep_src->parent;
-        rep_dest->last_seq_no = calc_max_seg_no(rep_dest);
+        rep_dest->last_seq_no = calc_max_seg_no(rep_dest, c);
         rep_src->fragments = NULL;
         rep_src->n_fragments = 0;
     }
@@ -1163,21 +1162,21 @@ static int refresh_manifest(AVFormatContext *s)
         if (cur_video && cur_video->timelines) {
             c->cur_video->cur_seq_no = calc_next_seg_no_from_timelines(c->cur_video, currentVideoTime * cur_video->fragment_timescale - 1);
             if (c->cur_video->cur_seq_no >= 0) {
-                move_timelines(c->cur_video, cur_video);
+                move_timelines(c->cur_video, cur_video, c);
             }
         }
         if (cur_audio && cur_audio->timelines) {
             c->cur_audio->cur_seq_no = calc_next_seg_no_from_timelines(c->cur_audio, currentAudioTime * cur_audio->fragment_timescale - 1);
             if (c->cur_audio->cur_seq_no >= 0) {
-               move_timelines(c->cur_audio, cur_audio);
+               move_timelines(c->cur_audio, cur_audio, c);
             }
         }
     }
     if (cur_video && cur_video->fragments) {
-        move_segments(c->cur_video, cur_video);
+        move_segments(c->cur_video, cur_video, c);
     }
     if (cur_audio && cur_audio->fragments) {
-        move_segments(c->cur_audio, cur_audio);
+        move_segments(c->cur_audio, cur_audio, c);
     }
 
 finish:
@@ -1226,7 +1225,7 @@ static struct fragment *get_current_fragment(struct representation *pls)
     }
     if (c->is_live) {
         min_seq_no = calc_min_seg_no(pls->parent, pls);
-        max_seq_no = calc_max_seg_no(pls);
+        max_seq_no = calc_max_seg_no(pls, c);
 
         if (pls->timelines || pls->fragments) {
             refresh_manifest(pls->parent);
@@ -1564,7 +1563,7 @@ static int open_demux_for_component(AVFormatContext *s, struct representation *p
 
     pls->parent = s;
     pls->cur_seq_no  = calc_cur_seg_no(s, pls);
-    pls->last_seq_no = calc_max_seg_no(pls);
+    pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
 
     ret = reopen_demux_for_component(s, pls);
     if (ret < 0) {



More information about the ffmpeg-cvslog mailing list