# Improving Streaming Video with Deep Learning-Based Network Throughput Prediction
## 3 Theoretical Background
### Adaptation Strategies  
At the time \(t_{i+1}\), a video player, which has only information of the past network throughput \(\{r_{t},t\leq t_{i}\}\), selects the bit rate \(q_{i+1}\). To estimate the future throughput \(\{r_{t},t>t_{i}\}\), the player may use a predictor defined as \(\{\hat{r}_{t},t>t_{i}\}\). Except the throughput, a player may also take into account its buffer level. Having the information about the network and a buffer state, the player selects the next segment \(c_{i+1}\) quality, see Figure 1, as follows:  
\[q_{i+1}=f(b_{i},\{\hat{r}_{t},t>t_{i}\}).\]In our work, we presented three exemplary methods of the video bit rate selection. The first method is based on the simplified version of the algorithm implemented in the MSS video player, which is described in [21]. The second approach employs the implementation of ExoPlayer--a video player for Android developed by Google [22]. The third solution is described in [23], and we will further refer to it as _Tian2016_. The first algorithm selects a video bit rate as follows  
\[q_{i+1}=\left\{ \begin{array}{ll}q_{i}^{+}&b_{i}>B_{\max}\\ q_{i}^{-}&b_{i}<B_{\min}\\ q_{i}^{-}&b_{i}\in[B_{\min},B_{\max}]\wedge(q_{i}>\hat{r}_{i})\\ q_{i}&b_{i}\in[B_{\min},B_{\max}]\wedge\hat{r}_{i}-d<q_{i}<\hat{r}_{i}\\ q_{i}^{+}&b_{i}\in[B_{\min},B_{\max}]\wedge(q_{i}<\hat{r}_{i}-d)\\ \end{array} \right. \tag{2a}\] \[q_{i+1}=\left\{ \begin{array}{ll}q_{i}^{+}&b_{i}>B_{\max}\\ q_{i}^{-}&b_{i}<B_{\min}\\ q_{i}^{-}&b_{i}\in[B_{\min},B_{\max}]\wedge(q_{i}>\hat{r}_{i})\\ q_{i}&b_{i}\in[B_{\min},B_{\max}]\wedge\hat{r}_{i}-d<q_{i}<\hat{r}_{i}\\ q_{i}^{+}&b_{i}\in[B_{\min},B_{\max}]\wedge(q_{i}<\hat{r}_{i}-d)\\ \end{array} \right. \tag{2b}\]  
The buffer-based part of the algorithm selects the video bit rate considering the player's buffer state. When the buffer level reaches \(B_{\max}\), the system increases the bit rate (2a) by one level, denoted as \(q_{i}^{+}\). Similarly, when the playback drains the buffer below the threshold \(B_{\min}\) (2b), the player reduces the video quality by one level, denoted as \(q_{i}^{-}\). When the buffer level is between the thresholds \(B_{\min}\) and \(B_{\max}\), the player estimates throughput \(\hat{r}_{i}\) and selects a corresponding quality level. If the estimated throughput \(\hat{r}_{i}\) is lower than the video bit rate \(q_{i}\), the player decreases video quality (2c). The bit rate remains unchanged (2d), when the estimated throughput is not sufficiently high. In the case when the bit rate surpasses the throughput by at least \(d\) bits/s, the player increases the video quality (2e). The parameter \(d\) marks a stripe of the throughput for which the player continues to download videos of the same quality. Hence, the parameter \(d\) stabilizes video quality and prevents frequent switches, which degrades content reception. The constants \(Q_{\min}\) and \(Q_{\max}\) define the lowest and the highest bit rates of video segments. We implemented this idea in the open-source software _dash.js_[24] and presented it in Figure 2. Taking the experiment's parameters from [25], we set the player's buffer size \(B_{\text{full}}\) to 35 s and the thresholds \(B_{\min}\) and \(B_{\max}\) to 40% and 80% of the buffer size. Figure 1: Adaptation strategy for video. A video player chooses the quality of video, taking into account the prediction of network throughput and its buffer state. The second algorithm is a part of the ExoPlayer library. Its input parameters are a buffer size and throughput estimation. The algorithm calculates the video quality that fits in the currently available bandwidth according to the formula:  
\[q_{i+1}= \begin{cases}\max(Q)&q_{i+1}\leq\lambda\hat{r_{i}}\\ q_{i}&\hat{r_{i}}>r_{i-1}\wedge b_{i}<B_{\min}\left(\text{3b}\right)\\ q_{i}&\hat{r_{i}}<r_{i-1}\wedge b_{i}>B_{\max}\left(\text{3c}\right)\end{cases}