# Patent

## Title
Systems, methods, and computer program products for load adaptive streaming

## Abstract

Methods, systems, and computer program products that allow for the load adaptive downloading, processing, and rendering of video by a video processing client, where the downloading is adaptive to the processing load of a computing system on which a video processing client operates.

## Background
BACKGROUND
Adaptive video streaming is a method by which a receiving device or system selects a bitstream from among a set of bitstreams, each representing the same video interval, where the selected bitstream represents the highest quality level that can be sustained by the communications infrastructure and display. Each bitstream in the set of bitstreams may represent a different level, where a higher level corresponds to a higher bitrate and resolution. As a result, the bitstream at a higher level requires more processing time than the bitstream at a next lower level.
Not all platforms will have sufficient processing power to decode, with sufficient speed, the level that can be sustained by the network and display, however. Most notably, low powered personal computers (PCs) (such as laptops and older desktop PCs) may struggle with processing bitstreams at such a level. Furthermore, some computers, especially laptops, use dynamic frequency scaling. This allows the frequency of the central processing unit (CPU) to adapt, depending on the heat and power properties. This will affect the available processing power as well, possibly making it difficult for a computer to handle a bitstream level that is chosen on the basis of network and display capabilities. In addition, the CPUs may be shared with other running processes (programs), which reduces the available processing capacity for video processing. Therefore, the selection of a particular bitstream in an adaptive streaming system needs to consider the available processing power.



BRIEF DESCRIPTION OF THE DRAWINGS/FIGURES
FIG. 1 is a block diagram of an exemplary video system, according to an embodiment.
FIG. 2 illustrates a sorted list showing excess times to deliver frames, according to an embodiment.
FIG. 3A is a flow chart illustrating the selection of a lower decoding level, according to an embodiment.
FIG. 3B is a flow chart illustrating the selection of a higher decoding level, according to an embodiment.
FIG. 4 is a flow chart illustrating the flushing of a coded picture buffer, according to an embodiment.
FIG. 5 is a block diagram illustrating an exemplary computing system with which the processing described herein may be implemented, according to an embodiment.



