## 2 Adaptive Streaming Algorithm for Internet of Autonomous Vehicles
### Streaming Service Support for an Autonomous Vehicle  
When a passenger in an autonomous vehicle initiates a streaming service, this module initiates a connection with the server of the streaming service provider. The purpose of this connection is to collect the necessary requirements and specifications for the streaming service. Subsequently, the module engages with the RSUs positioned along the vehicle's route. The primary objective is to assess whether the bandwidth supplied by the base stations, which cover the segments through which the vehicle travels, aligns with the streaming application's demands. During this evaluation, the module carefully considers the passenger's predefined quality preferences for their streaming experience. The aim is to ensure that the selected base stations can adequately support the desired streaming quality for the duration of travel along each road segment. In cases of bandwidth insufficiency during peak hours, this module will transmit bandwidth requirement-related information of the autonomous vehicle passenger's streaming service application to the RSUs positioned along the various road segments traversed during the application's usage. These RSUs will then, based on the streaming service application's characteristics and specification demands, undertake bandwidth allocation or preload planning of video segments for the streaming service application as the autonomous vehicle journeys through the managed route segments. Additionally, this module will also respond to bandwidth supply-demand imbalances that arise during peak periods. It will proactively adjust the bandwidth requirements and quality of the streaming service as necessary. The steps executed by this module are as follows:  
1. Upon activation of the streaming service application by the autonomous vehicle passenger, the module interacts with the streaming service provider's server to acquire the relevant requirements and specifications of the application. Concurrently, this module establishes communication with RSUs positioned along the predetermined route of the autonomous vehicle. The aim is to retrieve information regarding the minimum bandwidth that the base stations can offer as the vehicle traverses through individual road segments. 2. In the event that the streaming service application pertains to an on-demand streaming service, the process advances to Step 9 for continued execution. 3. Using the duration of the autonomous vehicle's presence on each road segment and considering the streaming resolution chosen by the passenger, this module computes the dynamic bandwidth needed for each time interval throughout the vehicle's journey. It subsequently applies the following equations to determine whether the bandwidth from the surrounding base stations meets the necessary criteria for uninterrupted real-time streaming. \[dub_{t_{j}^{\prime,A}}^{\sigma,A}=\gamma^{\sigma,A}.\left[\sum_{\theta}ub_{t_ {j}^{\prime,A}}^{\theta,\sigma,A}-\underline{\text{UR}}\left(uvr_{t_{j}^{ \prime,A}}^{\sigma,A}\right)\right],\,1\leq j\leq e^{\sigma,A} \tag{15}\]  
\[ursu_{t_{j}^{\prime,A}}^{\sigma,A}= \begin{cases}rsu_{p_{1}^{\prime}}&\text{if }dub_{t_{j}^{\prime,A}}^{\sigma,A}<0,\,\,at_{p_{1}^{\prime}}\leq t_{j}^{ \sigma,A}\leq at_{p_{1+1}^{\prime}},\,1\leq j\leq e^{\sigma,A},1\leq i<h^{ \sigma}\\ 0&\text{else}\end{cases}  \tag{16}\]  
\[ddb_{t_{j}^{\prime,A}}^{\sigma,A}=\sum_{\theta}db_{t_{j}^{\prime,A}}^{\theta, \sigma,A}-\underline{\text{DR}}\left(dvr_{t_{j}^{\prime,A}}^{\sigma,A}\right),\,\,1\leq j\leq e^{\sigma,A} \tag{17}\]  
\[drsu_{t_{j}^{\prime,A}}^{\sigma,A}= \begin{cases}rsu_{p_{1}^{\prime}}&\text{if }ddb_{t_{j}^{\prime,A}}^{\sigma,A}<0,\,\,at_{p_{1}^{\prime}}\leq t_{j}^{ \sigma,A}\leq at_{p_{1+1}^{\prime}},\,1\leq j\leq e^{\sigma,A},1\leq i<h^{ \sigma}\\ 0&\text{else}\end{cases}