Ignore:
Timestamp:
08/24/10 23:22:35 (21 months ago)
Author:
shiretu
Message:

-- added rolling playlists support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/applications/applestreamingclient/src/clientcontext.cpp

    r102 r103  
    291291 
    292292        //4. Is this the last item in the playlis? 
     293        FINEST("---------------------------------------------------"); 
    293294        if (_currentItemIndex >= pPlaylist->GetItemsCount()) { 
    294                 FINEST("End of list. Wait one sec and try again"); 
    295                 return EnqueueFetchChildPlaylist(_childPlaylists[optimalBw]->GetPlaylistUri(), optimalBw); 
    296         } 
     295                if (ReloadPlaylist(optimalBw)) { 
     296                        WARN("End of list. Wait one sec and try again"); 
     297                        FINEST("---------------------------------------------------"); 
     298                        return EnqueueFetchChildPlaylist(_childPlaylists[optimalBw]->GetPlaylistUri(), optimalBw); 
     299                } else { 
     300                        WARN("No playlist reload"); 
     301                        _currentItemIndex--; 
     302                } 
     303        } 
     304        FINEST("_currentItemIndex: %d", _currentItemIndex); 
     305        FINEST("---------------------------------------------------"); 
    297306 
    298307        //4. Get the item URI and the key URI if available 
    299308        string uri = pPlaylist->GetItemUri(_currentItemIndex); 
    300309        string keyUri = pPlaylist->GetItemKeyUri(_currentItemIndex); 
     310        _mediaSequences[optimalBw] = pPlaylist->GetItemMediaSequence(_currentItemIndex); 
    301311        if (keyUri != "") 
    302312                keyUri += "&" + _connectingString.sessionId; 
     
    392402        //7. Done 
    393403        return true; 
     404} 
     405 
     406bool ClientContext::ReloadPlaylist(uint32_t bw) { 
     407        if (!MAP_HAS1(_mediaSequences, bw)) { 
     408                FINEST("bw %d not in _mediaSequences", bw); 
     409                return true; 
     410        } 
     411        if (!MAP_HAS1(_childPlaylists, bw)) { 
     412                FINEST("bw %d not in playlists", bw); 
     413                return true; 
     414        } 
     415 
     416        uint32_t lastSequence = _mediaSequences[bw]; 
     417        FINEST("lastSequence: %d", lastSequence); 
     418        uint32_t playlistSequnece = _childPlaylists[bw]->GetLastMediaSequence(); 
     419        FINEST("playlistSequnece: %d", playlistSequnece); 
     420 
     421        return lastSequence == playlistSequnece; 
    394422} 
    395423 
Note: See TracChangeset for help on using the changeset viewer.