In the drawings, the leftmost digit(s) of a reference number identifies the drawing in which the reference number first appears.
DETAILED DESCRIPTION
An embodiment is now described with reference to the figures, where like reference numbers indicate identical or functionally similar elements. While specific configurations and arrangements are discussed, it should be understood that this is done for illustrative purposes only. A person skilled in the relevant art will recognize that other configurations and arrangements can be used without departing from the spirit and scope of the description. It will be apparent to a person skilled in the relevant art that this can also be employed in a variety of other systems and applications other than what is described herein.
Disclosed herein are methods, systems, and computer program products that allow for the load adaptive downloading, processing, and rendering of video by a video processing client, where the downloading is adaptive to the processing load of a computing system on which a video processing client operates.
Generally, the processing power required to decode and render video streams increases monotonically with bitrate and resolution of the streams. The load adaptive functionality described herein may provide a smooth playback at a specific level, thus avoiding excessive stutter on the client. The load adaptive process chooses an appropriate decode level (i.e., an appropriate bitstream from the set of bitstreams) that is sustainable (i.e. a bitstream that can be decoded in real-time given the current system processing capabilities), and with the best visual quality. An embodiment of the process, which includes a predictive feedback based process, will initially start with no prior knowledge of the video system, and will acquire knowledge by analyzing performance data received from the video system. A decision for the maximum sustainable decode level may be made prior to download of a video segment, and will be based on the recent performance history of the video system. Occasionally, selection of a decode level may, under specific conditions, be followed by flushing some of the already-downloaded video data in an embodiment.
FIG. 1 illustrates an exemplary video processing system 100 in which load adaptive streaming may take place, according to an embodiment. A video frame 110 is received and placed in a coded picture buffer (CPB) 120. The number of frames held in CPB 120 will vary, depending on the rate at which frames are received and the rate at which they are read out. Video frames that are read from CPB 120 are decoded by video decoder 130. Decoded frames may then be stored in a first frame queue 140. After passing through queue 140, a decoded frame is then processed by video processing module(s) 150. The processing performed by module(s) 150 may include, for example, scaling, format conversion, and filtering operations. Processed frames may then be passed to a renderer 170, via a second frame queue 160.
In an embodiment, the load adaptive streaming process selects an initial playback bitrate from previously stored client configuration information. The client stores the maximum load adaptive decode level previously used during playback. For example, on WindowsTM, the client can store the maximum load adaptive level in the registry, in an embodiment. In the absence of a previous stored configuration, the load adaptive functionality can start from the lowest level.
From this initial state, a new decode level may be chosen, based on processing conditions, i.e., on the load being placed on the host computing system. There are many indications that could be used to determine whether the system can handle the load. Examples include CPU usage (as measured by the ratio of the amount of time in which the CPU is active to the time spent idle, for example) or the rate or extent of dropping of video frames. CPU usage may be used, but in an embodiment this is not considered as a measure as there is no strong correlation between the dead-line driven nature of the video system (i.e., the requirement for a certain number of frames per unit time) and the average load of a CPU. The rate of dropping frames is a useful measure, although it is reactive. A useful measure would indicate when the load is approaching the limit of a system. A video system must render a frame every frame period. From this follows that, on average, it must produce a frame every frame period, such that the second frame queue is never depleted.
The load-adaptive streaming process as described herein may use, as inputs, one or more of a variety of performance measures relating to the operations and delays of a system such as system 100. The following performance measurements may be used for load adaptive streaming functionality, according to an embodiment. In order to minimize communication overhead between the client video system and the load adaptive streaming process, the measurements may be assembled in the client's video system in a sample collection buffer and relayed to the load adaptive streaming process periodically.
A. Time to deliver a frame: The time to deliver a frame is a measurement of the total system time spent for decoding and video processing operations.
In an embodiment, the excess time to deliver a frame with respect to the frame period (referred to herein as excess frame time) may be used as a comparable measure. If the frame period is 40 ms and the time to deliver a frame is 50 ms then the excess frame time is 10 ms. The excess frame time is −10 ms when the time to deliver a frame is 30 ms. As a video system typically employs a frame queue, the delivery time is averaged over the frames in the queue. As can be concluded from empirical measurements, the time to deliver a frame varies considerably; however as all frames need to be delivered in time, the processing described here needs to consider only the outliers, i.e., the frames that take the longest time to process. In such an embodiment, a sorted list of the largest (or maximum) excess delivery times is maintained; the average of a subset of these maximum values is then calculated. In an embodiment, this subset represents a selected range of these maximum values. This average is used for comparison to a decision threshold. This average may be viewed as an average of a range of maximum excess delivery times. Note that the “excess delivery times” are determined as a function (e.g., the mean) of the delivery times of frames in the second queue in an embodiment.
FIG. 2 illustrates such a sorted list. The height of each vertical bar represents an excess frame delivery time. These heights, or times, may be averaged over a configurable range, for example 2 to 5, to derive an average of a range of maximum excess delivery times. This value may then be compared to a threshold value. There are two thresholds. If this average is below the lower threshold then a higher level can be selected. If this average is exceeding the higher threshold, this implies that the load of the host machine is excessive and leads to a shift to a lower decoding level.
In an embodiment, the difference between the two thresholds is larger than the expected performance increase. The lower threshold may be derived dynamically from the difference in resolution. In addition, in an embodiment, the thresholds may be derived dynamically in the client video system during operation. Alternatively, the thresholds may be configured statically by a remote server. The thresholds may also be stored locally at the client video system, and may be read at startup.
B. Total number of frames in the frame queue: Note that this value is dynamic
C. Dropped frame count over a predetermined period.
D. Current decode level.
E. The amount of video data in download buffers
F. The video resolution for each streaming level.
The choice of a lower decoding level is illustrated in FIG. 3A, according to an embodiment. At 310, the highest previous decode level is retrieved and is used as the default decode level initially. At 315, a determination is made as to whether the average of the range of maximum excess delivery times is greater than a first threshold value over a predetermined period. If so, then at 320, the next segment of video is downloaded at the next lower decode level. In an embodiment, a waiting period may be imposed before switching to the lower decode level. At 325, the coded picture buffer CPB is flushed. As will be described in greater detail below, this flushing is not generally complete, so that some frames will remain in the CPB after flushing.
The choice of a higher decode level is illustrated in FIG. 3B, according to an embodiment. At 360, a determination is made as to whether the average of the range of maximum excess delivery times is less than a second threshold value over a predetermined time period. If so, then at 365, the next segment of video is downloaded at the next higher decode level.
In an embodiment, a minimum observation period may be implemented, such that a lower decode level is chosen only if the average time to deliver exceeds the threshold for this minimum observation period. In an embodiment, this time period may be zero seconds, but in other embodiments, this minimum observation period may be non-zero. Analogously, another minimum observation period may be implemented, such that a higher decode level is chosen only if the average time to deliver is below the defined threshold for this minimum observation period.
The flushing of the CPB (325 above) is performed when the proper condition(s) are met, and only performed to a certain extent, according to an embodiment. This is illustrated in FIG. 4. At 410, a determination is made as to whether the percentage of dropped frames exceeds a frame drop threshold. If so, then the frames currently in the pipeline are not being processed quickly enough, and it becomes advantageous to remove some of the frames from the CPB. This flushing of the CPB takes place at 420. In an embodiment, the percentage of dropped frames depends on the total number of frames dropped over a predefined period.
The extent of the flushing may vary according to system conditions. Generally, not every frame will be removed. A flush may be performed when the current level results in dropped frames. In an embodiment, the percentage of dropped frames will determine the aggressiveness of the flush. In such an embodiment, if the percentage of dropped frames is less than 2%, no flush is needed. If the percentage of dropped frames is between 2% and 15%, the CPB is flushed to the extent that 11 seconds of video are kept in the CPB. If the percentage of dropped frames exceeds 15%, the CPB is flushed to the extent that 6 seconds of video are retained in the CPB. In alternative embodiments, the dropped frame threshold percentages may vary and the extent of flushing may vary.
Note that in some video systems, a rate adaptive streaming process may also be in place. In such a context, there may be a relationship between the rate adaptive and load adaptive algorithms. The rate adaptive algorithm may rely on buffering several seconds of video data to avoid re-buffering, whereas the load adaptive algorithm avoids excessive stutter by choosing an appropriate decode level and by sometimes purging downloaded data from the CPB of the client. In an embodiment, the client chooses the lower of the two levels recommended by the rate adaptive process and the load adaptive process.
One or more features disclosed herein may be implemented in hardware, software, firmware, and combinations thereof, including discrete and integrated circuit logic, application specific integrated circuit (ASIC) logic, and microcontrollers, and may be implemented as part of a domain-specific integrated circuit package, or a combination of integrated circuit packages. The term software, as used herein, refers to a computer program product including at least one computer readable medium having computer program logic stored therein to cause a computer system to perform one or more features and/or combinations of features disclosed herein. The computer readable medium may be transitory or non-transitory. An example of a transitory computer readable medium may be a digital signal transmitted over a radio frequency or over an electrical conductor, through a local or wide area network, or through a network such as the Internet. An example of a non-transitory computer readable medium may be a compact disk, a flash memory, RAM, ROM, or other data storage device.
In an embodiment, some or all of the processing described herein may be implemented as software or firmware. Such a software or firmware embodiment is illustrated in the context of a computing system 500 in FIG. 5. System 500 may include one or more central processing unit(s) (CPU), shown as processor(s) 520, and a body of memory 510 that includes one or more non-transitory computer readable media that store computer program logic 540. Memory 510 may be implemented as a read-only memory (ROM) or random access memory (RAM) device, for example. Processor(s) 520 and memory 510 may be in communication using any of several technologies known to one of ordinary skill in the art, such as a bus or a point-to-point interconnect. Computer program logic 540 contained in memory 510 may be read and executed by processor(s) 520. In an embodiment, one or more I/O ports and/or I/O devices, shown collectively as I/O 530, may also be connected to processor(s) 520 and memory 510. In an embodiment, I/O 530 may include the display of the user's computing device.
In the embodiment of FIG. 5, computer program logic 540 may include a module 550 responsible for monitoring the processing load of the system 500. As discussed above, this may include determining the average of the range of maximum excess delivery times and determining the percentage of dropped frames. Computer program logic 540 may also include a module 560 responsible for increasing the decode level for the next interval of video to be downloaded. Computer program logic 540 may include a module 570 responsible for decreasing the decode level for the next interval of video to be downloaded. Computer program logic 540 may also include a module 580 responsible for flushing the CPB under the circumstances described above. Note that the operation of modules 560-580 depends on the load conditions detected by load monitoring logic 550.
In an embodiment, constants and definitions in the processing described herein may also be programmable, along with a set of default parameters. These may include the following configuration parameters:

    a) Enable/Disable load adaptive functionality: The client is configured to either enable or disable the load adaptive functionality. On some platforms such as consumer electronic devices, this functionality may be disabled.
    b) Minimum amount of video data in the download buffer: The client should not flush the entire contents of the data buffer; a minimum amount of data may be retained, as discussed above, to prevent playback pause caused by re-buffering.
    c) Maximum history period: The load adaptive streaming process may use recent history to predict the maximum sustainable decode level for the video system. This value sets the width of the window of recently elapsed time to predict performance of the video system.
    d) Minimum observation period for choosing a higher decode level: The minimum time for a consistent performance increase which must be observed prior to up-switch to a higher decode level.
    e) Minimum observation period before choosing a lower decode level: The minimum time that is observed prior to down-switch. In an embodiment, this duration is observed even it is leads to stutter.
    f) Maximum number of frames in the sample collection buffer: The collection buffer, which shall be in the client video system, accumulates the measurements mentioned above. This value determines the number of measurement vectors that must be accumulated prior to sending the accumulated data to the load adaptive process.
    g) Threshold to trigger a switch to a higher decoding level. In some embodiments this might be derived from the difference in resolution between the current level and next level.
    h) Threshold to trigger a switch to a lower decoding level.
    i) Frame drop threshold: The maximum percentage of dropped frames over an historical period. This value establishes a threshold for the flushing requirements, as discussed above.


Methods and systems are disclosed herein with the aid of functional building blocks illustrating the functions, features, and relationships thereof. At least some of the boundaries of these functional building blocks have been arbitrarily defined herein for the convenience of the description. Alternate boundaries may be defined so long as the specified functions and relationships thereof are appropriately performed.
While various embodiments are disclosed herein, it should be understood that they have been presented by way of example only, and not limitation. It will be apparent to persons skilled in the relevant art that various changes in form and detail may be made therein without departing from the spirit and scope of the methods and systems disclosed herein. Thus, the breadth and scope of the claims should not be limited by any of the exemplary embodiments disclosed herein.

## Claims

1. A playback device configured to perform load and rate adaptive streaming, comprising:
a processor configured via a load and rate adaptive streaming application to request segments of video from among a plurality of bitstreams, where the plurality of bitstreams are encoded at different decode levels in which resolution and bitrate vary between different decode levels;
wherein the load and rate adaptive streaming application further configures the processor to:
download and buffer a segment of video from a first bitstream at an initial decode level, where the segment of video comprises at least a plurality of frames of encoded video that are buffered in a coded picture buffer within the playback device;
perform video processing to decode the plurality of frames of encoded video in the coded picture buffer in order to generate a plurality of frames of decoded video;
store the plurality of frames of decoded video in a frame queue for display;
accumulate measurements in a sample collection buffer, wherein the accumulated measurements comprise (i) a frame delivery time for each frame of decoded video in the frame queue and (ii) a number of dropped frames over a predefined period;
when the number of dropped frames over the predefined period exceeds a frame drop threshold, flush a portion of the frames of encoded video buffered in the coded picture buffer; and
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed a first threshold, download another segment of video from a second bitstream having a lower decode level than the decode level of the first bitstream.

