[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Restore clearing resume info for current track in playing_id3_sync
From:       rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date:       2023-10-31 16:40:09
Message-ID: 202310311640.39VGe9kL1955075 () archos ! rockbox ! org
[Download RAW message or body]

commit f377ad3ce773f738d322f7f8b6ca8db6d12aff54
Author: roman.artiukhin <bahusdrive@gmail.com>
Date:   Tue Oct 31 08:20:58 2023 +0200

    Restore clearing resume info for current track in playing_id3_sync
    
    Regression introduced in 3d5dd97c (#5426)
    
    Without it current playlist keeps last bookmark info so next time track is played \
again from bookmark.  
    Change-Id: Ifeff43a4a2d380056ef8a389c3c72e7254db4080

diff --git a/apps/playback.c b/apps/playback.c
index ad7075eaf9..031e981915 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1255,8 +1255,7 @@ static void audio_update_and_announce_next_track(const struct \
mp3entry *id3_next  
 /* Bring the user current mp3entry up to date and set a new offset for the
    buffered metadata */
-static void playing_id3_sync(struct track_info *user_infop,
-                             unsigned long elapsed, unsigned long offset)
+static void playing_id3_sync(struct track_info *user_infop, struct audio_resume_info \
*resume_info)  {
     id3_mutex_lock();
 
@@ -1264,16 +1263,18 @@ static void playing_id3_sync(struct track_info *user_infop,
 
     pcm_play_lock();
 
-    if (id3)
+    if (resume_info && id3)
     {
-        if (elapsed != (unsigned long)-1)
-            id3->elapsed = elapsed;
-
-        if (offset != (unsigned long)-1)
-            id3->offset = offset;
+        id3->elapsed = resume_info->elapsed;
+        id3->offset = resume_info->offset;
     }
     id3_write(PLAYING_ID3, id3);
 
+    if (!resume_info && id3)
+    {
+        id3->offset = 0;
+        id3->elapsed = 0;
+    }
     pcm_play_unlock();
 
     id3_mutex_unlock();
@@ -2433,7 +2434,7 @@ static void audio_on_finish_load_track(int id3_hid)
                change otherwise */
             bool was_valid = valid_mp3entry(id3_get(PLAYING_ID3));
 
-            playing_id3_sync(&info, -1, -1);
+            playing_id3_sync(&info, NULL);
 
             if (!was_valid)
             {
@@ -2626,7 +2627,7 @@ static void audio_begin_track_change(enum pcm_track_change_type \
type,  if (audio_start_codec(!track_skip_is_manual))
             {
                 if (track_skip_is_manual)
-                    playing_id3_sync(&info, -1, -1);
+                    playing_id3_sync(&info, NULL);
                 return;
             }
         }
@@ -2903,7 +2904,7 @@ static void audio_start_playback(const struct audio_resume_info \
*resume_info,  /* This is the currently playing track - get metadata, stat */
         struct track_info info;
         track_list_current(0, &info);
-        playing_id3_sync(&info, resume.elapsed, resume.offset);
+        playing_id3_sync(&info, &resume);
 
         if (valid_mp3entry(id3_get(PLAYING_ID3)))
         {
-- 
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/mailman/listinfo/rockbox-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic