summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-23 11:39:07 +0200
committerwm4 <wm4@nowhere>2014-08-23 11:39:07 +0200
commit21f52aeeba2e8462c609006317251417ad9f3db3 (patch)
treec9f8a2a5258c80475a834ceab5a8c4656c820495
parentb55e09307581e45746f11a2eab2409a389c79012 (diff)
downloadmpv-21f52aeeba2e8462c609006317251417ad9f3db3.tar.bz2
mpv-21f52aeeba2e8462c609006317251417ad9f3db3.tar.xz
audio: minor improvements to timeline switching
In theory, timestamps can be negative, so we shouldn't just return -1 as special value. Remove the separate code for clearing decode buffers; use the same code that is used for normal seek reset.
-rw-r--r--player/audio.c7
-rw-r--r--player/core.h1
-rw-r--r--player/loadfile.c2
-rw-r--r--player/playloop.c8
4 files changed, 5 insertions, 13 deletions
diff --git a/player/audio.c b/player/audio.c
index 3a691fed09..a044a422cc 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -537,10 +537,3 @@ void clear_audio_output_buffers(struct MPContext *mpctx)
mp_audio_buffer_clear(mpctx->ao_buffer);
}
}
-
-// Drop decoded data queued for filtering.
-void clear_audio_decode_buffers(struct MPContext *mpctx)
-{
- if (mpctx->d_audio)
- mp_audio_buffer_clear(mpctx->d_audio->decode_buffer);
-}
diff --git a/player/core.h b/player/core.h
index 2c5328df38..800b9bf90a 100644
--- a/player/core.h
+++ b/player/core.h
@@ -365,7 +365,6 @@ double playing_audio_pts(struct MPContext *mpctx);
void fill_audio_out_buffers(struct MPContext *mpctx, double endpts);
double written_audio_pts(struct MPContext *mpctx);
void clear_audio_output_buffers(struct MPContext *mpctx);
-void clear_audio_decode_buffers(struct MPContext *mpctx);
// configfiles.c
void mp_parse_cfgfiles(struct MPContext *mpctx);
diff --git a/player/loadfile.c b/player/loadfile.c
index f3861e25eb..3833a80231 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -391,7 +391,7 @@ double timeline_set_from_time(struct MPContext *mpctx, double pts, bool *need_re
return pts - p->start + p->source_start;
}
}
- return -1;
+ return MP_NOPTS_VALUE;
}
static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
diff --git a/player/playloop.c b/player/playloop.c
index 2e4cfc43ab..4cf8407812 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -188,13 +188,13 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
bool need_reset = false;
demuxer_amount = timeline_set_from_time(mpctx, seek.amount,
&need_reset);
- if (demuxer_amount == -1) {
+ if (demuxer_amount == MP_NOPTS_VALUE) {
assert(!need_reset);
mpctx->stop_play = AT_END_OF_FILE;
- if (mpctx->d_audio && !timeline_fallthrough) {
- // Seek outside of the file -> clear audio from current position
- clear_audio_decode_buffers(mpctx);
+ // When seeking outside of the file, but not when ending last segment.
+ if (!timeline_fallthrough) {
clear_audio_output_buffers(mpctx);
+ reset_playback_state(mpctx);
}
return -1;
}