2. The playback device of claim 1, wherein the processor is configured to download another segment of video from the second bitstream at the lower decode level after a minimum observation period.

3. The playback device of claim 1, wherein the load and rate adaptive streaming application further-configures the processor to:
when the playback device flushes the portion of the frames of encoded video buffered in the coded picture buffer, download a segment of video from the second bitstream at the lower decode level including a particular frame of encoded video that has a same play time as an encoded frame of video flushed from the coded picture buffer.

4. The playback device of claim 1, wherein the load and rate adaptive streaming application further configures the processor to:
accumulate and maintain a sorted list of frame delivery times in the sample collection buffer; and
determine when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed the first threshold by comparing a selected range of the sorted list to the first threshold.

5. The playback device of claim 1, wherein the number of frames flushed from the coded picture buffer is dependent on the number of dropped frames over the predefined period.

6. The playback device of claim 1, wherein the load and rate adaptive streaming application further configures the processor to:
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue are below a second threshold, download another segment of video from a third bitstream at a higher decode level; and
automatically calculate the second threshold such that the higher decode level does not exceed performance capabilities of the playback device.

7. The playback device of claim 6, wherein the load and rate adaptive streaming application further configures the processor to download another segment of video from the third bitstream at the higher decode level after a minimum observation period.

8. The playback device of claim 6, wherein the another segment of video is downloaded at the higher decoding level only when an average of the accumulated measurements of the frame delivery times is less than the second threshold by a predetermined amount.

