When the TapasPlayer‘s play() method is issued the Parser downloads the manifest and populates two lists of dictionaries playlists and levels: the first one maintains information about segments (or chunks), the second one holds video levels (or representations) information. The two lists of dictionaries are then passed to the player. At this point two concurrent threads are started: 1) a thread that fills the playout buffer by fetching the video segments from the HTTP server and 2) a thread that drains the playout buffer to play the videostream. Let us now focus on the thread that fills the buffer. The following operations are executed in a loop until the last video segment has been played:
The Downloader fetches from the HTTP server the current segment at the selected video level.
- When the download is completed the following operations are performed:
- The segment is enqueued in the playout buffer handled by the MediaEngine component.
- The player gets from the MediaEngine the queue length and other feedbacks and builds the player feedback dictionary with this information. Then player feedback is passed to the Controller.
- The Controller computes two values: 1) the control action, i.e. the video level rate of the next segment to be downloaded; 2) the idle duration, possibly equal to zero, that is the time interval that has to elapse before the next video segment can be fetched.
A timer of duration idle duration is started. When the timer expires the loop repeats from step 1.
Finally, the thread draining the playout buffer is handled by the MediaEngine that decodes the compressed video frames, and plays the raw video.
Checks if the playback is going to buffering. Estimates the time required to complete the download of the current segment and verifies that it is less than the playout buffer lenght.
In the case of “warning buffering”, it deletes the current segment download, calculates the control action and sets the new level. This feature is available only with persistent connection.
Gets index of current level starting from 0 for the lowest video quality level
Gets max buffer in seconds under which the playback is considered in Buffering by default
Gets index of maximum level starting from 0 for the lowest video quality level
Starts Parser, creates Logger, initializes MediaEngine, and fetches the first segment when the parser has finished
Handles error when download a segment without persistent connection
Parameters: |
|
---|
Updates feedbacks, calculates the control action and sets level of the next segment.
Parameters: |
|
---|
Sets index of current level starting from 0 for the lowest video quality level
Parameters: | level – the level index |
---|
Sets index of the current segment of the sub-playlist
Parameters: | index – segment index |
---|
Sets the level corresponding to the rate specified in B/s
Parameters: | rate – rate in B/s that determines the level. The level is the one whose rate is the highest below rate. |
---|