summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-04-25 16:44:09 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-04-25 16:44:09 +0200
commitc4a24df8d5ee18b7e249db57136ca8f8fea0064b (patch)
tree955a2ec7ae895597bfb9dd5a2bf4acccb755ee7c
parent847d899c197b7cb010d965d23cc0b285f841ab31 (diff)
fixed streaming audio seek issues (bug #1098)
-rw-r--r--plugins/gtkui/ddbseekbar.c14
-rw-r--r--streamer.c2
2 files changed, 9 insertions, 7 deletions
diff --git a/plugins/gtkui/ddbseekbar.c b/plugins/gtkui/ddbseekbar.c
index 71243c80..bd3b01dd 100644
--- a/plugins/gtkui/ddbseekbar.c
+++ b/plugins/gtkui/ddbseekbar.c
@@ -438,13 +438,15 @@ on_seekbar_button_release_event (GtkWidget *widget,
self->seekbar_moved = 1.0;
DB_playItem_t *trk = deadbeef->streamer_get_playing_track ();
if (trk) {
- GtkAllocation a;
- gtk_widget_get_allocation (widget, &a);
- float time = (event->x - a.x) * deadbeef->pl_get_item_duration (trk) / (a.width);
- if (time < 0) {
- time = 0;
+ if (deadbeef->pl_get_item_duration (trk) >= 0) {
+ GtkAllocation a;
+ gtk_widget_get_allocation (widget, &a);
+ float time = (event->x - a.x) * deadbeef->pl_get_item_duration (trk) / (a.width);
+ if (time < 0) {
+ time = 0;
+ }
+ deadbeef->sendmessage (DB_EV_SEEK, 0, time * 1000, 0);
}
- deadbeef->sendmessage (DB_EV_SEEK, 0, time * 1000, 0);
deadbeef->pl_item_unref (trk);
}
gtk_widget_queue_draw (widget);
diff --git a/streamer.c b/streamer.c
index 9fde3b2c..d081dc63 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1474,9 +1474,9 @@ streamer_thread (void *ctx) {
}
int seek = seekpos;
+ seekpos = -1;
if (seek >= 0 && pl_get_item_duration (playing_track) > 0) {
playpos = seek;
- seekpos = -1;
trace ("seeking to %d\n", seek);
float pos = seek;