9. The playback device of claim 6, wherein the load and rate adaptive streaming application further configures the processor to dynamically derive one or more of the first and second thresholds.

10. The playback device of claim 6, wherein one or more of the first and second thresholds is determined statically by a remote server in communication with the playback device.

11. The playback device of claim 6, wherein the load and rate adaptive streaming application further configures the processor to store one or more of the first and second thresholds locally in a storage of at the playback device for retrieval upon start up of the playback device.

12. The playback device of claim 1, wherein the initial decode level is equal to a maximum previous decode level.

13. A non-transitory machine readable medium storing a load and rate adaptive streaming application, the load and rate adaptive streaming application comprising sets of instructions for:
requesting segments of video from among a plurality of bitstreams, where the plurality of bitstreams are encoded at different decode levels in which resolution and bitrate vary between different decode levels;
downloading and buffering a segment of video from a first bitstream at an initial decode level, where the segment of video comprises at least a plurality of frames of encoded video that are buffered in a coded picture buffer within the playback device;
performing video processing to decode the plurality of frames of encoded video in the coded picture buffer in order to generate a plurality of frames of decoded video;
storing the plurality of frames of decoded video in a frame queue for display;
accumulating measurements in a sample collection buffer, wherein the accumulated measurements comprise (i) a frame delivery time for each frame of decoded video in the frame queue and (ii) a number of dropped frames over a predefined period;
when the number of dropped frames over the predefined period exceeds a frame drop threshold, flushing a portion of the frames of encoded video buffered in the coded picture buffer; and
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed a first threshold, downloading another segment of video from a second bitstream at a lower decode level having a lower resolution and bitrate than the resolution and bitrate of the initial decode level of the first bitstream.

14. The non-transitory machine readable medium of claim 13, wherein the set of instructions for downloading another segment of video from the second bitstream at the lower decode level is executed after a minimum observation period.

15. The non-transitory machine readable medium of claim 13, wherein the load and rate adaptive streaming application further comprises sets of instructions for:
when the playback device flushes the portion of the frames of encoded video buffered in the coded picture buffer, downloading a segment of video from the second bitstream at the lower decode level including a particular frame of encoded video that has a same play time as an encoded frame of video flushed from the coded picture buffer.

16. The non-transitory machine readable medium of claim 13, wherein the load and rate adaptive streaming application further comprises sets of instructions for:
accumulating and maintaining a sorted list of frame delivery times in the sample collection buffer; and
determining when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed the first threshold by comparing a selected range of the sorted list to the first threshold.

17. The non-transitory machine readable medium of claim 13, wherein the number of frames flushed from the coded picture buffer is dependent on the number of dropped frames over the predefined period.

