Method and device for carrying out online video transmission by adopting Quic protocol
By using the Quic protocol to establish Quic connections between edge nodes in the PCDN scenario, the problem of low data transmission efficiency and unreliability of P2P edge nodes is solved, and more efficient and reliable video transmission is achieved.
Patent Information
- Application Number
- CN202410787038.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-11
AI Technical Summary
In the PCDN scenario, data transmission between P2P edge nodes is inefficient and unreliable, mainly due to the time consumption caused by the retransmission mechanism, confirmation mechanism and congestion control mechanism of the TCP protocol, as well as the unreliability of the UDP protocol.
Use the Quic protocol for online video transmission, obtain the NAT type of the download terminal and upload terminal through the server, establish a Quic connection, and transmit video data through the Quic connection, using Quic's multiplexing and multi-congestion control algorithm to improve transmission efficiency and reliability .
It improves the efficiency and reliability of video transmission, reduces data packet loss rate and live broadcast freeze rate, and improves transmission quality and efficiency.
Smart Images

Figure CN118764692A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video technology, and in particular to a method and device for online video transmission using the QUIC protocol. Background Art
[0002] CDN (Content Delivery Network) is a content distribution acceleration network currently widely used in the video cloud industry. PCDN (P2P+CDN) is a low-cost, high-quality content distribution network service built on the basis of P2P technology by tapping into and utilizing massive fragmented idle resources in edge networks. In the PCDN scenario, online videos obtain data through numerous P2P edge nodes, which has the advantages of more available nodes and lower costs compared to traditional CDN.
[0003] Currently, in the PCDN scenario, data is transmitted between P2P edge nodes through TCP (Transmission Control Protocol) or UDP (User Datagram Protocol), but some TCP mechanisms, such as retransmission mechanism, confirmation mechanism, and congestion control mechanism, consume a lot of time when transmitting data, resulting in slow data transmission rate. UDP establishes a socket at each end of the communication instance, but there is no virtual link between the two sockets. They are just objects that send and receive datagrams, so the UDP protocol is not very reliable.
[0004] Therefore, the current data transmission in the PCDN scenario has the problems of low transmission efficiency and unreliability. Summary of the invention
[0005] The present application provides a method and device for online video transmission using the QUIC protocol to solve the problem of low transmission efficiency and unreliability in data transmission.
[0006] In a first aspect, the present application provides a method for online video transmission using the QUIC protocol, which is applied to a download terminal, and the method includes:
[0007] Acquire, through a server, a first NAT type of an uploading terminal corresponding to the downloading terminal, and determine a second NAT type of the downloading terminal;
[0008] Establishing a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0009] A video request is sent to the uploading terminal through the QUIC connection to complete the video data transmission through the uploading terminal.
[0010] Optionally, establishing a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type includes:
[0011] If any one of the first NAT type and the second NAT type is a full cone type, determining that a QUIC connection is directly established between the download terminal and the upload terminal;
[0012] If the first NAT type and the second NAT type are not all full cone types and not all symmetric types, NAT penetration is performed between the download terminal and the upload terminal, and a handshake is performed after the NAT penetration to establish a QUIC connection.
[0013] Optionally, the first NAT type and the second NAT type are not all full-cone types and not all symmetric types, and performing NAT penetration between the download terminal and the upload terminal includes:
[0014] If the first NAT type is restricted cone, the second NAT type is restricted cone, port restricted cone or symmetric; or,
[0015] If the first NAT type is port restricted cone, the second NAT type is restricted cone, port restricted cone or symmetric; or,
[0016] If the first NAT type is symmetric and the second NAT type is restrictive cone or port restrictive cone, NAT penetration is performed between the download terminal and the upload terminal.
[0017] Optionally, sending a video request to the uploading terminal through the QUIC connection includes:
[0018] Determine a plurality of data streams in the QUIC connection, wherein each of the data streams is used to carry a portion of video data;
[0019] Determine the actual bit rate of each QUIC data stream;
[0020] Select a target QUIC data stream whose actual bit rate is greater than m times the set bit rate, where m is between 0 and 1;
[0021] If the sum of actual bit rates of multiple target QUIC data streams is greater than n times the set bit rate, it is determined to use the multiple target QUIC data streams to send a video request to the uploading terminal, where n is greater than 1.
[0022] Optionally, after determining the actual bit rate of each QUIC connection, the method further includes:
[0023] If the target QUIC data stream does not exist, or if the target QUIC data stream exists but the sum of the actual bit rates of the target QUIC data streams is not greater than n times the set bit rate, all QUIC data streams are used to send a video request to the uploading terminal.
[0024] Optionally, acquiring, through the server, the first NAT type of the uploading terminal corresponding to the downloading terminal includes:
[0025] Sending a request message to a server, wherein the request message is used to request to obtain at least one upload terminal corresponding to the download terminal, the physical distance between the corresponding upload terminal and the download terminal is less than a set distance and the upload terminal has an idle upload capability;
[0026] The first NAT type of the corresponding uploading terminal fed back by the server is received, wherein the NAT type of each uploading terminal is pre-stored in the server.
[0027] In a second aspect, the present application provides a method for online video transmission using the QUIC protocol, which is applied to an uploading terminal, and the method includes:
[0028] Registering a P2P upload node on a server, and sending a first NAT type of its own device to the server, so that the download terminal obtains the first NAT type of the upload terminal corresponding to the download terminal through the server, and determines the second NAT type of the download terminal, and establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0029] The video request sent by the download terminal is obtained through the QUIC connection, and video data is transmitted to the download terminal based on the video request.
[0030] Optionally, each of the upload terminals corresponds to a plurality of download terminals, and the method further includes:
[0031] During the process of caching videos on downloading terminals, the video caching speed of each downloading terminal is monitored;
[0032] If it is determined that a target download terminal with a video caching speed lower than a preset speed appears, the QUIC connection with other download terminals is disconnected, wherein the other download terminals refer to download terminals with a video caching speed higher than the preset speed.
[0033] In a third aspect, the present application provides a system for online video transmission using the QUIC protocol, the system comprising an upload terminal, a server, and a download terminal, wherein the upload terminal and the download terminal are in a many-to-many relationship;
[0034] The upload terminal registers a P2P upload node on the server;
[0035] The server feeds back a first NAT type of the uploading terminal corresponding to the downloading terminal according to the request message of the downloading terminal;
[0036] The download terminal establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type of its own device, and sends a video request to the upload terminal through the QUIC connection;
[0037] The upload terminal is also used to transmit video data to the download terminal.
[0038] In a fourth aspect, the present application provides a device for online video transmission using the QUIC protocol, which is applied to a download terminal, and the device includes:
[0039] An acquisition module, used for acquiring, through a server, a first NAT type of an upload terminal corresponding to the download terminal, and determining a second NAT type of the download terminal;
[0040] An establishing module, configured to establish a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0041] The sending module is used to send a video request to the uploading terminal through the QUIC connection, so as to complete the video data transmission through the uploading terminal.
[0042] In a fifth aspect, the present application provides a device for online video transmission using the QUIC protocol, which is applied to an uploading terminal, and the device includes:
[0043] A registration module, used to register a P2P upload node on a server, and send a first NAT type of its own device to the server, so that a download terminal obtains the first NAT type of an upload terminal corresponding to the download terminal through the server, and determines a second NAT type of the download terminal, and establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0044] The transmission module is used to obtain the video request sent by the download terminal through the QUIC connection, and transmit the video data to the download terminal based on the video request.
[0045] In a sixth aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus.
[0046] In a seventh aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the method for online video transmission using the QUIC protocol as described in any one of the above items of the present application.
[0047] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: after the upload terminal and the download terminal are paired, a QUIC connection is established based on their respective NAT types, and then the video data transmission is completed through the QUIC connection. The multiplexing characteristics of the QUIC connection ensure smooth data transmission, and the characteristics of the QUIC multi-congestion control algorithm reduce the data packet loss rate and improve the data transmission quality. At the same time, it also helps to reduce the live broadcast freeze rate under complex networks and improve transmission efficiency. Therefore, the present application improves the transmission efficiency and transmission reliability of the video. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0051] Figure 1 A schematic diagram of a system for online video transmission using the QUIC protocol provided in an embodiment of the present application;
[0052] Figure 2 A flow chart of a method for online video transmission using the QUIC protocol provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of the structure of an online video transmission device using the QUIC protocol provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0056] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.
[0057] In order to solve the problem mentioned in the background technology, according to one aspect of an embodiment of the present application, an embodiment of a method for online video transmission using the QUIC protocol is provided.
[0058] Optionally, in the embodiment of the present application, the above-mentioned method for online video transmission using the QUIC protocol can be applied to: Figure 1 In the hardware environment shown in FIG. 1 , an upload terminal 101, a download terminal 103 and a server 102 are provided. Figure 1 As shown, the server 102 is connected to the upload terminal 101 and the download terminal 103 through the network. The database 105 can be set on the server or independently of the server to provide data storage services for the server 102. The above-mentioned network includes but is not limited to: wide area network, metropolitan area network or local area network. The upload terminal 101 includes but is not limited to hard disk, Raspberry Pi and other devices that can provide CDN server functions. The download terminal 103 includes but is not limited to PC, mobile phone, tablet computer, etc.
[0059] The present application provides a system for online video transmission using the QUIC protocol, the system comprising an upload terminal, a server and a download terminal, such as Figure 1As shown, the upload terminal in the embodiment of the present application can be a device such as a hard disk, Raspberry Pi, etc. that can provide the function of a CDN server, and the download terminal can be a device that caches videos such as a computer, a tablet or a mobile phone. The server can be one server or a group of servers. The number of servers is related to the video data stream. If all videos use one server, it will cause the server to be overloaded. In this case, the videos can be grouped according to the file hash value, so that each group of videos corresponds to a server in a group of servers. The embodiment of the present application does not limit the server type, as long as it can realize data communication between the upload terminal and the download terminal. For example, the server is a Tracker server.
[0060] The upload terminal registers as a P2P upload node on the server, and sends the id of its own device and the first NAT (Network Address Translation) type to the server, and the server saves the id and the first NAT type of the upload terminal. The download terminal sends a request message to the server, and the server determines the upload terminal corresponding to the download terminal, and sends the id and the first NAT type of the upload terminal to the download terminal. Each download terminal can correspond to multiple upload terminals to receive video data uploaded by multiple upload terminals. Correspondingly, each upload terminal can also correspond to multiple download terminals to send video data to multiple download terminals. Therefore, the upload terminal and the download terminal are in a many-to-many relationship. The upload terminal corresponding to the download terminal mentioned in the embodiment of the present application refers to at least one upload terminal corresponding to a download terminal in the many-to-many relationship.
[0061] The download terminal obtains the first NAT type of the upload terminal and the second NAT type of its own device, and then establishes a QUIC connection between the download terminal and the upload terminal based on the first NAT type and the second NAT type of its own device. The download terminal sends a video request to the upload terminal based on the QUIC connection, and the upload terminal transmits the video data to the download terminal through the QUIC connection.
[0062] NAT is a technology for accessing a wide area network. It is a conversion technology that converts private (reserved) addresses into legal IP addresses. It is widely used in various types of Internet access methods and various types of networks.
[0063] The download terminal may communicate and interact with the server to determine its own second NAT type, or the second NAT type of the download terminal may be manually detected and saved to the download terminal, and the download terminal reads its own second NAT type.
[0064] Among them, the QUIC (Quick UDP Internet Connections) protocol is an improved communication protocol based on UDP. The QUIC protocol has the characteristics of multiplexing and multiple congestion control algorithms. Multiplexing means that the streams in the QUIC connection are independent of each other. If a stream loses packets, it will not affect other normally transmitted streams in the connection. This can avoid head-of-line blocking in the TCP protocol, and ensure smooth streaming in weak networks. Multiple congestion control algorithms can effectively reduce the data packet loss rate, help reduce the live broadcast freeze rate in complex networks, improve transmission efficiency, and make streaming smoother.
[0065] Based on these characteristics of QUIC, the embodiments of the present application can solve the defects of slow transmission rate of TCP protocol and unreliable UDP, and eventually replace TCP protocol to reduce the delay time of connection establishment, speed up the transmission speed of web pages, and realize high-speed and high-reliability transmission of video data between uploading terminals and downloading terminals.
[0066] Optionally, the system further includes a NAT server, which is arranged between the uploading terminal and the downloading terminal and is used to achieve NAT penetration.
[0067] Based on the same technical concept, the present application provides a method for online video transmission using the QUIC protocol, which can be applied to a download terminal or an upload terminal. The present application embodiment is specifically described by taking the application to the download terminal as an example. Figure 2 As shown, the method includes:
[0068] Step 201: obtaining, through a server, a first NAT type of an uploading terminal corresponding to a downloading terminal, and determining a second NAT type of the downloading terminal.
[0069] The video download terminal corresponds to at least one upload terminal, and the video data cached by the download terminal is uploaded by the upload terminal. The server sends the first NAT type of one of the upload terminals to the download terminal, and the download terminal also obtains its own second NAT type. There are four types of NAT types: full cone NAT, IP restrict cone NAT, port restrict cone NAT, and symmetric NAT.
[0070] Step 202: Establish a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type.
[0071] The download terminal determines whether the download terminal and the upload terminal are directly connected using a QUIC connection or need to use a NAT server for NAT transparent transmission and then handshake to establish a QUIC connection based on the first NAT type and the second NAT type. However, no matter which method is used, a QUIC connection between the download terminal and the upload terminal needs to be established.
[0072] Among them, the download terminal only needs to establish a QIC work thread, which can reduce traffic consumption, while the upload terminal can establish multiple QIC work threads, which can serve more download terminals. In addition, the connection ID in QIC is used to determine which QIC connection the data packet belongs to. The Connection ID of the QIC connection can be appropriately reduced to reduce the P2P protocol overhead.
[0073] Step 203: Send a video request to the upload terminal through the QUIC connection to complete the video data transmission through the upload terminal.
[0074] The download terminal sends a video request to the upload terminal through a QUIC connection. The upload terminal divides a QUIC connection into data streams, each of which carries part of the video data. For example, the upload terminal divides the video file into multiple 64k data, each of which carries a 64k data. The upload terminal sends the multiple data streams to the download terminal to complete the video data transmission.
[0075] The video data carried by each data stream may be the same or different, as long as the actual carrying capacity does not exceed the maximum carrying capacity of the data stream.
[0076] In the embodiment of the present application, after the upload terminal and the download terminal are paired, a QUIC connection is established based on their respective NAT types, and then the video data transmission is completed through the QUIC connection. The multiplexing characteristics of the QUIC connection ensure smooth data transmission, and the characteristics of the QUIC multi-congestion control algorithm reduce the data packet loss rate and improve the data transmission quality. At the same time, it also helps to reduce the live broadcast freeze rate in complex networks and improve transmission efficiency.
[0077] As an optional implementation manner, establishing a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type includes two embodiments.
[0078] In the first embodiment, if any one of the first NAT type and the second NAT type is a full cone type, it is determined that a QUIC connection is directly established between the download terminal and the upload terminal, as shown in Table 1.
[0079] In the second embodiment, if the first NAT type and the second NAT type are not all full cone types and not all symmetric types, NAT penetration is performed between the download terminal and the upload terminal, and a handshake is performed after the NAT penetration to establish a QUIC connection.
[0080] According to the type of NAT, this application can use QUIC direct connection or handshake after NAT penetration to establish QUIC connection. Regardless of the NAT type, QUIC connection can be achieved to ensure video transmission efficiency and quality.
[0081] The second implementation example is shown in Table 1, and is specifically as follows: if the first NAT type is a restrictive cone type, and the second NAT type is a restrictive cone type, a port-restricted cone type, or a symmetric type; or, if the first NAT type is a port-restricted cone type, and the second NAT type is a restrictive cone type, a port-restricted cone type, or a symmetric type; or, if the first NAT type is a symmetric type, and the second NAT type is a restrictive cone type or a port-restricted cone type, it is determined that a handshake is established between the download terminal and the upload terminal after NAT penetration. QUIC connection.
[0082] The connection methods between various types of devices are shown in Table 1.
[0083] Table 1
[0084] NAT Full cone type Restricted cone Port Restriction Taper Symmetrical Full cone type Direct Direct Direct Direct Restricted cone Direct Hole Punch Hole Punch Hole Punch Port Restriction Taper Direct Hole Punch Hole Punch Hole Punch Symmetrical Direct Hole Punch Hole Punch Relay
[0085] Direct is a direct QIC connection, Hole Punch is a QIC connection established after NAT penetration, and Relay is a connection that cannot be penetrated.
[0086] This application specifically defines the remaining three NAT types (restrictive cone type, port-restricted cone type or symmetric type), and describes three specific methods of NAT penetration, so that even if a direct QUIC connection is not possible, a QUIC connection can be established after NAT penetration and handshake, and the QUIC connection is used to improve the data transmission rate and ensure the transmission quality.
[0087] The download terminal sends a video request to the upload terminal through a QUIC connection, which specifically includes two embodiments, which are described in detail below.
[0088] In the first embodiment, the download terminal determines multiple data streams in the QUIC connection, then determines the actual bit rate of each QUIC data stream, and then selects a target QUIC data stream with a higher actual bit rate, thereby using the target QUIC data stream to send a video request. Using the target QUIC data stream with a higher actual bit rate can improve the sending efficiency of the video request. The subsequent upload terminal also needs to use the target QUIC data stream to transmit video data, which can also improve the transmission efficiency of the video data.
[0089] Specifically, the process of determining the target QUIC data stream is as follows: the download terminal first selects a target QUIC data stream whose actual bit rate is greater than m times the set bit rate from the QUIC data stream, where m is between 0 and 1, and then determines whether the sum of the actual bit rates of the target QUIC data streams is greater than n times the set bit rate. If the judgment result is "no", it indicates that relying on these target QUIC data streams to transmit videos will result in insufficient bit rates, which is likely to cause data congestion. If the judgment result is "yes", it is determined to use the target QUIC data stream to send a video request to the upload terminal, where n is greater than 1. Bit rate, also known as bit rate, is the amount of video data per unit time.
[0090] Exemplarily, if the actual bit rate of the target QUIC data stream is greater than half of the set bit rate, and the sum of the actual bit rates of multiple target QUIC data streams is greater than 5 times the set bit rate, then the multiple target QUIC data streams are used to send the video request.
[0091] This application selects a target QUIC data stream with a larger actual bit rate to complete the transmission of the video request without using other QUIC data streams, thereby reducing the number of QUIC data streams transmitted and avoiding congestion caused by too many QUIC data streams, resulting in low transmission efficiency of the video request.
[0092] In the second embodiment, after the download terminal determines the actual bit rate of each QUIC data stream, if it is determined that there is no target QUIC data stream, all QUIC data streams are used to send the video request, and the video data transmission is subsequently realized by using all QUIC data streams. In addition, if there is a target QUIC data stream, but the sum of the actual bit rates of multiple target QUIC data streams is not greater than n times the set bit rate, all QUIC data streams are also used to send the video request and video data transmission.
[0093] This application uses all QUIC data streams to send video requests and video data transmission to ensure that the data can be transmitted completely.
[0094] As an optional implementation, obtaining the first NAT type of the upload terminal corresponding to the download terminal through the server includes: sending a request message to the server, wherein the request message is used to request to obtain at least one upload terminal corresponding to the download terminal, the physical distance between the corresponding upload terminal and the download terminal is less than a set distance and the upload terminal has idle upload capacity; receiving the first NAT type of the corresponding upload terminal fed back by the server, wherein the NAT type of each upload terminal is pre-stored in the server.
[0095] The download terminal and the upload terminal are in a many-to-many relationship. For the same download terminal, the physical distance between the download terminal and different upload terminals is different, and not all upload terminals are currently idle. The way to select an upload terminal is to select an upload terminal with a physical distance less than the set distance and with idle upload capabilities. The number of selected upload terminals can be one or more.
[0096] The download terminal sends a request message to the server. The server selects at least one upload terminal corresponding to the download terminal based on the above-mentioned upload terminal selection method, and then determines the first NAT type of the upload terminal according to the registration information. The registration information is the information that the upload terminal has registered in advance at the P2P upload node of the server. The server saves the registration information and can directly query the first NAT type of the upload terminal according to the registration information when receiving the download terminal request later.
[0097] This application selects an upload terminal that is closer, which can shorten the transmission time of video data and speed up the video transmission rate; selects an upload terminal with idle upload capacity to ensure that the video data is not stuck, further improving the data transmission rate.
[0098] As an optional implementation, each upload terminal corresponds to multiple download terminals, and the method also includes: in the process of the download terminal caching the video, monitoring the video caching speed of each download terminal; if it is determined that a target download terminal with a video caching speed lower than a preset speed appears, disconnecting the QUIC connection with other download terminals, wherein the other download terminals refer to download terminals with a video caching speed higher than the preset speed.
[0099] Each upload terminal corresponds to multiple download terminals. Each upload terminal needs to monitor the video caching speed of the corresponding download terminal. If the video caching speed of a target download terminal is lower than the preset speed, it indicates that the target download terminal has a download jam problem. To avoid this situation, the upload terminal can suspend the QIC connection with other download terminals with higher video caching speeds, thereby providing more traffic to the target download terminal. Wait until the video caching speed of the target download terminal returns to normal, and then re-establish the QIC connection with the temporarily disconnected download terminal.
[0100] This application realizes data transmission between many p2p edge nodes, and the upload terminal can serve the download terminal with more urgent data request. Compared with the prior art that a single P2P edge node may not be sufficient for high-bitrate video transmission, this application suspends the data of other download terminals, so that the upload terminal focuses on serving one download terminal, avoiding the situation where a certain download terminal fails to download. In addition, the embodiment of the present application uses QUIC connection on p2p, so that data transmission has the advantages of high speed and high reliability.
[0101] The present application provides a process for online video transmission using the QUIC protocol, comprising the following steps.
[0102] Step 1: The upload terminal registers as a P2P upload node on the server, the download terminal sends a request message to the server, and the server feeds back a group of upload terminals to the download terminal.
[0103] Step 2: The download terminal determines whether to connect directly to QUIC or perform NAT penetration with the help of a NAT server based on its own second NAT type and the first NAT type of the upload terminal.
[0104] Step 3: If it is NAT penetration, handshake after NAT penetration and then establish a QUIC connection.
[0105] Step 4: The download terminal selects a QUIC connection with a faster actual bit rate. Try to select a target QUIC connection with an actual bit rate greater than half of the bit rate, and make the sum of the speeds of multiple target QUIC connections greater than five times the bit rate. If the attempt is successful, only the selected multiple target QUIC connections are used. If the attempt is not successful, all QUIC connections are used.
[0106] Step 5: The download terminal sends a video request to the upload terminal through the QUIC connection.
[0107] Step 6: The uploading terminal divides the video file into multiple 64K data, and each QUIC connection carries one 64K data and sends it to the downloading terminal.
[0108] Step 7: If the download terminal detects that the video cache speed of some download terminals is low, the connection with other download terminals is disconnected, and service is only provided to the download terminal with low video cache speed.
[0109] Based on these characteristics of QUIC, the embodiments of the present application can solve the defects of slow transmission rate of TCP protocol and unreliable UDP, and eventually replace TCP protocol to reduce the delay time of connection establishment, speed up the transmission speed of web pages, and realize high-speed and high-reliability transmission of video data between uploading terminals and downloading terminals.
[0110] Based on the same technical concept, the present application provides a device for online video transmission using the QUIC protocol, such as Figure 3 As shown, applied to a download terminal, the device includes:
[0111] The acquisition module 301 is used to acquire, through the server, a first NAT type of the uploading terminal corresponding to the downloading terminal, and determine a second NAT type of the downloading terminal;
[0112] An establishing module 302, configured to establish a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0113] The sending module 303 is used to send a video request to the uploading terminal through the QUIC connection, so as to complete the video data transmission through the uploading terminal.
[0114] Optionally, the establishment module 302 is used to:
[0115] If any one of the first NAT type and the second NAT type is a full cone type, determining that a QUIC connection is directly established between the download terminal and the upload terminal;
[0116] If the first NAT type and the second NAT type are not all full cone types and not all symmetric types, NAT penetration is performed between the download terminal and the upload terminal, and a handshake is performed after the NAT penetration to establish a QUIC connection.
[0117] Optionally, the establishment module 302 is used to:
[0118] If the first NAT type is Restricted Cone, the second NAT type is Restricted Cone, Port Restricted Cone, or Symmetric; or,
[0119] If the first NAT type is port restricted cone, the second NAT type is restricted cone, port restricted cone, or symmetric; or,
[0120] If the first NAT type is symmetric, and the second NAT type is restrictive cone or port restrictive cone, it is determined that a QUIC connection is directly established between the download terminal and the upload terminal.
[0121] Optionally, the sending module 303 is used to:
[0122] Determine multiple data streams in the QUIC connection, wherein each data stream is used to carry a portion of video data;
[0123] Determine the actual bit rate of each QUIC data stream;
[0124] Select a target QUIC data stream whose actual bit rate is greater than m times the set bit rate, where m is between 0 and 1;
[0125] If the sum of actual bit rates of multiple target QUIC data streams is greater than n times the set bit rate, it is determined to use multiple target QUIC data streams to send a video request to the upload terminal, where n is greater than 1.
[0126] Optionally, the device is also used for:
[0127] If there is no target QUIC data stream, or there is a target QUIC data stream but the sum of the actual bit rates of the target QUIC data streams is not greater than n times the set bit rate, all QUIC data streams are used to send a video request to the upload terminal.
[0128] Optionally, the acquisition module 301 is used to:
[0129] Sending a request message to the server, wherein the request message is used to request to obtain at least one upload terminal corresponding to the download terminal, the physical distance between the corresponding upload terminal and the download terminal is less than a set distance and the upload terminal has an idle upload capability;
[0130] A first NAT type of the corresponding uploading terminal fed back by the server is received, wherein the NAT type of each uploading terminal is pre-stored in the server.
[0131] Based on the same technical concept, the present application also provides a device for online video transmission using the QUIC protocol, which is applied to an uploading terminal, and the device includes:
[0132] The sending module is used to register the P2P upload node on the server and send the first NAT type of its own device to the server, so that the download terminal obtains the first NAT type of the upload terminal corresponding to the download terminal through the server, and determines the second NAT type of the download terminal, and establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type;
[0133] The acquisition module is used to acquire the video request sent by the download terminal through the QUIC connection, and transmit the video data to the download terminal based on the video request.
[0134] Optionally, each upload terminal corresponds to multiple download terminals, and the device is further used for:
[0135] During the process of caching videos on downloading terminals, monitor the video caching speed of each downloading terminal;
[0136] If it is determined that a target download terminal with a video caching speed lower than a preset speed appears, the QUIC connection with other download terminals is disconnected, wherein the other download terminals refer to download terminals with a video caching speed higher than the preset speed.
[0137] like Figure 4 As shown, an embodiment of the present application provides an electronic device, including a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404.
[0138] The memory 403 is used to store computer programs.
[0139] In one embodiment of the present application, the processor 401 is used to implement the method for online video transmission using the QUIC protocol provided by any one of the aforementioned method embodiments when executing the program stored in the memory 403.
[0140] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0141] The communication interface is used for communication between the above electronic device and other devices.
[0142] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0143] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0144] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0145] In another embodiment of the present invention, a computer program product including instructions is provided, which enables the computer to execute any one of the methods in the above embodiments when the computer program product is executed on the computer.
[0146] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0147] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0148] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for online video transmission using the QUIC protocol. It is characterized in that Applied to a download terminal, the method comprises: Acquire, through a server, a first NAT type of an uploading terminal corresponding to the downloading terminal, and determine a second NAT type of the downloading terminal; Establishing a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type; A video request is sent to the uploading terminal through the QUIC connection to complete the video data transmission through the uploading terminal.
2. The method according to claim 1, It is characterized in that Establishing a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type includes: If any one of the first NAT type and the second NAT type is a full cone type, determining that a QUIC connection is directly established between the download terminal and the upload terminal; If the first NAT type and the second NAT type are not all full cone types and not all symmetric types, NAT penetration is performed between the download terminal and the upload terminal, and a handshake is performed after the NAT penetration to establish a QUIC connection.
3. The method according to claim 2, It is characterized in that If the first NAT type and the second NAT type are not all full cone types and not all symmetric types, performing NAT penetration between the download terminal and the upload terminal includes: If the first NAT type is restricted cone, the second NAT type is restricted cone, port restricted cone or symmetric; or, If the first NAT type is port restricted cone, the second NAT type is restricted cone, port restricted cone or symmetric; or, If the first NAT type is symmetric and the second NAT type is restrictive cone or port restrictive cone, NAT penetration is performed between the download terminal and the upload terminal.
4. The method according to claim 1, It is characterized in that Sending a video request to the upload terminal through the QUIC connection includes: Determine a plurality of data streams in the QUIC connection, wherein each of the data streams is used to carry a portion of video data; Determine the actual bit rate of each QUIC data stream; Select a target QUIC data stream whose actual bit rate is greater than m times the set bit rate, where m is between 0 and 1; If the sum of actual bit rates of multiple target QUIC data streams is greater than n times the set bit rate, it is determined to use the multiple target QUIC data streams to send a video request to the uploading terminal, where n is greater than 1.
5. The method according to claim 4, It is characterized in that After determining the actual bit rate of each QUIC connection, the method further includes: If the target QUIC data stream does not exist, or if the target QUIC data stream exists but the sum of the actual bit rates of the target QUIC data streams is not greater than n times the set bit rate, all QUIC data streams are used to send a video request to the uploading terminal.
6. The method according to claim 1, It is characterized in that Acquiring, by the server, a first NAT type of the uploading terminal corresponding to the downloading terminal includes: Sending a request message to a server, wherein the request message is used to request to obtain at least one upload terminal corresponding to the download terminal, the physical distance between the corresponding upload terminal and the download terminal is less than a set distance and the upload terminal has an idle upload capability; The first NAT type of the corresponding uploading terminal fed back by the server is received, wherein the NAT type of each uploading terminal is pre-stored in the server.
7. A method for online video transmission using the QUIC protocol, It is characterized in that Applied to an uploading terminal, the method comprises: Registering a P2P upload node on a server, and sending a first NAT type of its own device to the server, so that the download terminal obtains the first NAT type of the upload terminal corresponding to the download terminal through the server, and determines the second NAT type of the download terminal, and establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type; The video request sent by the download terminal is obtained through the QUIC connection, and video data is transmitted to the download terminal based on the video request.
8. The method according to claim 7, It is characterized in that Each of the upload terminals corresponds to a plurality of download terminals, and the method further comprises: During the process of caching videos on downloading terminals, the video caching speed of each downloading terminal is monitored; If it is determined that a target download terminal with a video caching speed lower than a preset speed appears, the QUIC connection with other download terminals is disconnected, wherein the other download terminals refer to download terminals with a video caching speed higher than the preset speed.
9. A system for online video transmission using the QUIC protocol. It is characterized in that The system includes an upload terminal, a server and a download terminal, and the upload terminal and the download terminal are in a many-to-many relationship; The upload terminal registers a P2P upload node on the server; The server feeds back a first NAT type of the uploading terminal corresponding to the downloading terminal according to the request message of the downloading terminal; The download terminal establishes a QUIC connection between the download terminal and the upload terminal according to the first NAT type and the second NAT type of its own device, and sends a video request to the upload terminal through the QUIC connection; The upload terminal is also used to transmit video data to the download terminal.
10. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method described in any one of claims 1-6 or 7-8 when executing a program stored in a memory.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1-6 or 7-8 is implemented.
