Connection establishment method and device, electronic device and storage medium
By reusing the SDP negotiation process of the WebRTC connection and sending the second candidate signaling, unconscious reconnection is achieved when switching networks or relay servers in cloud applications, solving the problems of extended first frame duration and screen interruption, and improving user experience. experience and compatibility.
Patent Information
- Application Number
- CN202411077594.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-08-07
AI Technical Summary
In cloud applications, when switching network operator lines or changing relay servers, the existing technology requires disconnecting and re-establishing the WebRTC connection, resulting in extended first frame duration and cloud application screen interruption or lag.
When switching network operator lines or changing relay servers, reuse the Session Description Protocol SDP negotiation process of the existing WebRTC connection and send the second candidate signaling to establish a new end-to-end connection to avoid re-disconnection and establishment of the connection. process.
It reduces the time of the WebRTC reconnection process, makes the user experience smoother, reduces the first frame time, and is compatible with older clients and browsers that cannot modify the source code.
Smart Images

Figure CN118612194B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing, and in particular to a connection establishment method and device, an electronic device and a storage medium. Background Art
[0002] Cloud applications (such as cloud games) are an application model based on cloud computing technology. Users connect to cloud servers through the network. The cloud servers run applications in real time and transmit application images to the user's terminal device through video streaming. The user's input instructions are also transmitted to the cloud server through the network for real-time interaction. This model greatly reduces the hardware requirements for user terminal devices, so that they only need basic video decoding capabilities and network connection capabilities to experience high-quality applications.
[0003] In cloud application services, the time it takes for users to see the first frame of the application screen from the time the application is started (i.e., the first frame time) is an important indicator that affects the user experience in cloud applications. In order to shorten the first frame time, pooling technology is generally used, that is, the application and the server application used for streaming are pre-started in the cloud server, the relay address and port are pre-allocated to the cloud server, and the stream address is cached and pre-sent to the terminal. In this way, a WebRTC (Web Real-Time Communication) connection can be quickly established between the cloud server and the terminal, which can then reduce the cloud application startup time and thus shorten the first frame time.
[0004] During the operation of the cloud application, if it is necessary to switch the network operator line or replace the relay server, the cloud server will disconnect the current WebRTC connection process and establish a new WebRTC connection. Since establishing a new WebRTC connection will go through the connection process again, it takes a long time, which will cause the first frame length to become longer, or the cloud application screen seen by the user to be interrupted or stuck. This section does not constitute a recognition of the existing technology.
[0005] Therefore, how to provide a connection establishment solution to speed up the WebRTC reconnection speed when it is necessary to switch network operator lines or replace relay servers, thereby reducing the first frame length / reducing interruptions or freezes in cloud application screens has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] In view of the technical problems existing in the prior art, the embodiments of the present application provide a connection establishment method and device, an electronic device and a storage medium.
[0007] In a first aspect, an embodiment of the present application provides a connection establishment method, which is applied to a cloud server, including:
[0008] When it is necessary to switch the network operator line or replace the relay server, apply to the target relay server for the IP address and port of the target network operator line, and create a candidate signaling based on the IP address and port of the target network operator line, which is recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or established between the cloud server and the terminal;
[0009] The second candidate signaling is sent to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, the streaming media data is pushed to the terminal through the target network operator line.
[0010] In a second aspect, an embodiment of the present application further provides a connection establishment device, which is applied to a cloud server, including:
[0011] A first creation unit is used to apply to the target relay server for the IP address and port of the target network operator line when it is necessary to switch the network operator line or replace the relay server, and create a candidate signaling based on the IP address and port of the target network operator line, which is recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or established between the cloud server and the terminal;
[0012] A sending unit is used to send a second candidate signaling to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, push streaming media data to the terminal through the target network operator line.
[0013] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the connection establishment method described in the first aspect are executed.
[0014] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the connection establishment method described in the first aspect.
[0015] In summary, the connection establishment method and device, electronic device and storage medium provided in the embodiments of the present application do not disconnect the original WebRTC connection first and then establish a new WebRTC connection when it is necessary to switch the network operator line or replace the relay server. Instead, the WebRTC connection that is being established or has been established is retained, and the session description protocol SDP negotiation process of the WebRTC connection that is being established or has been established is reused, and the second candidate signaling is collected and sent on this basis. That is to say, compared with the solution that needs to re-establish the WebRTC connection, this solution does not need to disconnect the original WebRTC connection first, and the WebRTC reconnection process does not require SDP negotiation, so it is imperceptible to the user, and can reduce the connection establishment process, speed up the WebRTC reconnection speed, and then reduce the first frame duration / reduce the interruption or freeze of the cloud application screen. In addition, the entire solution only needs to modify the processing logic of the cloud server, so it can be compatible with old clients and browsers that cannot modify the source code. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a flow chart of an embodiment of a connection establishment method provided in an embodiment of the present application;
[0017] Figure 2 A flowchart of another embodiment of a connection establishment method provided in an embodiment of the present application;
[0018] Figure 3 A schematic diagram of the structure of an embodiment of a connection establishment device provided in an embodiment of the present application;
[0019] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme 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. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0021] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0022] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0023] Reference Figure 1 FIG. 1 is a flow chart of a connection establishment method provided in an embodiment of the present application. The connection establishment method is applied to a cloud server and includes:
[0024] S10, when it is necessary to switch the network operator line or replace the relay server, apply to the target relay server for the IP address and port of the target network operator line, and create a candidate signaling based on the IP address and port of the target network operator line, recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or already established between the cloud server and the terminal;
[0025] In this embodiment, it should be noted that if the cloud server and the terminal need to switch the network operator line or replace the relay server during the WebRTC connection process or when the WebRTC connection is completed, the existing WebRTC connection process can be maintained and the session description protocol SDP negotiation process of the existing WebRTC connection process can be reused. The reconnection only starts from collecting the second candidate signaling. After the second candidate signaling is collected, the second candidate signaling is sent to the terminal through the signaling channel used in the existing WebRTC connection process. In this way, the terminal can establish a data transmission channel with the cloud server based on the second candidate signaling, and the streaming media data (including the cloud application screen) generated during the operation of the cloud application collected by the cloud server is sent to the terminal through the data transmission channel.
[0026] The target relay server is installed with a network card corresponding to the target network operator line. For example, if the target network operator line is a mobile line, a CM network card can be installed in the target relay server; if the target network operator line is a telecom line, a CT network card can be installed in the target relay server; if the target network operator line is a Unicom line, a CU network card can be installed in the target relay server. When it is necessary to switch the network operator line, the network operator line to be switched to is the target network operator line; when it is necessary to replace the relay server, the replaced relay server is the target relay server. At least one type of network card can be installed in the target relay server, and the IP address and port of the target network operator line applied to the target relay server are the IP address and port of the network card corresponding to the target network operator line.
[0027] The first candidate signaling is the candidate signaling collected by the WebRTC connection being established or already established between the cloud server and the terminal, and its priority is lower than the second candidate signaling, so that the cloud server can push streaming media data to the terminal through the target network operator line.
[0028] S11. Send a second candidate signaling to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, push streaming media data to the terminal through the target network operator line.
[0029] In this embodiment, it should be noted that after the end-to-end connection between the cloud server and the terminal is successfully established based on the second candidate signaling, the cloud server can forward the streaming media data to the terminal through the network card corresponding to the target network operator line installed in the target relay server, that is, push the streaming media data to the terminal through the target network operator line.
[0030] The connection establishment method provided in the embodiment of the present application does not disconnect the original WebRTC connection first and then establish a new WebRTC connection when it is necessary to switch the network operator line or replace the relay server. Instead, the WebRTC connection that is being established or has been established is retained, and the Session Description Protocol SDP negotiation process of the WebRTC connection that is being established or has been established is reused, and the second candidate signaling is collected and sent on this basis. That is to say, compared with the solution that needs to re-establish the WebRTC connection, this solution does not need to disconnect the original WebRTC connection first, and the WebRTC reconnection process does not require SDP negotiation, so it is imperceptible to the user, and can reduce the connection establishment process, speed up the WebRTC reconnection speed, and then reduce the first frame duration / reduce the interruption or freeze of the cloud application screen. In addition, the entire solution only needs to modify the processing logic of the cloud server, so it can be compatible with old clients and browsers that cannot modify the source code.
[0031] Based on the above method embodiment, the target relay server is a second relay server, and the target network operator line is a second network operator line. Before applying to the target relay server for the IP address and port of the target network operator line, the method may further include:
[0032] In the process of establishing the WebRTC connection between the cloud server and the terminal, the signaling channel is established between the cloud server and the terminal, the session description protocol SDP negotiation is performed through the signaling channel, and the IP address and port of the first network operator line are applied to the first relay server, and the first candidate signaling is created based on the IP address and port of the first network operator line.
[0033] In this embodiment, it should be noted that, in the case of switching the network operator line, the first relay server and the second relay server may be the same or different. In the case of changing the relay server, the first network operator line and the second network operator line may be consistent or inconsistent, for example, both are mobile lines, or the first network operator line is a mobile line and the second network operator line is a Unicom line.
[0034] Based on the foregoing method embodiment, the network operator corresponding to the target network operator line may be the same as or different from the network operator used by the terminal.
[0035] Based on the foregoing method embodiment, after the end-to-end connection between the cloud server and the terminal is successfully established based on the second candidate signaling, pushing streaming media data to the terminal through the target network operator line may include:
[0036] After the connectivity test based on the second candidate signaling between the cloud server and the terminal passes and the end-to-end connection established between the cloud server and the terminal based on the second candidate signaling is successful, the streaming media data is pushed to the terminal through the target network operator line.
[0037] See also Figure 2 A flowchart of another embodiment of a connection establishment method provided in an embodiment of the present application is shown in FIG. Figure 2 In the example, it is assumed that the relay server (i.e., the relay server) is equipped with a CM network card, a CT network card, and a CU network card. A WebRTC connection is first established between the cloud server and the terminal. It is assumed that the WebRTC connection is established and the streaming media data is pushed through connection1 (assuming that the connection is established between the cloud server and the terminal through the CM network card of the relay server). After that, the network operator line needs to be switched to a Unicom line. In this case, the relay server can be requested for the IP address and port of the CU network card, and a candidate signaling (i.e., the second candidate signaling) can be created based on the IP address and port. The second candidate signaling is sent to the terminal through the signaling channel used by the WebRTC connection. After the terminal receives the second candidate signaling, it will perform a connectivity test of the Unicom line through the relay server and the cloud server based on the IP address and port in the second candidate signaling. If the connectivity test passes, a new end-to-end connection connection2 (i.e., the connection established between the cloud server and the terminal through the CU network card of the relay server) will be established. After connection2 is established and connected successfully, the cloud server will switch the streaming media data from connection1 to connection2 for push. After that, the terminal receives the streaming data from connection2 and sends it for decoding and display. The cloud application screen continues to play without interruption or freezing. At this point, the process of switching lines without disconnecting the WebRTC connection and reconnecting is completed. This reconnection is imperceptible to the user and does not affect the user experience, enabling seamless line switching.
[0038] Reference Figure 3 FIG. 1 is a schematic diagram of a structure of a connection establishment device provided in an embodiment of the present application, which is applied to a cloud server and includes:
[0039] The first creation unit 30 is used to apply to the target relay server for the IP address and port of the target network operator line when it is necessary to switch the network operator line or replace the relay server, and create a candidate signaling based on the IP address and port of the target network operator line, which is recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or established between the cloud server and the terminal;
[0040] The sending unit 31 is used to send a second candidate signaling to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, push streaming media data to the terminal through the target network operator line.
[0041] The connection establishment device provided in the embodiment of the present application does not disconnect the original WebRTC connection first and then establish a new WebRTC connection when it is necessary to switch the network operator line or replace the relay server. Instead, the WebRTC connection that is being established or has been established is retained, and the Session Description Protocol SDP negotiation process of the WebRTC connection that is being established or has been established is reused, and the second candidate signaling is collected and sent on this basis. That is to say, compared with the solution that needs to re-establish the WebRTC connection, this solution does not need to disconnect the original WebRTC connection first, and the WebRTC reconnection process does not require SDP negotiation, so it is imperceptible to the user, and can reduce the connection establishment process, speed up the WebRTC reconnection speed, and then reduce the first frame duration / reduce the interruption or freeze of the cloud application screen. In addition, the entire solution only needs to modify the processing logic of the cloud server, so it can be compatible with old clients and browsers that cannot modify the source code.
[0042] On the basis of the above-mentioned device embodiment, the target relay server is a second relay server, the target network operator line is a second network operator line, and the device may further include:
[0043] The second creation unit is used to establish the signaling channel between the cloud server and the terminal during the process of establishing the WebRTC connection between the cloud server and the terminal before the first creation unit applies for the IP address and port of the target network operator line from the target relay server, perform session description protocol SDP negotiation through the signaling channel, apply for the IP address and port of the first network operator line from the first relay server, and create the first candidate signaling based on the IP address and port of the first network operator line.
[0044] Based on the foregoing device embodiment, the network operator corresponding to the target network operator line may be the same as or different from the network operator used by the terminal.
[0045] Based on the above device embodiment, the sending unit may be used for:
[0046] After the connectivity test based on the second candidate signaling between the cloud server and the terminal passes and the end-to-end connection established between the cloud server and the terminal based on the second candidate signaling is successful, the streaming media data is pushed to the terminal through the target network operator line.
[0047] The connection establishment device provided in the embodiment of the present application has an implementation process that is consistent with the connection establishment method provided in the embodiment of the present application, and the effect that can be achieved is also the same as the connection establishment method provided in the embodiment of the present application, which will not be repeated here.
[0048] like Figure 4 As shown, an electronic device provided by an embodiment of the present application includes: a processor 40, a memory 41 and a bus 42, wherein the memory 41 stores machine-readable instructions executable by the processor 40, and when the electronic device is running, the processor 40 communicates with the memory 41 through the bus 42, and the processor 40 executes the machine-readable instructions to perform the steps of the connection establishment method as described above.
[0049] Specifically, the memory 41 and the processor 40 can be general-purpose memories and processors, which are not specifically limited here. When the processor 40 runs the computer program stored in the memory 41, the connection establishment method can be executed.
[0050] Corresponding to the above-mentioned connection establishment method, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned connection establishment method are executed.
[0051] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A connection establishment method, applied to a cloud server, characterized in that: include: When it is necessary to switch the network operator line or replace the relay server, apply to the target relay server for the IP address and port of the target network operator line, and create a candidate signaling based on the IP address and port of the target network operator line, which is recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or established between the cloud server and the terminal; The second candidate signaling is sent to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, the streaming media data is pushed to the terminal through the target network operator line.
2. The method according to claim 1, characterized in that Note that the target relay server is the second relay server, the target network operator line is the second network operator line, and before applying to the target relay server for the IP address and port of the target network operator line, the method further includes: In the process of establishing the WebRTC connection between the cloud server and the terminal, the signaling channel is established between the cloud server and the terminal, the session description protocol SDP negotiation is performed through the signaling channel, and the IP address and port of the first network operator line are applied to the first relay server, and the first candidate signaling is created based on the IP address and port of the first network operator line.
3. The method according to claim 1 or 2, characterized in that The network operator corresponding to the target network operator line is the same as or different from the network operator used by the terminal.
4. The method according to claim 1, characterized in that After the end-to-end connection between the cloud server and the terminal is successfully established based on the second candidate signaling, the streaming media data is pushed to the terminal through the target network operator line, including: After the connectivity test based on the second candidate signaling between the cloud server and the terminal passes and the end-to-end connection established between the cloud server and the terminal based on the second candidate signaling is successful, the streaming media data is pushed to the terminal through the target network operator line.
5. A connection establishment device, applied to a cloud server, characterized in that: include: A first creation unit is used to apply to the target relay server for the IP address and port of the target network operator line when it is necessary to switch the network operator line or replace the relay server, and create a candidate signaling based on the IP address and port of the target network operator line, which is recorded as the second candidate signaling, wherein the priority of the second candidate signaling is higher than the first candidate signaling, and the first candidate signaling is the candidate signaling involved in the WebRTC connection being established or established between the cloud server and the terminal; A sending unit is used to send a second candidate signaling to the terminal using the signaling channel used by the WebRTC connection, and after the end-to-end connection between the cloud server and the terminal based on the second candidate signaling is successfully established, push streaming media data to the terminal through the target network operator line.
6. The device according to claim 5, characterized in that Note that the target relay server is the second relay server, the target network operator line is the second network operator line, and the device further includes: The second creation unit is used to establish the signaling channel between the cloud server and the terminal during the process of establishing the WebRTC connection between the cloud server and the terminal before the first creation unit applies for the IP address and port of the target network operator line from the target relay server, perform session description protocol SDP negotiation through the signaling channel, apply for the IP address and port of the first network operator line from the first relay server, and create the first candidate signaling based on the IP address and port of the first network operator line.
7. The device according to claim 5 or 6, characterized in that The network operator corresponding to the target network operator line is the same as or different from the network operator used by the terminal.
8. The device according to claim 5, characterized in that The sending unit is used for: After the connectivity test based on the second candidate signaling between the cloud server and the terminal passes and the end-to-end connection established between the cloud server and the terminal based on the second candidate signaling is successful, the streaming media data is pushed to the terminal through the target network operator line.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the connection establishment method according to any one of claims 1 to 4 are executed.
10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the connection establishment method as described in any one of claims 1 to 4.
