mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
webtv: try to restart channel once, if play position not advance
This commit is contained in:
@@ -609,9 +609,31 @@ void* CMoviePlayerGui::bgPlayThread(void *arg)
|
|||||||
set_threadname(__func__);
|
set_threadname(__func__);
|
||||||
CMoviePlayerGui *mp = (CMoviePlayerGui *) arg;
|
CMoviePlayerGui *mp = (CMoviePlayerGui *) arg;
|
||||||
|
|
||||||
bgmutex.lock();
|
int eof = 0, pos = 0;
|
||||||
cond.wait(&bgmutex);
|
while(true) {
|
||||||
bgmutex.unlock();
|
if (mp->playback->GetPosition(mp->position, mp->duration)) {
|
||||||
|
#if 0
|
||||||
|
printf("CMoviePlayerGui::bgPlayThread: position %d duration %d (%d)\n", mp->position, mp->duration, mp->duration-mp->position);
|
||||||
|
#endif
|
||||||
|
if (pos == mp->position)
|
||||||
|
eof++;
|
||||||
|
else
|
||||||
|
eof = 0;
|
||||||
|
if (eof > 2) {
|
||||||
|
printf("CMoviePlayerGui::bgPlayThread: playback stopped, try to rezap...\n");
|
||||||
|
t_channel_id * chid = new t_channel_id;
|
||||||
|
*chid = mp->movie_info.epgId;
|
||||||
|
g_RCInput->postMsg(NeutrinoMessages::EVT_WEBTV_ZAP_COMPLETE, (neutrino_msg_data_t) chid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pos = mp->position;
|
||||||
|
}
|
||||||
|
bgmutex.lock();
|
||||||
|
int res = cond.wait(&bgmutex, 1000);
|
||||||
|
bgmutex.unlock();
|
||||||
|
if (res == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
printf("%s: play end...\n", __func__);
|
printf("%s: play end...\n", __func__);
|
||||||
mp->PlayFileEnd();
|
mp->PlayFileEnd();
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
@@ -660,7 +682,7 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
|
|||||||
fprintf(stderr, "ERROR: pthread_create(%s)\n", __func__);
|
fprintf(stderr, "ERROR: pthread_create(%s)\n", __func__);
|
||||||
} else
|
} else
|
||||||
PlayFileEnd();
|
PlayFileEnd();
|
||||||
printf("%s: this %p started: res %d thread %p\n", __func__, this, res, CMoviePlayerGui::bgPlayThread);fflush(stdout);
|
printf("%s: this %p started: res %d thread %lx\n", __func__, this, res, bgThread);fflush(stdout);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,7 +693,7 @@ void CMoviePlayerGui::stopPlayBack(void)
|
|||||||
|
|
||||||
repeat_mode = REPEAT_OFF;
|
repeat_mode = REPEAT_OFF;
|
||||||
if (bgThread) {
|
if (bgThread) {
|
||||||
printf("%s: this %p join background thread %p\n", __func__, this, CMoviePlayerGui::bgPlayThread);fflush(stdout);
|
printf("%s: this %p join background thread %lx\n", __func__, this, bgThread);fflush(stdout);
|
||||||
cond.broadcast();
|
cond.broadcast();
|
||||||
pthread_join(bgThread, NULL);
|
pthread_join(bgThread, NULL);
|
||||||
bgThread = 0;
|
bgThread = 0;
|
||||||
|
@@ -2676,11 +2676,14 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
|||||||
delete [] (unsigned char*) data;
|
delete [] (unsigned char*) data;
|
||||||
} else {
|
} else {
|
||||||
CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel();
|
CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel();
|
||||||
CMoviePlayerGui::getInstance().stopPlayBack();
|
if (cc && (chid == cc->getChannelID())) {
|
||||||
if (CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID()))
|
CMoviePlayerGui::getInstance().stopPlayBack();
|
||||||
|
if (CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID()))
|
||||||
|
delete [] (unsigned char*) data;
|
||||||
|
else
|
||||||
|
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data);
|
||||||
|
} else
|
||||||
delete [] (unsigned char*) data;
|
delete [] (unsigned char*) data;
|
||||||
else
|
|
||||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data);
|
|
||||||
}
|
}
|
||||||
return messages_return::handled;
|
return messages_return::handled;
|
||||||
}
|
}
|
||||||
@@ -3627,7 +3630,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
|
|||||||
if (my_system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0)
|
if (my_system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0)
|
||||||
perror(NEUTRINO_ENTER_STANDBY_SCRIPT " failed");
|
perror(NEUTRINO_ENTER_STANDBY_SCRIPT " failed");
|
||||||
bool alive = recordingstatus || CEpgScan::getInstance()->Running() ||
|
bool alive = recordingstatus || CEpgScan::getInstance()->Running() ||
|
||||||
CStreamManager::getInstance()->StreamStatus();
|
CStreamManager::getInstance()->StreamStatus();
|
||||||
if(!alive)
|
if(!alive)
|
||||||
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
|
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user