18. The non-transitory machine readable medium of claim 13, wherein the load and rate adaptive streaming application further comprises sets of instructions for:
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue are below a second threshold, downloading another segment of video from a third bitstream at a higher decode level; and
automatically calculating the second threshold such that the higher decode level does not exceed performance capabilities of the playback device.

19. The non-transitory machine readable medium of claim 18, wherein the downloading of the another segment of video at the higher decode level takes place after a minimum observation period.

20. The non-transitory machine readable medium of claim 18, wherein the another segment of video is downloaded at the higher decoding level only when an average of the accumulated measurements of the frame delivery times is less than the second threshold by a predetermined amount.

21. The non-transitory machine readable medium of claim 18, wherein the load and rate adaptive streaming application further comprises sets of instructions for dynamically deriving one or more of the first and second thresholds.

22. The non-transitory machine readable medium of claim 18, wherein one or more of the first and second thresholds is determined statically by a remote server in communication with the playback device.

23. The non-transitory machine readable medium of claim 18, wherein the load and rate adaptive streaming application further comprises sets of instructions for storing one or more of the first and second thresholds locally in a storage of the playback device for retrieval upon start up of the playback device.

24. The non-transitory machine readable medium of claim 13, wherein the initial decode level is equal to a maximum previous decode level.

25. A method for performing a load and rate adaptive streaming process, the method performed by a playback device, the method comprising:
requesting segments of video from among a plurality of bitstreams using a playback device, where the plurality of bitstreams are encoded at different decode levels in which resolution and bitrate vary between different decode levels;
downloading and buffering a segment of video from a first bitstream at an initial decode level using the playback device, where the segment of video comprises at least a plurality of frames of encoded video that are buffered in a coded picture buffer within the playback device;
performing video processing using the playback device to decode the plurality of frames of encoded video in the coded picture buffer in order to generate a plurality of frames of decoded video;
storing the plurality of frames of decoded video in a frame queue for display using the playback device;
accumulating measurements in a sample collection buffer using the playback device, wherein the accumulated measurements comprise (i) a frame delivery time for each frame of decoded video in the frame queue and (ii) a number of dropped frames over a predefined period;
when the number of dropped frames over the predefined period exceeds a frame drop threshold, flushing a portion of the frames of encoded video buffered in the coded picture buffer using the playback device; and
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed a first threshold, downloading another segment of video from a second bitstream at a lower decode level than the decode level of the first bitstream using the playback device.

26. The method of claim 25, wherein the downloading of the another segment of video at the lower decode level takes place after a minimum observation period.

27. The method of claim 25 further comprising:
when the playback device flushes the portion of the frames of encoded video buffered in the coded picture buffer, downloading a segment of video from the second bitstream at the lower decode level including a particular frame of encoded video that has a same play time as an encoded frame of video flushed from the coded picture buffer.

28. The method of claim 25 further comprising:
accumulating and maintaining a sorted list of frame delivery times in the sample collection buffer using the playback device; and
determining when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue exceed the first threshold using the playback device by comparing a selected range of the sorted list to the first threshold.

29. The method of claim 25, wherein the number of frames flushed from the coded picture buffer is dependent on the number of dropped frames over the predefined period.

30. The method of claim 25, further comprising:
when the accumulated measurements of the frame delivery times for the frames of the decoded video in the frame queue are below a second threshold, downloading another segment of video from a third bitstream at a higher decode level using the playback device; and
automatically calculating the second threshold using the playback device such that the higher decode level does not exceed performance capabilities of the playback device.

31. The method of claim 30, wherein the downloading of the another segment of video at the higher decode level takes place after a minimum observation period.

32. The method of claim 30, wherein the another segment of video is downloaded at the higher decoding level only when an average of the accumulated measurements of the frame delivery times is less than the second threshold by a predetermined amount.

33. The method of claim 30 further comprising dynamically deriving one or more of the first and second thresholds.

34. The method of claim 30, wherein one or more of the first and second thresholds is determined statically by a remote server in communication with the playback device.

35. The method of claim 30 further comprising storing one or more of the first and second thresholds locally in a storage of the playback device.

36. The method of claim 30, wherein the initial decode level is equal to a maximum previous decode level.