US-12621705-B2 - Network acceleration method, electronic device, and storage medium
Abstract
A network acceleration method, an electronic device, and a storage medium, which relate to the field of network communication technologies, so as to reduce freezing phenomena during video playback. The method includes: when an electronic device runs an application that does not include a peer-to-peer (P2P) flow, a data flow that requires high network quality may be switched to another network with better quality when quality of a currently used network is poor. When the electronic device runs an application that includes a P2P flow, and when a currently used network is poor, because it is difficult to switch the P2P flow to another network with better quality, all data flows of the electronic device may be switched to the another network, thereby reducing video freezing phenomena caused by a difficulty of switching the P2P flow to the another network with better quality.
Inventors
- Jinxiang Wang
- Jinbo Li
- Shuo Chen
- Henghui LIANG
Assignees
- HONOR DEVICE CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20220905
- Priority Date
- 20211118
Claims (20)
- 1 . A method, comprising: running a first application and transmitting a first data flow and a second data flow of the first application by a first network interface card, wherein the first network interface card is a wireless local area network interface card of an electronic device, the first network interface card is configured to connect to a wireless router, a signal received by the first network interface card from the wireless router has a first strength, and neither the first data flow nor the second data flow is a peer-to-peer (P2P) flow; transmitting, when the signal received by the first network interface card from the wireless router has a second strength, the first data flow by a second network interface card of the electronic device, and transmitting the second data flow by the first network interface card, wherein the second strength is less than the first strength, and a network quality of the second network interface card is greater than a network quality of the first network interface card; running a second application and transmitting a third data flow and a fourth data flow of the second application by the first network interface card, wherein a signal received by the first network interface card from the wireless router has the first strength, the third data flow is not a P2P flow, and the fourth data flow is a P2P flow; and transmitting, when the signal received by the first network interface card from the wireless router has the second strength, the third data flow and the fourth data flow by the second network interface card.
- 2 . The method of claim 1 , wherein the first data flow comprises data packets and has a first feature, wherein the second data flow comprises data packets and has a second feature, and wherein the first feature and the second feature differ from each other in at least one of the following parameters: a transmission protocol, a transmission port, and a header feature of the data packets.
- 3 . The method of claim 2 , wherein in a process in which the electronic device transmits the first data flow and the second data flow by the first network interface card, the method comprises: obtaining a first condition corresponding to the first feature and a second condition corresponding to the second feature, wherein the first condition is a condition for transmitting the first data flow on the second network interface card, and the second condition is a condition for transmitting the second data flow on the second network interface card, wherein a flow quality parameter of the first data flow and a flow quality parameter of the second data flow comprises at least one of the following parameters: a latency, a rate, a packet loss rate, a retransmission rate, and whether a packet response times out.
- 4 . The method of claim 3 , wherein when the signal received by the first network interface card from the wireless router has the first strength, the flow quality parameter of the first data flow does not meet the first condition, and the flow quality parameter of the second data flow does not meet the second condition, and wherein when the signal received by the first network interface card from the wireless router has the second strength, the flow quality parameter of the first data flow meets the first condition, and the flow quality parameter of the second data flow does not meet the second condition.
- 5 . The method of claim 2 , wherein the third data flow is a data flow having a third feature, and the fourth data flow is a data flow having a fourth feature, and wherein the third feature and the fourth feature differ from each other in at least one of the following parameters: a transmission protocol, a transmission port, and a header feature of the data packets.
- 6 . The method of claim 5 , wherein in a process in which the electronic device transmits the third data flow and the fourth data flow by the first network interface card, the method comprises: obtaining a third condition corresponding to the third feature and a fourth condition corresponding to the fourth feature, wherein the third condition is a condition for transmitting the third data flow on the second network interface card or a condition for transmitting the third data flow and the fourth data flow on the second network interface card, and the fourth condition is a condition for transmitting the third data flow and the fourth data flow on the second network interface card, wherein a flow quality parameter of the third data flow and a flow quality parameter of the fourth data flow comprises at least one of the following parameters: a latency, a rate, a packet loss rate, a retransmission rate, and whether a packet response times out.
- 7 . The method of claim 6 , wherein when the signal received by the first network interface card from the wireless router has the first strength, the flow quality parameter of the third data flow does not meet the third condition, and the flow quality parameter of the fourth data flow does not meet the fourth condition, wherein either a) if the third condition is the condition for transmitting the third data flow on the second network interface card, when the signal received by the first network interface card from the wireless router has the second strength, the flow quality parameter of the fourth data flow meets the fourth condition, or b) if the third condition is the condition for transmitting the third data flow and the fourth data flow on the second network interface card, when the signal received by the first network interface card from the wireless router has the second strength, the flow quality parameter of the third data flow meets the third condition or the flow quality parameter of the fourth data flow meets the fourth condition.
- 8 . The method of claim 1 , wherein when the electronic device stores an alternate network, transmitting the third data flow and the fourth data flow by the second network interface card comprises transmitting the third data flow and the fourth data flow by the alternate network, wherein the alternate network comprises a second network corresponding to the second network interface card.
- 9 . The method of claim 8 , wherein when the electronic device does not store the alternate network, the method further comprises obtaining network quality parameters of networks corresponding to third network interface cards of the electronic device, wherein the third network interface cards are network interface cards other than the first network interface card in the electronic device, and the network quality parameter comprises at least one of a bandwidth, a latency, and an air interface rate, and wherein when the second network interface card is a network interface card with optimal network quality in the third network interface cards, the method further comprises storing the second network corresponding to the second network interface card as the alternate network, wherein the network quality is determined based on the network quality parameter.
- 10 . The method of claim 9 , wherein before storing the second network corresponding to the second network interface card as the alternate network, the method further comprises waking up the second network corresponding to the second network interface card.
- 11 . The method of claim 9 , wherein before storing the second network corresponding to the second network interface card as the alternate network, the method further comprises obtaining a network quality parameter of a first network corresponding to the first network interface card wherein the second network corresponding to the second network interface card is stored as the alternate network when the network quality of the second network corresponding to the second network interface card is greater than the network quality of the first network corresponding to the first network interface card.
- 12 . The method of claim 11 , wherein the second application is run in a foreground, and the method further comprises sequentially performing, after detecting that the first application runs in the foreground, primary network determining steps in a priority order of network interface cards of the electronic device, until a primary network of the electronic device is obtained, wherein the primary network determining steps comprise: obtaining a network state of a network corresponding to a fourth network interface card of the electronic device; obtaining a network quality parameter of the fourth network interface card when the network state of the network corresponding to the fourth network interface card is available, or terminating the primary network determining steps when the network state of the network corresponding to the fourth network interface card is unavailable; and storing the fourth network interface card as the primary network of the electronic device when the network quality parameter of the fourth network interface card is within a preset range, or terminating the primary network determining steps when the network quality parameter of the fourth network interface card is not within the preset range.
- 13 . The method of claim 12 , wherein obtaining the network quality parameter of the first network corresponding to the first network interface card comprises monitoring a network quality parameter of the primary network in a first period after the primary network of the electronic device is obtained.
- 14 . The method of claim 11 , wherein obtaining the network quality parameter of the first network corresponding to the first network interface card comprises: obtaining a network for transmitting the third data flow and the fourth data flow, wherein the network for transmitting the third data flow and the fourth data flow is the first network corresponding to the first network interface card; and monitoring the network quality parameter of the first network in a first period.
- 15 . An electronic device, comprising: a first network interface card; a second network interface card; one or more processors coupled to the first and second network interface cards; and a memory coupled to the one or more processors and configured to store instructions that, when executed by the one or more processors, cause the electronic device to be configured to: run a first application and transmit a first data flow and a second data flow of the first application by the first network interface card, wherein the first network interface card is a wireless local area network interface card, the first network interface card is configured to connect to a wireless router, a signal received by the first network interface card from the wireless router has a first strength, and neither the first data flow nor the second data flow is a peer-to-peer (P2P) flow; transmit, when the signal received by the first network interface card from the wireless router has a second strength, the first data flow by the second network interface card, and the second data flow by the first network interface card, wherein the second strength is less than the first strength, and a network quality of the second network interface card is greater than a network quality of the first network interface card; run a second application and transmit a third data flow and a fourth data flow of the second application by the first network interface card, wherein a signal received by the first network interface card from the wireless router has the first strength, the third data flow is not a P2P flow, and the fourth data flow is a P2P flow; and transmit, when the signal received by the first network interface card from the wireless router has the second strength, the third data flow and the fourth data flow by the second network interface card.
- 16 . The electronic device of claim 15 , wherein the first data flow comprises data packets and has a first feature, wherein the second data flow comprises data packets and has a second feature, and wherein the first feature and the second feature differ from each other in at least one of the following parameters: a transmission protocol, a transmission port, and a header feature of the data packets.
- 17 . The electronic device of claim 16 , wherein the third data flow is a data flow having a third feature, and the fourth data flow is a data flow having a fourth feature, and wherein the third feature and the fourth feature differ from each other in at least one of the following parameters: a transmission protocol, a transmission port, and a header feature of the data packets.
- 18 . The electronic device of claim 16 , wherein in a process in which the electronic device transmits the first data flow and the second data flow by the first network interface card, the instructions, when executed by the one or more processors, further cause the electronic device to be configured to: obtain a first condition corresponding to the first feature and a second condition corresponding to the second feature, wherein the first condition is a condition for transmitting the first data flow on the second network interface card, and the second condition is a condition for transmitting the second data flow on the second network interface card, wherein a flow quality parameter of the first data flow and a flow quality parameter of the second data flow comprises at least one of the following parameters: a latency, a rate, a packet loss rate, a retransmission rate, and whether a packet response times out.
- 19 . The electronic device of claim 18 , wherein when the signal received by the first network interface card from the wireless router has the first strength, the flow quality parameter of the first data flow does not meet the first condition, and the flow quality parameter of the second data flow does not meet the second condition, and wherein when the signal received by the first network interface card from the wireless router has the second strength, the flow quality parameter of the first data flow meets the first condition, and the flow quality parameter of the second data flow does not meet the second condition.
- 20 . A non-transitory computer-readable storage medium storing instructions that, when executed by one or more processors of an electronic device, cause the electronic device to be configured to: run a first application and transmit a first data flow and a second data flow of the first application by a first network interface card, wherein the first network interface card is a wireless local area network interface card of an electronic device, the first network interface card is configured to connect to a wireless router, a signal received by the first network interface card from the wireless router has a first strength, and neither the first data flow nor the second data flow is a peer-to-peer (P2P) flow; transmit, when the signal received by the first network interface card from the wireless router has a second strength, the first data flow by a second network interface card of the electronic device, and transmit the second data flow by the first network interface card, wherein the second strength is less than the first strength, and a network quality of the second network interface card is greater than a network quality of the first network interface card; run a second application and transmit a third data flow and a fourth data flow of the second application by the first network interface card, wherein a signal received by the first network interface card from the wireless router has the first strength, the third data flow is not a P2P flow, and the fourth data flow is a P2P flow; and transmit, when the signal received by the first network interface card from the wireless router has the second strength, the third data flow and the fourth data flow by the second network interface card.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This is a national stage of International Application No. PCT/CN2022/117088, filed on Sep. 5, 2022, which claims priority to Chinese Patent Application No. 202111383410.5, filed with the China National Intellectual Property Administration on Nov. 18, 2021, both of which are incorporated herein by reference in their entireties. TECHNICAL FIELD This application relates to the network communication field, and in particular, to a network acceleration method, an electronic device, a chip system, and a storage medium. BACKGROUND With an increasing level of intelligence in electronic devices, more application software is installed and run in the electronic devices. In a running process, many application software needs to communicate with corresponding servers by using networks, to implement various functions provided by the application software. In a process of using application software by a user, if transmission quality of a specific data flow is poor, the data flow with a specific feature may be switched, based on the feature of the data flow; to another network for transmission. However, in a video flow application scenario, a video freezing phenomenon still often occurs after flow switching is performed. SUMMARY This application provides a network acceleration method, an electronic device, a chip system, and a storage medium, to reduce video freezing phenomena. To achieve the foregoing objective, the following technical solutions are used in this application. According to a first aspect, this application provides a network acceleration method. The method includes: An electronic device runs a first application, and the electronic device transmits a first data flow and a second data flow of the first application by using a first network interface card, where the first network interface card is a wireless local area network interface card, the first network interface card is configured to connect to a wireless router, a signal received by the first network interface card from the wireless router has first strength, and neither the first data flow nor the second data flow is a P2P flow: when the signal received by the first network interface card from the wireless router has second strength, the electronic device transmits the first data flow by using a second network interface card, and the electronic device transmits the second data flow by using the first network interface card, where the second strength is less than the first strength, and network quality of the second network interface card is better than network quality of the first network interface card;the electronic device runs a second application, and the electronic device transmits a third data flow and a fourth data flow of the second application by using the first network interface card, where a signal received by the first network interface card from the wireless router has the first strength, the third data flow is not a P2P flow; and the fourth data flow is a P2P flow; andwhen the signal received by the first network interface card from the wireless router has the second strength, the electronic device transmits the third data flow and the fourth data flow by using the second network interface card. In this application, when the electronic device runs an application that does not include a P2P flow; and when quality of a currently used network is poor, a data flow that requires high network quality may be switched to another network, and another data flow is transmitted by using an original network interface card. When the electronic device runs an application that includes a P2P flow; and when a currently used network is poor, because the P2P flow cannot be switched to another network, all data flows of the electronic device may be switched to the another network. This reduces video freezing phenomena caused because the P2P flow cannot be switched to the another network and the P2P flow is retained on an original network. In an implementation of the first aspect, the first data flow is a data flow that includes data packets and that has a first feature, the second data flow is a data flow that includes data packets and that has a second feature, and the first feature and the second feature differ from each other in at least one of the following parameters: a transmission protocol, a transmission port, and a header feature of the data packets. In this application, different data flows may be distinguished based on related information (the transmission protocol, the transmission port, and the header feature) carried in the data packets, so that flow-level identification, flow-level quality evaluation, and flow-level network switching can be implemented. In an implementation of the first aspect, in a process in which the electronic device transmits the first data flow and the second data flow of the first application by using the first network interface card, the method includes: The electronic device obtain