Skip to content

Commit 4e3e125

Browse files
committed
增加切歌的最小间隔时间,解决连续切歌会卡死的问题
1 parent 6e3be66 commit 4e3e125

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

apps/player/playinglist.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void Playinglist::startSlient(){
6464
mParticleplayer = NULL;
6565
isWakeLock = 0;
6666
mOrderBy = -1;
67-
67+
mLastPlayTime = 0;
6868
clearPlay();
6969
}
7070

@@ -544,7 +544,10 @@ void Playinglist::startSlient(){
544544
if(playPath == NULL || !FileAttr::FileExist(playPath) || Environment::get_file_size(playPath)<10)
545545
return -3;
546546

547-
547+
ULONGLONG interval = Time::getMillisecond() - mLastPlayTime;
548+
if(interval<PLAY_INTERVAL){
549+
Thread::sleep(PLAY_INTERVAL - interval);
550+
}
548551

549552
if(inPause){
550553
setInPauseState(0);
@@ -590,7 +593,7 @@ void Playinglist::startSlient(){
590593
gPlayer.VolumeCheck();
591594

592595
}
593-
596+
mLastPlayTime = Time::getMillisecond();
594597
if(needGapless&&mGapless>0){
595598
//mParticleplayer->setNextSongForGapless(playPath);//(getItem(mCurrent+1)->path);
596599
}

apps/player/playinglist.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <fcntl.h>
88
#include "MediaPlayerInterface.h"
99

10-
10+
#define PLAY_INTERVAL 200 //ms
1111

1212
namespace mango
1313
{
@@ -35,6 +35,7 @@ namespace mango
3535
int inPause;
3636
int isWakeLock;
3737
int mOrderBy;
38+
ULONGLONG mLastPlayTime;
3839

3940
Playinglist();
4041
~Playinglist();

base/view/staticView.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,28 @@ namespace mango
148148
}
149149

150150

151-
151+
#define DEBGU 1
152152
void StaticView::updateTextPaintExtent(const TCHAR* title)
153153
{
154154
Canvas* canvas;
155155

156156
if (title)
157157
{
158-
158+
#if DEBGU
159+
gSessionLocal.mCanvasMutex.lock();
159160
canvas = &gSessionLocal.mStockGraphic.mCanvas;
161+
#else
162+
canvas = getCanvas();
163+
#endif
160164
canvas->setTextColor(mColor);
161165
canvas->setTextSize(mTextSize);
162166
canvas->getTextExtentPoint(title, -1, mTitlePaintExtent);
163-
//releaseCanvas();
167+
#if DEBGU
168+
releaseCanvas();
169+
#else
170+
releaseCanvas();
171+
#endif
172+
164173
}
165174
else
166175
{

0 commit comments

Comments
 (0)