aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MPD/MPDWrapper.cpp55
-rw-r--r--MPD/MPDWrapper.h1
-rw-r--r--MPD/SegmentTemplateStream.cpp2
-rw-r--r--Managers/MultimediaManager.cpp2
-rw-r--r--UI/DASHPlayer.cpp18
-rw-r--r--UI/DASHPlayerNoGUI.cpp7
-rw-r--r--libdash/source/network/AbstractChunk.cpp3
7 files changed, 60 insertions, 28 deletions
diff --git a/MPD/MPDWrapper.cpp b/MPD/MPDWrapper.cpp
index 1e085546..0b1d9596 100644
--- a/MPD/MPDWrapper.cpp
+++ b/MPD/MPDWrapper.cpp
@@ -28,7 +28,9 @@ MPDWrapper::MPDWrapper(IMPD *mpd):
videoSegmentOffset (0),
audioSegmentOffset (0),
videoSegmentNumber (0),
- audioSegmentNumber (0)
+ audioSegmentNumber (0),
+ hasReachedEndOfList (false)
+
{
InitializeConditionVariable (&this->mpdUpdate);
InitializeCriticalSection(&this->monitorMutex);
@@ -102,7 +104,7 @@ void MPDWrapper::findAudioAdaptationSet (IMPD* mpd)
return;
}
}
- //Not found in the new set of adaptation logc => select the first one
+ //Not found in the new set of adaptation logc => select the first one
this->audioAdaptationSet = adaptationSets.at(0);
}
@@ -280,7 +282,7 @@ void MPDWrapper::initializeAdaptationSetStream (viper::managers::StreamType type
IAdaptationSet *adaptationSet = NULL;
std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations = NULL;
EnterCriticalSection(&this->monitorMutex);
-
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -302,7 +304,7 @@ void MPDWrapper::initializeAdaptationSetStream (viper::managers::StreamType type
default:
return;
}
-
+
for (size_t i = 0; i < adaptationSet->GetRepresentation().size(); i++)
{
IRepresentation *representation = adaptationSet->GetRepresentation().at(i);
@@ -530,7 +532,7 @@ std::vector<dash::mpd::IBaseUrl *> MPDWrapper::resolveBaseUrl (viper::managers::
{
urls.push_back(mpd->GetMPDPathBaseUrl());
}
-
+
return urls;
}
@@ -622,14 +624,7 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool
while((this->isStopping == false) && segmentNumber >= representationStream->getSize())
{
SleepConditionVariableCS(&this->mpdUpdate, &this->monitorMutex, INFINITE);
-
- if(this->isStopping)
- {
- LeaveCriticalSection(&this->monitorMutex);
- return NULL;
- }
-
- //Need to update representationStream here as it was updated with the mpd:
+ this->hasReachedEndOfList = true;
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -648,6 +643,31 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool
break;
}
representationStream = representations->find(representation)->second;
+ if(this->hasReachedEndOfList)
+ segmentNumber += 1;
+ }
+ if(this->isStopping)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ //Need to update representationStream here as it was updated with the mpd:
+ switch(type)
+ {
+ case viper::managers::StreamType::AUDIO:
+ segmentNumber = this->audioSegmentNumber;
+ break;
+ case viper::managers::StreamType::VIDEO:
+ segmentNumber = this->videoSegmentNumber;
+ break;
+ default:
+ break;
+ }
+ if(this->hasReachedEndOfList)
+ {
+ segmentNumber += 1;
+ this->hasReachedEndOfList = false;
}
}
uint64_t segDuration = 0;
@@ -687,6 +707,7 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool
}
media->SetSegmentDuration(segDuration);
segmentNumber++;
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -710,7 +731,7 @@ MediaObject* MPDWrapper::getSegment (viper::managers::StreamType type, uint32_t
IRepresentation* representation;
std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations;
EnterCriticalSection(&this->monitorMutex);
-
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -751,7 +772,7 @@ MediaObject* MPDWrapper::getInitSegment (viper::managers::StreamType type)
IRepresentation* representation;
std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations;
EnterCriticalSection(&this->monitorMutex);
-
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -853,7 +874,7 @@ uint32_t MPDWrapper::calculateSegmentOffset (viper::managers::StreamType type, u
IRepresentation* representation;
std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations;
EnterCriticalSection(&this->monitorMutex);
-
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
@@ -887,7 +908,7 @@ std::string MPDWrapper::getRepresentationID (viper::managers::StreamType type)
{
std::string id = "";
EnterCriticalSection(&this->monitorMutex);
-
+
switch(type)
{
case viper::managers::StreamType::AUDIO:
diff --git a/MPD/MPDWrapper.h b/MPD/MPDWrapper.h
index 902fa3dc..cf6275d8 100644
--- a/MPD/MPDWrapper.h
+++ b/MPD/MPDWrapper.h
@@ -125,6 +125,7 @@ private:
size_t videoSegmentNumber;
size_t audioSegmentNumber;
bool isStopping;
+ bool hasReachedEndOfList;
};
}
}
diff --git a/MPD/SegmentTemplateStream.cpp b/MPD/SegmentTemplateStream.cpp
index b0043d29..5a6dd67c 100644
--- a/MPD/SegmentTemplateStream.cpp
+++ b/MPD/SegmentTemplateStream.cpp
@@ -236,7 +236,7 @@ size_t SegmentTemplateStream::getSegmentNumber(uint64_t time)
size_t i;
for(i = 0; i < this->segmentStartTimes.size(); i ++)
{
- if(time < this->segmentStartTimes.at(i))
+ if(time <= this->segmentStartTimes.at(i))
{
break;
}
diff --git a/Managers/MultimediaManager.cpp b/Managers/MultimediaManager.cpp
index 997fc6de..1b759f4b 100644
--- a/Managers/MultimediaManager.cpp
+++ b/Managers/MultimediaManager.cpp
@@ -706,7 +706,7 @@ float MultimediaManager::getSegmentDuration()
return this->segmentDuration;
}
-static void* MultimediaManager::DoMPDFetching (void* data)
+void* MultimediaManager::DoMPDFetching (void* data)
{
MultimediaManager *manager = (MultimediaManager*) data;
uint32_t currTime = TimeResolver::getCurrentTimeInSec();
diff --git a/UI/DASHPlayer.cpp b/UI/DASHPlayer.cpp
index 31db2165..331748b5 100644
--- a/UI/DASHPlayer.cpp
+++ b/UI/DASHPlayer.cpp
@@ -296,16 +296,16 @@ void DASHPlayer::notifyStatistics(int segNum, uint32_t bitrate, int fps, uint32_
void DASHPlayer::updateSlider(qint64 value)
{
this->position = this->offset + (uint64_t)value;
- if (this->position <= this->gui->getDurationMilliseconds()){
- this->segment = (this->offset + value)/this->segmentDuration;
- this->gui->setAnaliticsValues(std::get<0>(this->mStats[segment])/1000000,
- std::get<2>(this->mStats[segment]),
- (uint32_t)this->qualityDownloading,
- (double)this->multimediaManager->getBufferLevel());
- this->gui->getProgressBar()->setProperty("value", 1.0*(this->position)/(1.0*this->gui->getDurationMilliseconds()));
- this->gui->getNowLabel()->setProperty("text", QVariant(msec2string(this->position).c_str()));
- this->gui->pauseIfBuffering(this->offset + value);
+ this->segment = (this->offset + value)/this->segmentDuration;
+ this->gui->setAnaliticsValues(std::get<0>(this->mStats[segment])/1000000,
+ std::get<2>(this->mStats[segment]),
+ (uint32_t)this->qualityDownloading,
+ (double)this->multimediaManager->getBufferLevel());
+ if (this->gui->getDurationMilliseconds() && this->position <= this->gui->getDurationMilliseconds()){
+ this->gui->getProgressBar()->setProperty("value", 1.0*(this->position)/(1.0*this->gui->getDurationMilliseconds()));
}
+ this->gui->getNowLabel()->setProperty("text", QVariant(msec2string(this->position).c_str()));
+ this->gui->pauseIfBuffering(this->offset + value);
}
void DASHPlayer::initSlider()
diff --git a/UI/DASHPlayerNoGUI.cpp b/UI/DASHPlayerNoGUI.cpp
index 2195b88a..c6670f13 100644
--- a/UI/DASHPlayerNoGUI.cpp
+++ b/UI/DASHPlayerNoGUI.cpp
@@ -172,6 +172,13 @@ void DASHPlayerNoGUI::parseArgs(int argc, char ** argv)
i++;
continue;
}
+ if(!strcmp(argv[i],"-buffersize"))
+ {
+ this->parameterAdaptation->segmentBufferSize = atoi(argv[i+1]);
+ i++;
+ i++;
+ continue;
+ }
if(!strcmp(argv[i],"-n"))
{
this->isICN = true;
diff --git a/libdash/source/network/AbstractChunk.cpp b/libdash/source/network/AbstractChunk.cpp
index 35774efe..81a3d57c 100644
--- a/libdash/source/network/AbstractChunk.cpp
+++ b/libdash/source/network/AbstractChunk.cpp
@@ -167,6 +167,9 @@ void* AbstractChunk::DownloadInternalConnection (void *abstractchunk)
curl_easy_getinfo(chunk->curl, CURLINFO_SPEED_DOWNLOAD,&speed);
curl_easy_getinfo(chunk->curl, CURLINFO_SIZE_DOWNLOAD, &size);
curl_easy_getinfo(chunk->curl, CURLINFO_TOTAL_TIME, &time);
+
+ std::cout << "Download " << chunk->AbsoluteURI() << " duration: " << (time * 1000000) << " [usec] size " << size <<
+ " [bytes] speed " << (speed*8)/1000 << " [kbps] " << std::endl;
//Speed is in Bps ==> *8 for the bps
speed = 8*speed;