Correcting bug that induced skipping of segments in the DL 74/8274/1
authorJacques Samain <[email protected]>
Thu, 31 Aug 2017 16:29:54 +0000 (18:29 +0200)
committerJacques Samain <[email protected]>
Thu, 31 Aug 2017 16:29:54 +0000 (18:29 +0200)
Change-Id: I742ad0782d8e6269d51051ccdf0f44d167b59a35
Signed-off-by: Jacques Samain <[email protected]>
MPD/MPDWrapper.cpp

index c7bdee9..3b269a7 100644 (file)
@@ -617,33 +617,31 @@ MediaObject*      MPDWrapper::getNextSegment      (viper::managers::StreamType type, bool
     else
     {
         while((this->isStopping == false) && segmentNumber >= representationStream->getSize())
-        {
             SleepConditionVariableCS(&this->mpdUpdate, &this->monitorMutex, INFINITE);
 
-            if(this->isStopping)
-            {
-                LeaveCriticalSection(&this->monitorMutex);
-                return NULL;
-            }
+        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:
-                    representation = this->audioRepresentation;
-                    representations = this->audioRepresentations;
-                    segmentNumber = this->audioSegmentNumber;
-                    break;
-                case viper::managers::StreamType::VIDEO:
-                    representation = this->videoRepresentation;
-                    representations = this->videoRepresentations;
-                    segmentNumber = this->videoSegmentNumber;
-                    break;
-                default:
-                    break;
-            }
-            representationStream = representations->find(representation)->second;
+        //Need to update representationStream here as it was updated with the mpd:
+        switch(type)
+        {
+            case viper::managers::StreamType::AUDIO:
+                representation = this->audioRepresentation;
+                representations = this->audioRepresentations;
+                segmentNumber = this->audioSegmentNumber;
+                break;
+            case viper::managers::StreamType::VIDEO:
+                representation = this->videoRepresentation;
+                representations = this->videoRepresentations;
+                segmentNumber = this->videoSegmentNumber;
+                break;
+            default:
+                break;
         }
+        representationStream = representations->find(representation)->second;
     }
     uint64_t segDuration = 0;
     //Returns the segmentDuration in milliseconds