Network packet loss parameter calculation method and device, storage medium and computer equipment
By determining the first time window at the target time and calculating the relevant packet number and number, the problem of delay in the calculation of packet loss parameters in the prior art is solved, real-time calculation and efficiency of packet loss parameters are realized.
Patent Information
- Application Number
- CN202311010628.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, the periodic calculation of packet loss parameters cannot reflect the network status in real time, resulting in low calculation delay and real-time.
By determining the first time window at the target time, determining the maximum and minimum packet collection serial numbers within the time window, and the maximum packet collection serial numbers in the previous time period, the start packet serial number and total packet transmission number are calculated, and the packet loss parameters are then calculated.
It realizes the calculation of packet loss parameters immediately at the target time of receiving the data packet, which reduces the calculation delay and improves the real-time calculation of packet loss parameters.
Smart Images

Figure CN119484346A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computing network technology, and more specifically, to a method, device, storage medium and computer equipment for calculating network packet loss parameters. Background Art
[0002] The application of computer network technology can achieve the acquisition of network resources, such as browsing software, transmission software, remote login software, etc. Among them, network transmission quality is an important condition for obtaining network resources. Network transmission quality is usually affected by the real-time status of the network. For example, network congestion will reduce the transmission efficiency of data packets.
[0003] In order to accurately control the quality of network transmission, the existing technology determines the real-time status of the network by calculating the packet loss parameters in the network (packet loss parameters such as packet loss rate, number of packet losses, etc.). This is because the packet loss parameters can directly reflect the reception status of data packets in the current network, and can indirectly reflect the congestion status of the current network, so as to control and optimize the network transmission quality in real time.
[0004] Currently, packet loss parameters are obtained based on periodic calculations. For example, the number of network packet losses is obtained with a period of 1 second, and then the network packet loss rate is calculated based on the number of network packet losses. However, this calculation method requires periodic calculations, and the calculated packet loss parameters cannot reflect the network status in real time, and there is a certain delay. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, storage medium and computer device for calculating a network packet loss parameter to solve the problem in the related art that the periodic calculation of the packet loss parameter cannot reflect the state of the network in real time.
[0006] On the one hand, an embodiment of the present application provides a method for calculating a network packet loss parameter, the method comprising: determining a first time window based on a target time, the first time window comprising a first time period, the first time period being a time period with the target time as the end time and a first time period in length; determining a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and determining a second maximum packet receiving sequence number before the first time period; determining a starting packet sequence number within the first time period based on the minimum packet receiving sequence number and the second maximum packet receiving sequence number within the first time period; determining a total number of packets sent within the first time period based on the first maximum packet receiving sequence number and the starting packet sequence number within the first time period; and determining a packet loss parameter corresponding to the target time based on the total number of packets received within the first time window and the total number of packets sent within the first time period.
[0007] On the other hand, an embodiment of the present application also provides a device for calculating network packet loss parameters, which includes: a time window determination module, which is used to determine a first time window based on a target time, the first time window including a first time period, the first time period being a time period with the target time as the end time and a first time period in length; a packet receiving determination module, which is used to determine a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and to determine a second maximum packet receiving sequence number before the first time period; a packet number determination module, which is used to determine a starting packet sequence number within the first time period based on the minimum packet receiving sequence number and the second maximum packet receiving sequence number within the first time period; a packet number determination module, which is used to determine a total number of packets sent within the first time period based on the first maximum packet receiving sequence number and the starting packet sequence number within the first time period; a parameter determination module, which is used to determine the packet loss parameter corresponding to the target time based on the total number of packets received within the first time window and the total number of packets sent within the first time period.
[0008] On the other hand, an embodiment of the present application further provides a computer device, which includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are called by the processor, the above-mentioned method for calculating network packet loss parameters is executed.
[0009] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, which stores a program code, wherein when the program code is executed by a processor, the above-mentioned method for calculating the network packet loss parameter is executed.
[0010] On the other hand, an embodiment of the present application further provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium, and the processor executes the computer instructions, so that the computer executes the steps in the above-mentioned method for calculating network packet loss parameters.
[0011] The method for calculating the network packet loss parameter provided by the present application can determine a first time window at a target time when a data packet is received, the first time window including a first time period with the target time as the end time and a first time period as the duration. The first maximum packet receiving sequence number in the first time period and the minimum packet receiving sequence number in the first time period are determined, and the second maximum packet receiving sequence number before the first time period is determined.
[0012] Further, the starting packet sequence number in the first time period is determined according to the minimum packet receiving sequence number and the second maximum packet receiving sequence number in the first time period, and the total number of packets sent in the first time period is determined according to the first maximum packet receiving sequence number and the starting packet sequence number in the first time period. Furthermore, the packet loss parameter corresponding to the target time is determined according to the total number of packets received in the first time window and the total number of packets sent in the first time period.
[0013] Since the start time of the first time period is before the target time and the end time is the target time, in this way, if the calculation of the packet loss parameter is requested at the target time, the packet receiving situation in the first time period is known, and therefore, the first maximum packet receiving sequence number in the first time period and the minimum packet receiving sequence number in the first time period can be determined accordingly; similarly, since the packet receiving situation in the first time period is known before the target time, the second maximum packet receiving sequence number can be determined accordingly; and on this basis, the total number of packets sent in the first time period is determined according to the first maximum packet receiving sequence number and the starting packet sequence number in the first time period, and the packet loss parameter corresponding to the target time is determined according to the total number of packets received in the first time window and the total number of packets sent in the first time period. In this way, the delay of the calculated packet loss parameter caused by the need to wait for the packet receiving situation after the target time to calculate the packet loss parameter can be reduced, so that the packet loss parameter can be calculated in real time, thereby improving the real-time calculation of the packet loss parameter. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0015] Figure 1 A schematic diagram of the architecture of a network packet loss parameter calculation system provided in an embodiment of the present application is shown.
[0016] Figure 2 An application scenario diagram of calculating a network packet loss parameter provided in an embodiment of the present application is shown.
[0017] Figure 3 A flow chart of a method for calculating a network packet loss parameter provided in an embodiment of the present application is shown.
[0018] Figure 4 A schematic diagram of sliding a time window provided in an embodiment of the present application is shown.
[0019] Figure 5 A schematic diagram of determining a packet sequence number provided in an embodiment of the present application is shown.
[0020] Figure 6 A flow chart of another method for calculating network packet loss parameters provided in an embodiment of the present application is shown.
[0021] Figure 7 A schematic diagram of a first time window including a buffer period provided in an embodiment of the present application is shown.
[0022] Figure 8 A flow chart of another method for calculating network packet loss parameters provided in an embodiment of the present application is shown.
[0023] Fig. 9 A schematic diagram of a calculation cycle provided by an embodiment of the present application is shown.
[0024] Fig.10 A schematic diagram of determining a maximum packet receiving sequence number provided in an embodiment of the present application is shown.
[0025] Fig.11 A flow chart of another method for calculating network packet loss parameters provided in an embodiment of the present application is shown.
[0026] Fig.12 A schematic diagram of a second time window including a buffer period provided in an embodiment of the present application is shown.
[0027] Fig.13 A flow chart for calculating a network packet loss rate provided in an embodiment of the present application is shown.
[0028] Fig.14 A packet loss rate comparison diagram based on calculations in different time windows provided in an embodiment of the present application is shown.
[0029] Fig.15 A packet loss rate comparison diagram using smoothing processing provided in an embodiment of the present application is shown.
[0030] Fig.16 A packet loss rate comparison diagram for increasing buffer period calculation provided by an embodiment of the present application is shown.
[0031] Fig.17 A packet loss rate comparison diagram without adding a buffer period calculation provided in an embodiment of the present application is shown.
[0032] Fig.18 A module block diagram of a device for calculating network packet loss parameters provided in an embodiment of the present application is shown.
[0033] Fig.19 It is a module block diagram of a computer device provided in an embodiment of the present application.
[0034] Fig. 20It is a module block diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0036] In some processes described in the specification, claims and the above drawings, multiple steps appearing in a specific order are included, but it should be clearly understood that these steps may not be executed in the order in which they appear in this document or may be executed in parallel. The step numbers are only used to distinguish different steps, and the numbers themselves do not represent any execution order. In addition, the descriptions such as "first" and "second" in this document are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0037] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions 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 only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0038] It should be noted that in the specific implementation of this application, the network transmission data packets and other related data involved, when applied to the specific products or technologies of the embodiments of this application, need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and carry out subsequent data use and processing within the scope of authorization of laws, regulations and personal information subjects.
[0039] During data transmission, data packets may be lost due to network quality. The packet loss parameter in this application can be the number of lost packets or the packet loss rate. The packet loss rate (Packet Loss Rate or LossTolerance) refers to the ratio of the number of lost packets to the total number of packets (the total number of packets can also be understood as the total number of sent packets). The packet loss rate can be used as an indicator to measure the loss of packets during transmission, usually expressed as a percentage.
[0040] Generally, the packet loss rate can be used to reflect the transmission performance of the network or the quality of the network, or the state of the network. The reasons for packet loss in the network may include physical line failure, equipment failure, network path error, or network obstruction and congestion. The packet loss rate has a certain relationship with the length of the data packet and the frequency of data packet transmission. When the Gigabit network card exceeds 200Mbps, the packet loss rate is less than 5 / 10,000; when the 100M network card exceeds 60Mbps, the packet loss rate is less than 1 / 10,000. The state of the network can be determined by calculating the packet loss rate, so as to facilitate the subsequent real-time estimation of the network bandwidth, and adopt corresponding control strategies based on the estimated network bandwidth to ensure accurate data transmission. The calculation formula of the packet loss rate is: packet loss rate = number of lost data packets / total number of data packets, where the total number of data packets is the total number of data packets sent. In this application, the total number of data packets sent is referred to as the total number of packets sent, and the number of lost data packets = total number of packets sent - total number of packets received.
[0041] In the existing congestion control packet loss rate calculation scheme, the cumulative number of packet losses is calculated in a streaming manner, and then the packet loss rate calculation function is called at a certain time period according to business needs, so as to calculate the network packet loss rate in segments. However, this calculation method can only calculate the packet loss rate according to the period, for example, the packet loss rate is calculated once every 1s, and the packet loss rate cannot be calculated in real time, resulting in that the packet loss rate result of each calculation must wait for a calculation period of 1s to be obtained. Therefore, there is a calculation delay, and the problem of low real-time performance of the packet loss rate calculation cannot be avoided. In order to solve the above problems, the inventors have proposed a method for calculating the network packet loss parameters of the present application after research.
[0042] The following first introduces the system architecture of the method for calculating network packet loss parameters involved in this application.
[0043] See also Figure 1 , Figure 1 A schematic diagram of the architecture of a system for calculating network packet loss parameters is shown. Figure 1 As shown, the system 100 may include a transmitter 110 and a receiver 130. The network 140 serves as a communication medium between the transmitter 110 and the receiver 130. The network 140 may include various wired or wireless communication links, for example, a communication connection established by Web Real-Time Communication (WebRTC) technology. During network data transmission, the transmitter 110 may send a data packet 120 to the receiver 130 via the network 140. The transmitter 110 and the receiver 130 may be devices capable of data transmission, such as a server, a terminal device, a gateway, and a router.
[0044] The server side can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud computing, cloud functions, cloud storage, cloud communications, network services, domain name services, middleware services, security services, CDN, blockchain, big data and artificial intelligence platforms. The terminal device can be a vehicle-mounted device, smart TV, tablet computer, laptop computer, desktop computer, smart phone and other devices with display, storage and computing functions, which are not limited here.
[0045] In an embodiment of the present application, the data packet 120 may be a carrier that is effectively transmitted in a network based on multi-layer protocol encapsulation. For example, text, images, executable files or other data are encapsulated into organized data units that can be transmitted in a reliable and effective manner on the network. The format of the data packet is specified according to a certain protocol, such as the Internet Protocol (IP) of the network layer, the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP) of the transport layer. It should be noted that during the transmission of the data packet 120 in the network, it can be processed by various layers of protocols in multiple computers, and finally transmitted to the recipient in an orderly form, and then assembled into the original data.
[0046] Understandably, Figure 1 It is only a schematic diagram of the architecture of a system provided in the embodiment of the present application. The architecture of the system described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Figure 1 Only the sending end 110 and the receiving end 130 are shown. In other cases, switches and routers for network communication may be set between the sending end 110 and the receiving end 130. In different embodiments, the system 100 may be configured with more or fewer devices based on business needs, which is not limited here.
[0047] See also Figure 2 , Figure 2 FIG. 1 shows an application scenario diagram of calculating a network packet loss parameter. Figure 2As shown, the calculation method of the network packet loss parameter can be applied to a computer system 200 of a Client-Server (C / S) architecture, which may include a server and multiple terminal devices, and may be applied to online video scenarios. For example, the computer system 200 may include a server 210 of a video service provider, a first terminal device 230 (e.g., a laptop) and a second terminal device 250 (e.g., a tablet) on the user side. The first terminal device 230 may be connected to the server 210 through a wired network communication, and the second terminal device 250 may be connected to the server 210 through a wireless network communication via a wireless router 220.
[0048] In the online video scenario, the server 210 can use the video transmission protocol to send the video to be transmitted in the form of data packets through the network to the first terminal device 230 and the second terminal device 250. In order to ensure the quality of video transmission, the network status of the network used for video transmission can be obtained in real time so as to regulate the quality of network transmission. To this end, the network status can be reflected by calculating the packet loss parameters of the network during the transmission of data packets. Exemplarily, in the process of the server 210 sending data packets to the first terminal device 230, the first terminal device 230 can be based on the received data packet sequence, each data packet in the data packet sequence has a corresponding packet sequence number, for example, a data packet 240 with a packet sequence number of n, and the first terminal device 230 can calculate the packet loss parameters, such as the number of lost packets or the packet loss rate calculated based on the number of lost packets, based on the packet sequence numbers of each data packet in the received data packet sequence according to the method of the present application.
[0049] It should be noted that Figure 2 It is only an application scenario diagram of a system provided by an embodiment of the present application. The system architecture and application scenario described in the embodiment of the present application are to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. For example, the calculation of packet loss rate can be applied to online video scenarios, and can also be applied to online social networking on the Internet (for example, real-time video calls, real-time audio calls) or data sharing within a local area network, etc., which require the quality of network transmission. It is known to those of ordinary skill in the art that with the evolution of the system architecture, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.
[0050] See also Figure 3 , Figure 3 The flowchart of a method for calculating a network packet loss parameter provided by an embodiment of the present application is shown. In this embodiment, the method for calculating a network packet loss parameter can be executed by a device as a receiving end, and the device as a receiving end can be a terminal device, a server, a gateway, a router, etc. Figure 3As shown, the method for calculating the network packet loss parameter may include the following steps:
[0051] Step S110: determining a first time window based on the target time, the first time window including a first time period, the first time period being a time period starting from the target time and lasting for the first time period.
[0052] Among them, the target time refers to the time point at which the packet loss parameters are to be determined. It is understandable that since the network status at different time points may be different, the packet loss situation in the network at different time points may also be different. Correspondingly, the packet loss parameters requested to be determined at different time points for the same network may also be different.
[0053] As an implementation mode, the target time can be used as the end time, and the first time period can be determined in the reverse time direction. The duration of the first time period can be set to the first duration. In other words, the start time of the first time period is before the target time, and the target time is used as the end time. In some embodiments, the first time period can be used as the first time window. The first duration can be set according to the response duration or accuracy requirements determined by the packet loss parameters in the specific application scenario, for example, 1s, 500ms, 800ms, 900ms, etc., which are not limited here. It is understandable that different target times will result in corresponding differences in the first time period determined based on the target time. Further, there may also be differences in the first time window determined based on the target time.
[0054] See also Figure 4 , Figure 4 A schematic diagram of a sliding time window is shown. Figure 4 As shown in FIG. 1 , by receiving new data packets, the length of the data packet sequence gradually increases. Taking data packet sequence A as a benchmark, if time point T1 is used as the target time, time point T1 can be used as the end time, and a time period of the first time length (i.e., the first time period determined relative to time point T1) can be used as the first time window. The first time window is as follows: Figure 4 If the time point T2 is used as the target time, the time point T2 can be used as the end time, and the time period with the first time length can be determined in the reverse time direction as the first time window. The first time window is as follows: Figure 4 As shown in the underlined box in the data packet sequence C in . If the T3 time point is used as the target time, the T3 time point can be used as the end time, and the time period with the first time length determined in the reverse time direction is used as the first time window. The first time window is as follows Figure 4 The data packet sequence in D is shown in the underlined box.
[0055] It is worth mentioning that Figure 4It is only a schematic diagram of a sliding time window provided in an embodiment of the present application. The data packet sequence and the number of data packets in the first time window described and shown in the embodiment of the present application are for the purpose of more clearly illustrating the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. For example, Figure 4 The first time window in FIG. 4 shows 4 data packets, but in other cases, the number of data packets in the first time window may be more or less, and the description of the time window mentioned here and below is not limited thereto.
[0056] In other embodiments, on the basis of the first time period, a first reference time period before the first time period, which is a first designated time period and continuous with the first time period, can be combined with the first time period, and the combined time period can be used as the first time window. In other embodiments, on the basis of the first time period, a second reference time period after the first time period, which is a second designated time period and continuous with the first time period, can be combined with the first time period, and the combined time period can be used as the first time window. In other embodiments, the first reference time period, the first time period and the second reference time period can be combined in chronological order, and the combined time period can be used as the first time window. As an implementation method, the first designated time period and the second designated time period can be set to be not more than the first time period, thereby ensuring that the situation of the data packets received in the first time period is mainly considered when the packet loss parameters are calculated based on the first time window. Of course, when the first time window is obtained by combining the first reference time period, the first time period and the second reference time, the sum of the first designated time period and the second designated time period can also be set to be not more than the first time period.
[0057] Step S120: Determine a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and determine a second maximum packet receiving sequence number before the first time period.
[0058] For ease of distinction, the maximum packet sequence number among the data packets received in the first time period is called the first maximum received packet sequence number in the first time period, and the minimum packet sequence number among the data packets received in the first time period is called the minimum received packet sequence number in the first time period.
[0059] The first maximum received packet sequence number refers to the maximum packet sequence number among the data packets received in the first time period, and the minimum received packet sequence number in the first time period refers to the minimum packet sequence number among the data packets received in the first time period.
[0060] The second maximum packet receiving sequence number refers to the maximum packet sequence number in the data packets received in the time period before the first time period in the reverse time direction. Since there will be a large number of data packets that need to be received and stored during the data transmission process, but considering the limited storage resources, only data packets of a certain length of time can be stored to ensure that not too many storage resources are occupied. To this end, in some embodiments, a packet storage time window can be set. The packet storage time window refers to a time window set for caching received data packets. The packet storage time window is a time period determined in the reverse time direction with the target time as the end time. The duration of the time period is greater than the first duration. In other words, the start time of the packet storage time window is earlier than the start time of the first time period.
[0061] It is understandable that the packet storage time window is related to the target time. If the target time is different, the corresponding packet storage time window is also different. The second maximum packet receiving sequence number may refer to the maximum packet sequence number of the data packets received in the packet storage time window and in the time period before the first time period. Since the packet storage time window is a time window set for caching received data packets, the situation of the data packets received in the packet storage time window corresponding to the target time is known, and thus the second maximum packet receiving sequence number can be determined based on the situation of the data packets received in the packet storage time window.
[0062] As an implementation, see Figure 5 , Figure 5 FIG. 4 is a schematic diagram showing a method for determining a packet sequence number. Figure 5 As shown, the box represents a data packet, and the number in the box represents the packet sequence number corresponding to the data packet. The packet sequence numbers of each data packet received in the first time period can be traversed to determine the first maximum packet sequence number and the minimum packet sequence number in the first time period. Further, the time period from the start time of the packet storage time window to the start time of the first time period can be used as a reference time period. It can be understood that the data packet received in the reference time period is the data packet received in the packet storage time window and before the first time period. After that, the packet sequence numbers of each data packet received in the reference time period are traversed, and the largest packet sequence number in the reference time period is used as the second maximum packet sequence number.
[0063] It can be understood that since the start time of the first time period is before the target time and the target time is used as the end time, for the receiving device, the data packet reception status in the first time period is known at the target time. Therefore, in step S120, the first maximum received packet number in the first time period and the minimum received packet number in the first time period can be determined based on the packet sequence numbers of each data packet received in the first time period.
[0064] In some embodiments, if no data packet is sent in the reference time period (ie, the time period from the start time of the packet storage time window to the start time of the first time period), the second maximum packet receiving sequence number may be set to zero.
[0065] Step S130: Determine the starting packet sequence number in the first time period according to the minimum received packet sequence number and the second maximum received packet sequence number in the first time period.
[0066] The starting packet sequence number in the first time period refers to the packet sequence number of the first data packet sent in the first time period. Usually, if all the data packets sent in the first time period are received by the receiver, the starting packet sequence number in the first time period is the minimum packet sequence number among the data packets received in the first time period. However, in practice, there may be data packets sent in the first time period that are not received by the receiver. For example, the first data packet sent in the first time period is not received by the receiver, and the first data packet received by the receiver is a packet after the first data packet sent in the first time period, that is, a reverse-order packet. In this way, it is inaccurate to use the minimum packet sequence number among the data packets received in the first time period as the starting packet sequence number in the first time period, and this may cause the packet loss parameters calculated subsequently to be inaccurate.
[0067] In the present application, in order to solve this problem, the minimum packet receiving sequence number and the second maximum packet receiving sequence number in the first time period are combined to determine the starting packet sequence number in the first time period, rather than directly using the minimum packet receiving sequence number in the first time period as the starting packet sequence number in the first time period. Usually, if the data packet corresponding to the second maximum packet receiving sequence number is the last data packet sent before the first time period, the next data packet of the data packet corresponding to the second maximum packet receiving sequence number is the first data packet sent in the first time period. Based on this principle, the starting packet sequence number in the first time period can be determined in the following manner:
[0068] If the second maximum packet receiving sequence number is greater than zero (indicating that a data packet was sent in the reference time period), the minimum value of the minimum packet receiving sequence number and the reference packet receiving sequence number is used as the starting packet sequence number in the first time period, and the reference packet receiving sequence number is the sum of the second maximum packet receiving sequence number and 1. If the second maximum packet receiving sequence number is not greater than zero (indicating that no data packet was sent in the reference time period), the minimum packet receiving sequence number in the first time period is determined as the starting packet sequence number in the first time period. The calculation formula for the starting packet sequence number is as follows:
[0069]
[0070] Among them, Seq begin Indicates the starting packet sequence number, Seq last_max Indicates the second largest received packet sequence number, Seq min Indicates the minimum received sequence packet number in the first time period.
[0071] Step S140: Determine the total number of packets sent in the first time period according to the first maximum received packet sequence number and the start packet sequence number in the first time period.
[0072] As an implementation method, the first maximum received packet sequence number can be used as the end packet sequence number in the first time period. On this basis, the difference between the end packet sequence number in the first time period and the start packet sequence number in the first time period is used as the total number of packets sent in the first time period (the total number of packets sent in the first time period can also be understood as the expected number of received packets in the first time period). The calculation formula is as follows:
[0073] Num expect =Seq max -Seq begin (2)
[0074] Among them, Num expect , Seq max They respectively represent the total number of packets sent and the first maximum number of packets received in the first time period.
[0075] Step S150: Determine a packet loss parameter corresponding to a target time according to a total number of received packets in the first time window and a total number of sent packets in the first time period.
[0076] The packet loss parameter may include the number of packet losses or the packet loss rate calculated based on the number of packet losses. The total number of received packets in the first time window refers to the number of data packets actually received by the receiver in the first time window. When the first time window is determined, the number of data packets received in the first time window can be counted, and the counted number is the total number of received packets in the first time window.
[0077] As an implementation method, the total number of received packets can be initialized to 0, and all packet numbers θ between the starting packet number and the first maximum received packet number in the first time period are traversed one by one to determine whether there is a data packet with the same packet number θ in the first time window. begin ,Seq max ]&θ∈N. If it exists, the total number of received packets is increased by 1. The calculation formula for the total number of received packets is as follows:
[0078]
[0079] Among them, Num real Indicates the total number of received packets in the first time window. Window1 indicates the first time window.
[0080] Furthermore, the number of lost packets Num corresponding to the target time can be determined based on the total number of received packets in the first time window and the total number of sent packets in the first time period. loss =Num expect -Num real Optionally, it can also be based on the number of lost packets Num loss And the total number of packets sent in the first time period Num expect Calculate the packet loss rate corresponding to the target time. The calculation formula is as follows:
[0081] Rate loss =Num loss / Num expect (4)
[0082] Among them, Rate loss Indicates the packet loss rate corresponding to the target time.
[0083] In this embodiment, a first time window may be determined at the target time when a data packet is received, the first time window including a first time period with the target time as the end time and a first time period of duration; and a first maximum packet receiving sequence number in the first time period and a minimum packet receiving sequence number in the first time period are determined, as well as a second maximum packet receiving sequence number before the first time period. Based on the minimum packet receiving sequence number and the second maximum packet receiving sequence number in the first time period, a starting packet sequence number in the first time period is determined, and based on the first maximum packet receiving sequence number and the starting packet sequence number in the first time period, a total number of packets sent in the first time period is determined. Furthermore, based on the total number of packets received in the first time window and the total number of packets sent in the first time period, a packet loss parameter corresponding to the target time is determined.
[0084] In this way, since the start time of the first time period is before the target time and the end time is the target time, in this way, if the calculation of the packet loss parameter is requested at the target time, the packet receiving situation in the first time period is known, and therefore, the first maximum packet receiving sequence number in the first time period and the minimum packet receiving sequence number in the first time period can be determined accordingly; similarly, since the packet receiving situation between the first time period before the target time is known, the second maximum packet receiving sequence number can be determined accordingly; and on this basis, according to the first maximum packet receiving sequence number and the starting packet sequence number in the first time period, the total number of packets sent in the first time period is determined; according to the total number of packets received in the first time window and the total number of packets sent in the first time period, the packet loss parameter corresponding to the target time is determined, in this way, the delay of the calculated packet loss parameter caused by the need to wait for the packet receiving situation after the target time to calculate the packet loss parameter can be reduced, and the packet loss parameter can be calculated in real time, thereby improving the real-time performance of the calculation of the packet loss parameter.
[0085] Moreover, in the present application, the starting packet number in the first time period is determined based on the minimum packet receiving sequence number in the first time period and the second maximum packet receiving sequence number, and then the total number of packets sent in the first time period is determined, instead of directly using the minimum packet receiving sequence number in the first time period as the starting packet sequence number in the first time period. This can effectively reduce the situation where the total number of packets sent in the first time period is inaccurate due to the first data packet in the first time period not being received.
[0086] See also Figure 6 , Figure 6 A flow chart of a method for calculating network packet loss parameters provided by another embodiment of the present application is shown. In this embodiment, the method for calculating network packet loss parameters can be executed by a device as a receiving end. The device as the receiving end can be a terminal device, a server, a gateway, a router, etc. as described above. Figure 6 As shown, the method for calculating the network packet loss parameter may specifically include the following steps:
[0087] Step S210: Obtain scene application information.
[0088] Among them, the scenario application information can reflect the requirements for network detection. In the present application, different packet loss parameter calculation schemes can be provided for different application scenarios, and correspondingly, different packet loss parameter calculation schemes are applicable to different application scenarios. The scenario application information can be pre-specified by the user at the terminal, and the terminal is, for example, a device as a receiver. Of course, in other embodiments, the terminal can also be a device as a sender, and the device as a sender sends the scenario application information to the device as a receiver. In other embodiments, the scenario application information can also be pre-set, which is not specifically limited here.
[0089] To this end, this application takes into account the different requirements of network application scenarios for data transmission quality, which will also bring about differences in network detection requirements (that is, network status detection requirements). For this reason, it is proposed to select the most suitable calculation method for packet loss parameters based on the requirements of actual network application scenarios for network detection. Among them, scenario application information refers to information that can reflect the current network application environment, including: operating system type (such as Android, IOS), resource utilization (such as computing resources, storage resources), communication protocol, and product application terminal, etc.
[0090] In the application embodiment, different scenario application information indicates the corresponding network detection requirements, which at least include detection requirements for real-time performance. In other embodiments, the network detection requirements may also include detection requirements for at least one of stability and reverse sensitivity. Among them, real-time performance is used to indicate the requirements for the response speed of network status detection. For example, the game application scenario has high requirements for the response speed of network status detection, and the network packet loss rate needs to be calculated in real time. In this scenario, the real-time performance requirements of network detection are relatively high. Stability is used to indicate the requirements for the stability of network status detection results. For example, in the online call application scenario, the network packet loss rate needs to be calculated stably.
[0091] Under normal circumstances, data packets in the network are sent in sequence (for example, data packets with smaller sequence numbers are sent first, and data packets with larger sequence numbers are sent later). When the network quality is poor, reverse-order packets may appear in the transmission process of data packets, that is, a data packet sent later may be received first. In other words, the packet number of the first received data packet is larger, and the packet number of the later received data packet is smaller, resulting in disorder in the sequence of received data packets. For this reason, the network status detection process will also require the ability to effectively deal with the impact of reverse-order packets on packet loss parameters, that is, reverse-order sensitivity. The number of reverse-order packets is also counted in the total number of received packets in the first time period.
[0092] As an implementation method, the operating system type can be obtained, and further, the corresponding network detection requirements can be determined based on the operating system type. For example, when the obtained operating system type is Android, the network detection requirements matching the operating system type are searched in the relational database, and the matching network detection requirements can be obtained as reverse sensitivity. The relational database can be established based on experimental statistical results of the actual requirements for network detection in different application scenarios.
[0093] Step S220: If the scenario application information indicates that the real-time level required by the network detection is higher than the first real-time level, determine the first time window based on the target time.
[0094] As described above, Figure 3 The corresponding embodiment can effectively determine the first time window based on the target time according to the real-time level required for network detection indicated by the scenario application information.
[0095] In some embodiments, for application scenarios that require a high response speed for network status detection, the packet loss parameters can be calculated based on a sliding time window, and the network packet loss parameters can be determined immediately each time a new data packet is received.
[0096] In other embodiments, considering that the scenario application information can also indicate the reverse order sensitivity required by the network detection, the present application proposes that in the method of calculating the packet loss parameter based on the sliding time window, the first time window of different lengths can also be determined according to the reverse order sensitivity level range to which the reverse order sensitivity level required by the network detection belongs, so as to solve the reverse order packet problem.
[0097] As an implementation manner, if the scenario application information indicates that the reverse order sensitivity level of the network detection is within a first reverse order sensitivity range, the first time period may be used as the first time window.
[0098] As another implementation, if the scenario application information indicates that the reverse order sensitivity level of the network detection is within the second reverse order sensitivity range, the first time period, the front buffer period, and the rear buffer period are combined, and the combined period is used as the first time window. Among them, the reverse order sensitivity level within the first reverse order sensitivity range is lower than the reverse order sensitivity level within the second reverse order sensitivity range. The front buffer period can be regarded as the first reference time period mentioned above, and the rear buffer period can be regarded as the second reference time period mentioned above.
[0099] That is, within the first reverse order sensitivity range, the reverse order packet problem can be ignored during network detection, and the response speed of packet loss parameter calculation, that is, real-time performance, can be focused on. This is because, when considering the reverse order packet problem, the window length of the first time window needs to be expanded, and the response speed of packet loss parameter calculation will be reduced. Within the second reverse order sensitivity range, the reverse order packet problem may need to be focused on during network detection to avoid the reverse order packet situation affecting the accuracy of the packet loss parameter. Among them, the first reverse order sensitivity range and the second reverse order sensitivity range can be set according to actual needs.
[0100] See also Figure 7 , Figure 7 A schematic diagram of a first time window including a buffer period is shown. Figure 7 As shown, the front buffer period refers to the period extending before the first time period. The rear buffer period refers to the period extending after the first time period, wherein the end time of the front buffer period is the start time of the first time period, and the start time of the rear buffer period is the end time of the first time period.
[0101] Among them, the length of the front buffer period and the length of the rear buffer period can be set according to the actual business scenario requirements, and are not limited here. Optionally, the length of the front buffer period and the length of the rear buffer period can be set according to the sensitivity of the business scenario to the reverse order packet. For example, when the reverse order sensitivity level is in the second reverse order sensitivity range, the higher the reverse order sensitivity level, the longer the length of the front buffer period and the length of the rear buffer period can be. In some embodiments, the length of the front buffer period and the length of the rear buffer period can also be set to be less than the first length. Optionally, the length of the front buffer period and the length of the rear buffer period can be set to half of the first length. For example, when the first length is 1s, the length of the front buffer period and the length of the rear buffer period can be set to 500ms.
[0102] Step S230: Determine a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and determine a second maximum packet receiving sequence number before the first time period.
[0103] Step S240: Determine the starting packet sequence number in the first time period according to the minimum received packet sequence number and the second maximum received packet sequence number in the first time period.
[0104] Step S250: Determine the total number of packets sent in the first time period according to the first maximum received packet sequence number and the starting packet sequence number in the first time period.
[0105] Specifically, step S230 and step S250 may refer to the contents of step S130 and step S150 in the aforementioned embodiment, which will not be repeated here.
[0106] Step S260: Determine a packet loss parameter corresponding to the target time according to the total number of received packets in the first time window and the total number of sent packets in the first time period.
[0107] When a new data packet is received, the packet loss parameter of the network can be determined immediately based on the sliding time window. Considering the reverse order sensitivity required by network detection. Therefore, in the process of counting the total number of received packets in the first time window, it is necessary to count the total number of received packets in the first time window of different lengths according to whether the first time window includes the front buffer period and the back buffer period.
[0108] In some embodiments, if the first time window only includes the first time period, the packet loss parameter corresponding to the target time is determined according to the total number of received packets in the first time window (i.e., the first time period) and the total number of sent packets in the first time period. Specifically, the content of step S150 in the aforementioned embodiment may be referred to, which will not be repeated here.
[0109] In some other embodiments, if the first time window includes a first time period, a front buffer period, and a back buffer period, the total number of received packets in the first time window (i.e., the combined time period) is counted. Specifically, the total number of received packets can be initialized to 0, and all packet sequence numbers θ between the start packet sequence number and the first maximum received packet sequence number in the first time period are traversed one by one, and it is determined whether there is a data packet with the same packet sequence number as the packet sequence number θ in the combined time period. Where θ∈[Seq begin ,Seq max ]&θ∈N. If it exists, the total number of received packets is increased by 1. The calculation formula for the total number of received packets is as follows:
[0110]
[0111] Among them, Num real Indicates the total number of packets received in the first time window, Window buffer The first time window includes the first time period, the front buffer period, and the back buffer period. Further, the packet loss parameter corresponding to the target time can be determined according to the total number of received packets in the first time window and the total number of sent packets in the first time period. Specifically, the content of step S150 in the aforementioned embodiment can be referred to, which will not be repeated here.
[0112] In this way, by extending the front buffer period and the back buffer period on the basis of the first time period to construct a first time window with a longer duration, when counting the total number of received packets in the first time window, reversed-order packets outside the first time period can be counted, solving the problem of reversed-order packet sensitivity. For network scenarios where reversed order is prone to occur, it can be ensured that the calculated packet loss rate does not jitter, thereby improving the accuracy of packet loss rate calculation and the accuracy of network status estimation, which is conducive to controlling network transmission quality.
[0113] In the process of determining the packet loss parameters of the network in real time based on a sliding time window, there may be a small number of data packets in the first time window, resulting in a low confidence level in the packet loss rate calculated for the target time. Therefore, in some embodiments, the packet loss rate can be smoothed to solve the problem of low confidence level in the packet loss rate.
[0114] As an implementation method, the number of packet losses in the first time window can be determined based on the total number of received packets in the first time window and the total number of sent packets in the first time period, and the reference packet loss rate corresponding to the target time can be determined based on the number of packet losses in the first time window and the total number of sent packets in the first time period. Further, a smoothing process can be performed based on the reference packet loss rate corresponding to the target time and the packet loss rate corresponding to the previous time point of the target time to obtain a target packet loss rate corresponding to the target time.
[0115] In this embodiment, the packet loss rate calculated according to the above formula 4 is called the reference packet loss rate corresponding to the target time. Then, the reference packet loss rate corresponding to the target time is smoothed by using the packet loss rate corresponding to the previous time point of the target time to obtain the target packet loss rate corresponding to the target time.
[0116] In some embodiments, the smoothing method may be to perform weighted processing on the reference packet loss rate corresponding to the target time and the packet loss rate corresponding to the previous time point of the target time, and use the result of the weighted processing as the target packet loss rate corresponding to the target time. The weighted coefficient of the reference packet loss rate corresponding to the target time and the weighted coefficient of the packet loss rate corresponding to the previous time point of the target time may be set according to actual needs. For example, the weighted coefficient of the reference packet loss rate corresponding to the target time may be set such that the sum of the weighted coefficient of the packet loss rate corresponding to the previous time point of the target time is equal to 1, and the weighted coefficient of the reference packet loss rate corresponding to the target time is less than the weighted coefficient of the packet loss rate corresponding to the previous time point of the target time.
[0117] In this way, when the total number of packets sent in the first time period is small, a smaller weighting coefficient can be assigned to the reference packet loss rate corresponding to the target time, and the reference packet loss rate corresponding to the target time can be calculated based on the packet loss rate corresponding to the previous time point of the target time. In this way, the problem of low confidence in the calculated packet loss rate due to the small number of data packets sent in the first time window in the related technology can be effectively solved, thereby improving the accuracy of the target packet loss rate.
[0118] In some embodiments, a smoothing coefficient can be determined based on the total number of packets sent in the first time period, and a reference packet loss rate corresponding to the target time and a packet loss rate corresponding to the previous time point of the target time can be weighted according to the smoothing coefficient to obtain a target packet loss rate corresponding to the target time. In this embodiment, a weighting coefficient of a reference packet loss rate corresponding to the target time can be determined based on the smoothing coefficient, and a weighting coefficient of a packet loss rate corresponding to the previous time point of the target time can be determined according to the smoothing coefficient, and then, a weighted calculation according to the corresponding weighting coefficient is performed to obtain the target packet loss rate corresponding to the target time. In some embodiments, a corresponding relationship between the total number of packets sent and the smoothing coefficient can be pre-set, and then, a smoothing coefficient corresponding to the total number of packets sent in the first time period can be determined according to the total number of packets sent in the first time period and the set corresponding relationship.
[0119] In the above embodiment, based on the smoothing of the reference packet loss rate corresponding to the target time and the packet loss rate corresponding to the previous time point of the target time, the smoothing coefficient can be determined according to the total number of packets sent in the first time period, and then the weighting coefficient of the reference packet loss rate corresponding to the target time can be determined based on the smoothing coefficient. In this way, when the total number of packets sent in the first time period is small, the reference packet loss rate corresponding to the target time can be assigned a smaller weighting coefficient, and when the total number of packets sent in the first time period is large, the reference packet loss rate corresponding to the target time can be assigned a larger weighting coefficient. In this way, the problem of low confidence in the calculated packet loss rate due to the small number of data packets sent in the first time window in the related art can be effectively solved. When the confidence in the reference packet loss rate corresponding to the target time is low, the accuracy of the target packet loss rate can be improved by increasing the smoothing coefficient of the packet loss rate corresponding to the previous time point of the target time.
[0120] This embodiment can determine the first time window based on the target time when the acquired scenario application information indicates that the real-time level required by the network detection is higher than the first real-time level. And determine the first time windows of different lengths according to the reverse sensitivity range where the reverse sensitivity level of the network detection indicated by the scenario application information is located. Furthermore, when counting the actual total number of received packets in the first time window, reverse packets outside the first time period can be counted, thereby improving the statistical accuracy of the total number of received packets.
[0121] Further, the first maximum packet receiving sequence number in the first time period and the minimum packet receiving sequence number in the first time period are determined, and the second maximum packet receiving sequence number before the first time period is determined. And according to the minimum packet receiving sequence number in the first time period and the second maximum packet receiving sequence number, the starting packet sequence number in the first time period is determined.
[0122] Furthermore, the total number of packets sent in the first time period is determined according to the first maximum number of received packets and the starting number of packets in the first time period. The packet loss parameter corresponding to the target time is determined according to the total number of received packets in the first time window and the total number of sent packets in the first time period. In this way, the packet loss rate corresponding to the target time is calculated based on the accurate total number of received packets, which can effectively improve the accuracy of packet loss rate calculation.
[0123] See also Figure 8 , Figure 8 A flowchart of a method for calculating a network packet loss parameter provided by another embodiment of the present application is shown. In this embodiment, the method for calculating a network packet loss parameter can be executed by a device as a receiving end. The device as the receiving end can be a terminal device, a server, a gateway, a router, etc. as described above. Figure 8 As shown, the method for calculating the network packet loss parameter may specifically include the following steps:
[0124] Step S310: Obtain scene application information.
[0125] Step S320: If the scenario application information indicates that the stability level required by the network detection is higher than the first stability level, determine the first calculation cycle in which the target time is located.
[0126] In the application embodiment, it is taken into account that there are relevant application scenarios that have high requirements on the stability of the network status detection results. The scenario application information also indicates the stability required for network detection. To this end, a method of calculating the packet loss rate based on a periodic time window is proposed, and a scheme of determining a packet loss parameter once every calculation cycle is proposed, that is, the packet loss parameter is calculated according to the process shown in the following steps S320-S360. In this embodiment, multiple calculation cycles can be pre-set, wherein the time periods in which the multiple calculation cycles are located can be continuous, that is, the end time of one calculation cycle is used as the start time of the next calculation cycle. The first calculation cycle refers to the calculation cycle in which the target time is located.
[0127] Step S330: Based on the first calculation cycle, determine a second time window; the second time window includes a time period corresponding to the first calculation cycle.
[0128] The target time may be the time point at which the packet loss parameters of the network are requested to be determined. Fig. 9 , Fig. 9 A schematic diagram of a calculation cycle is shown. Fig. 9 As shown, the second time window is the first calculation period where the target time is located.
[0129] As an implementation mode, when a request for determining packet loss parameters is received, a calculation period (i.e., a first calculation period) in which a time point (i.e., a target time) corresponding to the request is received may be determined. Further, the first calculation period is determined as a second time window.
[0130] In some embodiments, the time period of the first calculation cycle can be used as the second time window. In other embodiments, other time periods can be combined based on the first calculation cycle, and the combined result can be used as the second time window. For example, the front buffer period can be combined before the first calculation cycle, and / or the rear buffer period can be combined after the first calculation cycle.
[0131] Step S340: Determine the third maximum packet receiving sequence number in the first calculation cycle and the fourth maximum packet receiving sequence number in the second calculation cycle; the second calculation cycle is the previous calculation cycle of the first calculation cycle.
[0132] The third maximum received packet sequence number refers to the maximum packet sequence number of the data packets received in the first calculation cycle; the fourth maximum received packet sequence number refers to the maximum packet sequence number of the data packets received in the second calculation cycle.
[0133] See also Fig.10 , Fig.10 A schematic diagram of determining the maximum packet receiving sequence number is shown. Fig.10 As shown, the second calculation cycle is the previous calculation cycle of the first calculation cycle in the positive time direction. The second time window corresponds to the first calculation cycle, and the previous time window of the second time window corresponds to the second calculation cycle.
[0134] In some embodiments, if no data packet is sent in the second calculation cycle, the fourth maximum received packet sequence number may be set to zero.
[0135] Step S350: Determine the total number of packets sent in the first calculation cycle according to the third maximum packet receiving sequence number and the fourth maximum packet receiving sequence number.
[0136] Typically, the data packet corresponding to the fourth maximum packet receiving sequence number is the last data packet received in the second calculation cycle. In this way, the next data packet of the data packet corresponding to the fourth maximum packet receiving sequence number (that is, the data packet whose packet sequence number is equal to the sum of the fourth maximum packet receiving sequence number and 1) corresponds to the first data packet sent in the first calculation cycle. Therefore, as an implementation method, the difference between the third maximum packet receiving sequence number and the intermediate maximum packet receiving sequence number can be used as the total number of packets sent in the first calculation cycle, wherein the intermediate maximum packet receiving sequence number is the sum of the fourth maximum packet receiving sequence number and 1, and the calculation formula is as follows:
[0137]
[0138] Among them, Num′ expect Indicates the total number of packets sent in the first calculation cycle, Seq′ max Indicates the third largest received packet sequence number, Seq′ last_max Indicates the fourth largest received packet sequence number. The packet sequence number is The data packet can be understood as the first data packet sent in the first computing cycle.
[0139] The total number of packets sent in the first calculation cycle is calculated according to Formula 6, instead of taking the data packet corresponding to the minimum packet sequence number among the data packets received in the first calculation cycle as the first data packet sent in the first calculation cycle. In this way, the problem of incorrect total number of packets sent in the first calculation cycle can be avoided, because the data packet corresponding to the minimum packet sequence number among the data packets received in the first calculation cycle is taken as the first data packet sent in the first calculation cycle when the data packet sent before the data packet corresponding to the minimum packet sequence number among the data packets received in the first calculation cycle is lost.
[0140] Step S360: Determine the packet loss parameter corresponding to the target time according to the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle.
[0141] The packet loss parameter may include the number of packet losses or a packet loss rate calculated based on the number of packet losses. The total number of received packets in the second time window refers to the number of data packets actually received by the terminal device when the network transmits data packets in the second time window.
[0142] As an implementation method, the total number of received packets can be initialized to 0, and all packet numbers between the third largest received packet number and the middle largest received packet number can be initialized to 0. When traversing one by one, determine whether there is a packet sequence number that matches the packet sequence number in the second time window The same data packet. Among them, the middle maximum packet receiving sequence number is the sum of the fourth maximum packet receiving sequence number and 1, recorded as, If it exists, the total number of received packets will be increased by 1. The calculation formula for the total number of received packets is as follows:
[0143]
[0144] Among them, Num′ real Indicates the total number of received packets in the second time window, and Window2 indicates the second time window.
[0145] Furthermore, the number of lost packets Num′ corresponding to the target time can be determined based on the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle. loss =Num′ expect -Num′ real Optionally, it can also be based on the number of lost packets Num′ loss And the total number of packets sent in the first calculation cycle Num′ expect Calculate the packet loss rate corresponding to the target time. The calculation formula is as follows:
[0146] Rate′ loss =Num′ loss / Num′ expect (8)
[0147] Among them, Rate′ loss Indicates the packet loss rate corresponding to the target time.
[0148] In this way, based on the first calculation cycle, the second time window can be determined, and the third maximum packet receiving sequence number within the first calculation cycle and the fourth maximum packet receiving sequence number within the second calculation cycle can be determined. Then, based on the third maximum packet receiving sequence number and the fourth maximum packet receiving sequence number, the total number of packets sent within the first calculation cycle can be determined.
[0149] Furthermore, the packet loss rate corresponding to the target time is determined according to the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle. Since the second time window is determined based on the first calculation cycle with a certain duration, the total number of received packets for a certain period of time can be stably counted in the second time window, and thus, based on the total number of received packets counted in the second time window, the stability of the calculated packet loss rate can be effectively improved, thereby reducing the jitter of the packet loss rate and avoiding misjudgment of the network status.
[0150] See also Fig.11 , Fig.11 FIG. 1 is a flow chart of a method for calculating a network packet loss parameter provided by another embodiment of the present application. In this embodiment, the method for calculating a network packet loss parameter can be executed by a device as a receiving end, and the device as a receiving end can be a terminal device, a server, a gateway, a router, etc. as described above. Fig.11 As shown, the method for calculating the network packet loss parameter may specifically include the following steps:
[0151] Step S410: Obtain scene application information.
[0152] Step S420: If the scenario application information indicates that the stability level required by the network detection is higher than the first stability level, determine the first calculation cycle in which the target time is located.
[0153] The scenario application information also indicates the stability required for network detection. Specifically, steps S410 and S420 may refer to the contents of steps S310 and S320 in the aforementioned embodiment, which will not be described in detail here.
[0154] Step S431: If the scenario application information indicates that the reverse order sensitivity level required by the network detection is within the first reverse order sensitivity range, the time period corresponding to the first calculation cycle is used as the second time window.
[0155] Step S432: If the scenario application information indicates that the reverse order sensitivity level required by the network detection is within the second reverse order sensitivity range, the first calculation cycle, the front buffer period and the back buffer period are combined, and the combined period is used as the second time window.
[0156] Taking into account that the network status detection process requires the ability to accurately know the existence of reverse-order packets, the present application proposes to determine a second time window of different lengths according to the reverse-order sensitivity level range to which the reverse-order sensitivity level required by the network detection belongs, so as to solve the problem of reverse-order packets that arise.
[0157] The reverse order sensitivity level in the first reverse order sensitivity range is lower than the reverse order sensitivity level in the second reverse order sensitivity range. The front buffer period refers to the period of time that extends the first calculation cycle in the reverse time direction. The rear buffer period refers to the period of time that extends the first calculation cycle in the positive time direction.
[0158] In some embodiments, the length of the pre-buffer period and the post-buffer period can be set according to the actual business scenario requirements, which is not limited here. Optionally, the length of the pre-buffer period and the post-buffer period can be set according to the sensitivity of the business scenario to the reverse order packets. For example, when the reverse order sensitivity level is in the second reverse order sensitivity range, the higher the reverse order sensitivity level, the longer the length can be. For example, the length of the pre-buffer period and the post-buffer period is half of the first length. For example, when the first length is 1s, the length of the pre-buffer period and the post-buffer period can be set to 500ms. Please refer to Fig.12 , Fig.12 A schematic diagram of a second time window including a buffer period is shown. Fig.12 As shown, the second time window is a combination period of the first calculation cycle, the front buffer period and the back buffer period.
[0159] Step S440: Determine the third maximum received packet sequence number in the first calculation cycle and the fourth maximum received packet sequence number in the second calculation cycle; the second calculation cycle is the previous calculation cycle of the first calculation cycle.
[0160] Step S450: Determine the total number of packets sent in the first calculation cycle according to the third maximum packet receiving sequence number and the fourth maximum packet receiving sequence number.
[0161] Specifically, steps S440 and S450 may refer to the contents of steps S340 and S350 in the aforementioned embodiment, which will not be described in detail here.
[0162] Step S460: Determine a packet loss parameter corresponding to the target time according to the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle.
[0163] The packet loss parameter may include the number of packet losses or a packet loss rate calculated based on the number of packet losses. The total number of received packets in the second time window refers to the number of data packets actually received by the terminal device when the network transmits data packets in the second time window.
[0164] In the embodiment of the present application, in addition to meeting the stability required by the network detection, the packet loss parameter is determined once every calculation cycle. It is also necessary to consider the reverse order sensitivity required by the network detection. To this end, in the process of counting the total number of received packets in the second time window, it is necessary to count the total number of received packets corresponding to the second time windows of different lengths according to whether the second time window has a front buffer period and a rear buffer period.
[0165] As an implementation mode, if the second time window includes only the first calculation cycle, the packet loss parameter corresponding to the target time is determined according to the total number of received packets in the second time window (i.e., the first calculation cycle) and the total number of sent packets in the first calculation cycle. Specifically, the content of step S360a in the aforementioned embodiment can be referred to, which will not be repeated here.
[0166] As another implementation, if the second time window includes the first calculation cycle, the front buffer period and the back buffer period, then according to the total number of received packets in the second time window (that is, the combined period), the total number of received packets can be initialized to 0, and all packet numbers between the third maximum received packet number and the middle maximum received packet number can be initialized to 0. When traversing one by one, determine whether there is a packet sequence number that matches the packet sequence number in the second time window The same data packet. If it exists, the total number of received packets will be increased by 1. The calculation formula for the total number of received packets is as follows:
[0167]
[0168] Among them, Num′ real Indicates the total number of received packets in the second time window, Window′ buffer Indicates a second time window including the first calculation cycle, the front buffer period and the rear buffer period. Further, the packet loss parameter corresponding to the target time can be determined according to the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle. Specifically, the content of step S360a in the aforementioned embodiment can be referred to, which will not be repeated here.
[0169] In some embodiments, the packet loss rate can be smoothed to solve the problem of low confidence in the calculated packet loss rate. Specifically, the number of packet losses in the second time window can be determined based on the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle, and the reference packet loss rate corresponding to the first calculation cycle can be determined based on the number of packet losses in the second time window and the total number of sent packets in the first calculation cycle. Further, the reference packet loss rate corresponding to the first calculation cycle and the packet loss rate corresponding to the second calculation cycle are smoothed to obtain the target packet loss rate corresponding to the target time.
[0170] In this embodiment, the packet loss rate calculated according to Formula 8 is used as the reference packet loss rate corresponding to the first calculation period, and then smoothing is performed. In some embodiments, the smoothing method can be to perform weighted processing on the reference packet loss rate corresponding to the first calculation period and the packet loss rate corresponding to the second calculation period. The specific processing process is similar to the process of "performing weighted processing on the reference packet loss rate corresponding to the target time and the packet loss rate corresponding to the previous time point of the target time" in the above text. For details, please refer to the above description, which will not be repeated here.
[0171] In some other embodiments, the total number of packets sent in the first calculation cycle Num′ may be expect , determine the smoothing coefficient μ, and according to the smoothing coefficient μ, calculate the reference packet loss rate Rate′ corresponding to the first calculation period currentLoss And the packet loss rate Rate′ corresponding to the second calculation cycle lastLoss Perform weighted processing to obtain the target packet loss rate Rate′ corresponding to the target time loss Among them, the corresponding relationship between the total number of packets sent and the smoothing coefficient can be preset, and the corresponding relationship is, for example:
[0172] If 50≤Num′ expect <100, the smoothing coefficient is μ1;
[0173] If 20≤Num′ expect <50, the smoothing coefficient is μ2;
[0174] If 10≤Num′ expect <20, then the smoothing coefficient is μ3;
[0175] If Num′ expect <10, the target packet loss rate is equal to the packet loss rate corresponding to the second calculation cycle.
[0176] The target packet loss rate corresponding to the target time is Rate′ loss The calculation formula is as follows:
[0177]
[0178] Among them, Rate′ currentLoss =Num′ expect -Num′ real / Num′ expect .
[0179] Optionally, the smoothing coefficient can be used as a weighting coefficient corresponding to the reference packet loss rate corresponding to the first calculation cycle. Correspondingly, the difference between 1 and the smoothing coefficient can be used as the weighting coefficient of the packet loss rate corresponding to the second calculation cycle. In this way, it is ensured that during the smoothing process, the sum of the weighting coefficient corresponding to the reference packet loss rate corresponding to the first calculation cycle and the weighting coefficient of the packet loss rate corresponding to the second calculation cycle is 1. In a specific embodiment, the smoothing coefficient can be set to be generally positively correlated with the total number of packets sent in the first calculation cycle, that is, the larger the total number of packets sent in the first calculation cycle, the larger the smoothing coefficient (that is, the larger the weighting coefficient corresponding to the reference packet loss rate corresponding to the first calculation cycle).
[0180] In other embodiments, the packet loss rate corresponding to the target time may be filtered to remove short-term jitter of the packet loss rate. Specifically, the jitter amplitude of the packet loss rate may be obtained in real time, and if the jitter amplitude is greater than a jitter threshold, the packet loss rate corresponding to the target time is filtered to obtain a filtered packet loss rate.
[0181] For example, the jitter amplitude of the obtained packet loss rate can be detected in real time through a unilateral accumulation and alarm. If the unilateral accumulation and alarm detects that the jitter amplitude is greater than the jitter threshold, a filtering operation is triggered, for example, using a median filter and a Kalman filter to filter the packet loss rate. In this way, when a salt and pepper noise value corresponding to a single-point peak of jitter appears, the noise will be eliminated after the filtering operation, and a packet loss rate without noise is obtained, thereby improving the quality of the packet loss rate.
[0182] See also Fig.13 , Fig.13 A flow chart for calculating the network packet loss rate is shown in FIG. Fig.13 As shown, after obtaining the scenario application information, the scenario application information can indicate that the real-time level required by the network detection is higher than the first real-time level, and the packet loss rate corresponding to the target time is calculated based on the total number of received packets in the first time window and the total number of sent packets in the first time period.
[0183] Optionally, the first time window of different durations is determined according to the reverse order sensitivity level range to which the reverse order sensitivity level required by the network detection belongs. For example, if the scenario application information indicates that the reverse order sensitivity level of the network detection is within the first reverse order sensitivity range, the first time period can be used as the first time window. If the scenario application information indicates that the reverse order sensitivity level of the network detection is within the second reverse order sensitivity range, the first time period, the front buffering time period and the rear buffering time period are combined, and the combined time period is used as the first time window.
[0184] After obtaining the scenario application information, the scenario application information may also indicate that the stability level required by the network detection is higher than the first stability level, and the packet loss rate corresponding to the target time is calculated based on the total number of received packets in the second time window and the total number of sent packets in the first calculation period.
[0185] Optionally, a second time window of different lengths is determined according to the reverse order sensitivity level range to which the reverse order sensitivity level required by the network detection belongs. For example, if the scenario application information indicates that the reverse order sensitivity level of the network detection is within the first reverse order sensitivity range, the first time period can be used as the second time window. If the scenario application information indicates that the reverse order sensitivity level of the network detection is within the second reverse order sensitivity range, the first time period, the front buffering time period and the rear buffering time period are combined, and the combined time period is used as the second time window.
[0186] After obtaining the packet loss rate corresponding to the target time, the packet loss rate can be smoothed and filtered in turn to obtain an accurate network packet loss rate, thereby improving the accuracy of network status estimation and facilitating the control of network transmission quality.
[0187] In some embodiments, actual effect tests may be performed on existing audio and video products. Specifically, the effects of calculating different packet loss rates may be tested for different devices and different network states.
[0188] See also Fig.14 , Fig.14 A comparison chart of packet loss rates calculated based on different time windows is shown. Fig.14 As shown, compared with the packet loss rate calculated based on the periodic time window (second time window), the packet loss rate calculated based on the sliding time window has a faster response speed than the packet loss rate calculated based on the periodic time window. The packet loss rate calculated based on the periodic time window is more stable than the packet loss rate calculated based on the sliding time window. For this reason, the packet loss rate calculated based on the sliding time window (first time window) can be used in the scenario of quickly identifying network changes, and the packet loss rate calculated based on the periodic time window can be used in the scenario of allocating redundant packet ratios.
[0189] See also Fig.15 , Fig.15 A comparison chart of packet loss rate calculated using smoothing is shown. In a scenario with 30% random packet loss, the packet loss rate calculated based on the periodic time window is smoothed to obtain the smoothed packet loss rate. Thus, the stability of the two calculation results with and without smoothing can be compared. Fig.15 As shown in FIG. 1 , the packet loss rate using smoothing is more stable than the packet loss rate not using smoothing. Therefore, in determining whether the packet loss is random, smoothing can be used when calculating the packet loss rate.
[0190] See also Fig.16 and Fig.17 , Fig.16 A packet loss rate comparison diagram showing an increase in buffer period calculation is shown. Fig.17 A packet loss rate comparison diagram without adding a buffer period is shown. Fig.16 and Fig.17 It can be seen that no matter the packet loss rate is calculated based on the sliding time window or the periodic time window, the packet loss rate calculated with the buffer period is more stable than that calculated without the buffer period. Therefore, in some Android models, you can consider adding a buffer period to the time window.
[0191] See also Fig.18 , which shows a structural block diagram of a network packet loss parameter calculation device 500 provided in an embodiment of the present application. The network packet loss parameter calculation device 500 includes: a time window determination module 510, which is used to determine a first time window based on a target time, wherein the first time window includes a first time period, wherein the first time period is a time period with the target time as the end time and a first time period; a packet receiving determination module 520, which is used to determine a first maximum packet receiving sequence number in the first time period and a minimum packet receiving sequence number in the first time period, and to determine a second maximum packet receiving sequence number before the first time period; a packet number determination module 530, which is used to determine a starting packet sequence number in the first time period according to the minimum packet receiving sequence number in the first time period and the second maximum packet receiving sequence number; a packet number determination module 540, which is used to determine a total number of packets sent in the first time period according to the first maximum packet receiving sequence number and the starting packet sequence number in the first time period; a parameter determination module 550, which is used to determine a packet loss parameter corresponding to the target time according to the total number of packets received in the first time window and the total number of packets sent in the first time period.
[0192] In some embodiments, the packet number determination module 530 can be specifically used to: if the second maximum packet receiving sequence number is greater than 0, use the minimum value between the minimum packet receiving sequence number and the reference packet receiving sequence number as the starting packet sequence number in the first time period; the reference packet receiving sequence number is the sum of the second maximum packet receiving sequence number and 1; if the second maximum packet receiving sequence number is not greater than 0, determine the minimum packet receiving sequence number in the first time period as the starting packet sequence number in the first time period.
[0193] In some embodiments, the network packet loss parameter calculation device 500 also includes: a scene acquisition module for acquiring scene application information; the time window determination module 510 can be specifically used for: if the scene application information indicates that the real-time level required by the network detection is higher than the first real-time level, executing the determination of the first time window based on the target time.
[0194] In some embodiments, the scenario application information also indicates the reverse order sensitivity required for network detection; the time window determination module 510 can also be specifically used for: if the scenario application information indicates that the reverse order sensitivity level of network detection is within a first reverse order sensitivity range, the first time period is used as the first time window.
[0195] In some embodiments, the time window determination module 510 can also be specifically used for: if the scenario application information indicates that the reverse order sensitivity level of network detection is within a second reverse order sensitivity range, the first time period, the front buffer period and the back buffer period are combined, and the combined time period is used as the first time window; the reverse order sensitivity level within the first reverse order sensitivity range is lower than the reverse order sensitivity level within the second reverse order sensitivity range.
[0196] In some embodiments, the scenario application information also indicates the stability required by the network detection, and the computing device 500 for obtaining the scenario application information and the network packet loss parameter also includes: a period determination module, which is used to determine the first calculation period in which the target time is located if the scenario application information indicates that the stability level required by the network detection is higher than the first stability level; a window determination module, which is used to determine the second time window based on the first calculation period; the second time window includes the time period corresponding to the first calculation period; a sequence number determination module, which is used to determine the third maximum packet receiving sequence number within the first calculation period and the fourth maximum packet receiving sequence number within the second calculation period; the second calculation period is the previous calculation period of the first calculation period; a packet sending determination module, which is used to determine the total number of packets sent within the first calculation period based on the third maximum packet receiving sequence number and the fourth maximum packet receiving sequence number; a parameter calculation module, which is used to determine the packet loss parameter corresponding to the target time based on the total number of packets received within the second time window and the total number of packets sent within the first calculation period.
[0197] In some embodiments, the scenario application information also indicates the reverse order sensitivity required by the network detection, and the window determination module can be specifically used to: if the scenario application information indicates that the reverse order sensitivity level required by the network detection is within a first reverse order sensitivity range, use the time period corresponding to the first calculation cycle as the second time window.
[0198] In some embodiments, the window determination module can also be specifically used for: if the scenario application information indicates that the reverse order sensitivity level required for network detection is within a second reverse order sensitivity range, the first calculation cycle, the front buffer period and the post buffer period are combined, and the combined period is used as the second time window; the reverse order sensitivity level within the first reverse order sensitivity range is lower than the reverse order sensitivity level within the second reverse order sensitivity range.
[0199] In some embodiments, the packet loss parameter includes a target packet loss rate, and the parameter calculation module may include: a packet loss number acquisition unit, used to determine the number of packet losses in the second time window based on the total number of received packets in the second time window and the total number of sent packets in the first calculation period; a packet loss rate calculation unit, used to determine the reference packet loss rate corresponding to the first calculation period according to the number of packet losses in the second time window and the total number of sent packets in the first calculation period; a smoothing processing unit, used to perform smoothing based on the reference packet loss rate corresponding to the first calculation period and the packet loss rate corresponding to the second calculation period to obtain the target packet loss rate corresponding to the target time.
[0200] In some embodiments, the smoothing processing unit can be specifically used to: determine a smoothing coefficient based on the total number of packets sent in the first calculation period; and perform weighted processing on the reference packet loss rate corresponding to the first calculation period and the packet loss rate corresponding to the second calculation period according to the smoothing coefficient to obtain a target packet loss rate corresponding to the target time.
[0201] In some embodiments, the packet loss parameters include a target packet loss rate, and the parameter determination module 550 can be specifically used to: determine the number of packet losses in the first time window based on the total number of received packets in the first time window and the total number of sent packets in the first time period; determine the reference packet loss rate corresponding to the target time based on the number of packet losses in the first time window and the total number of sent packets in the first time period; perform smoothing based on the reference packet loss rate corresponding to the target time and the packet loss rate corresponding to the previous time point of the target time to obtain the target packet loss rate corresponding to the target time.
[0202] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0203] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0204] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0205] The solution provided by the present application can determine the first time window at the target time of receiving the data packet, and the first time window includes a first time period with the target time as the end time and a duration of the first time period. And determine the first maximum packet receiving sequence number in the first time period and the minimum packet receiving sequence number in the first time period, and determine the second maximum packet receiving sequence number before the first time period. Further, according to the minimum packet receiving sequence number and the second maximum packet receiving sequence number in the first time period, determine the starting packet sequence number in the first time period, and according to the first maximum packet receiving sequence number and the starting packet sequence number in the first time period, determine the total number of packets sent in the first time period. Then, according to the total number of packets received in the first time window and the total number of packets sent in the first time period, determine the packet loss parameter corresponding to the target time. Thus, when each data packet is received, the total number of packets received corresponding to the first time window can be immediately obtained, and according to the total number of packets received and the total number of packets sent in the first time period, the packet loss parameter corresponding to the target time in the first time window is calculated. The calculation delay of the packet loss parameter is avoided, so that the packet loss parameter can be calculated in real time in response to the reception of the data packet, and the real-time calculation of the packet loss parameter is improved.
[0206] like Fig.19 As shown, the embodiment of the present application also provides a computer device 600, which includes a processor 610, a memory 620, a power supply 630 and an input unit 640. The memory 620 stores computer program instructions. When the computer program instructions are called by the processor 610, the various method steps provided in the above embodiments can be implemented. Those skilled in the art can understand that the structure of the computer device shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0207] The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire battery management system, and by running or executing instructions, programs, code sets or instruction sets stored in the memory 620, calls the data stored in the memory 620, executes various functions of the battery management system and processes data, and executes various functions and processes data of the computer device, thereby controlling the computer device as a whole. Optionally, the processor 610 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 610 can integrate one or a combination of a central processing unit 610 (CPU), a graphics processing unit 610 (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented separately through a communication chip.
[0208] The memory 620 may include a random access memory 620 (Random Access Memory, RAM), and may also include a read-only memory 620 (Read-Only Memory). The memory 620 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the various method embodiments described below, etc. The data storage area may also store data (such as a phone book and audio and video data) created by the computer device during use. Accordingly, the memory 620 may also include a memory controller to provide the processor 610 with access to the memory 620.
[0209] The power supply 630 can be logically connected to the processor 610 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 630 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0210] The input unit 640 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0211] Although not shown, the computer device 600 may also include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 610 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 620 according to the following instructions, and the processor 610 will run the application programs stored in the memory 620, thereby implementing the various method steps provided in the aforementioned embodiments.
[0212] like Fig. 20 As shown, an embodiment of the present application further provides a computer-readable storage medium 700, in which computer program instructions 710 are stored. The computer program instructions 710 can be called by a processor to execute the method described in the above embodiment.
[0213] The computer readable storage medium can be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium includes a non-volatile computer readable storage medium (Non-Transitory Computer-Readable Storage Medium). The computer readable storage medium 700 has a storage space for program codes that execute any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code can be compressed, for example, in an appropriate form.
[0214] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations provided in the above embodiments.
[0215] The above are only preferred embodiments of the present application, and are not intended to limit the present application in any form. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.
Claims
1. A method for calculating network packet loss parameters, characterized in that: The method comprises: Determine a first time window based on the target time, the first time window includes a first time period, the first time period is a time period that ends at the target time and has a first time period; Determine a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and determine a second maximum packet receiving sequence number before the first time period; Determine a starting packet sequence number within the first time period according to the minimum packet sequence number received within the first time period and the second maximum packet sequence number received; Determine the total number of packets sent in the first time period according to the first maximum received packet sequence number and the start packet sequence number in the first time period; A packet loss parameter corresponding to the target time is determined according to a total number of received packets in the first time window and a total number of sent packets in the first time period.
2. The method according to claim 1, characterized in that The determining, according to the minimum received packet sequence number in the first time period and the second maximum received packet sequence number, a starting packet sequence number in the first time period includes: If the second maximum packet receiving sequence number is greater than 0, the minimum value between the minimum packet receiving sequence number and the reference packet receiving sequence number is used as the starting packet sequence number in the first time period; the reference packet receiving sequence number is the sum of the second maximum packet receiving sequence number and 1; If the second maximum received packet sequence number is not greater than 0, the minimum received packet sequence number in the first time period is determined as the start packet sequence number in the first time period.
3. The method according to claim 1 or 2, characterized in that: Before determining the first time window based on the target time, the method further includes: Get scene application information; The determining the first time window based on the target time includes: If the scenario application information indicates that the real-time level required by the network detection is higher than the first real-time level, the step of determining the first time window based on the target time is performed.
4. The method according to claim 3, characterized in that The scenario application information also indicates the reverse order sensitivity required by the network detection; The determining the first time window based on the target time includes: If the scenario application information indicates that the reverse order sensitivity level of network detection is within a first reverse order sensitivity range, the first time period is used as the first time window.
5. The method according to claim 4, characterized in that The determining of the first time window based on the target time further includes: If the scenario application information indicates that the reverse order sensitivity level of network detection is within the second reverse order sensitivity range, the first time period, the front buffer period and the back buffer period are combined, and the combined time period is used as the first time window; the reverse order sensitivity level within the first reverse order sensitivity range is lower than the reverse order sensitivity level within the second reverse order sensitivity range.
6. The method according to claim 3, characterized in that The scenario application information further indicates stability required by the network detection. After acquiring the scenario application information, the method further includes: If the scenario application information indicates that the stability level required by the network detection is higher than the first stability level, determining a first calculation cycle in which the target time is located; Based on the first calculation cycle, determining a second time window; the second time window includes a time period corresponding to the first calculation cycle; Determine a third maximum packet receiving sequence number in the first calculation cycle and a fourth maximum packet receiving sequence number in a second calculation cycle; the second calculation cycle is a previous calculation cycle of the first calculation cycle; Determine the total number of packets sent in the first calculation cycle according to the third maximum packet receiving sequence number and the fourth maximum packet receiving sequence number; Determine a packet loss parameter corresponding to the target time according to the total number of received packets in the second time window and the total number of sent packets in the first calculation cycle.
7. The method according to claim 6, characterized in that The scenario application information further indicates the reverse order sensitivity required by the network detection, and the determining the second time window based on the first calculation cycle includes: If the scenario application information indicates that the reverse order sensitivity level required by the network detection is within the first reverse order sensitivity range, the time period corresponding to the first calculation cycle is used as the second time window.
8. The method according to claim 7, characterized in that The determining the second time window based on the first calculation cycle further includes: If the scenario application information indicates that the reverse order sensitivity level required for network detection is within the second reverse order sensitivity range, the first calculation cycle, the front buffer period and the post buffer period are combined, and the combined period is used as the second time window; the reverse order sensitivity level within the first reverse order sensitivity range is lower than the reverse order sensitivity level within the second reverse order sensitivity range.
9. The method according to any one of claims 6 to 8, characterized in that The packet loss parameter includes a target packet loss rate, and determining the packet loss parameter corresponding to the target time according to the total number of received packets in the second time window and the total number of sent packets in the first calculation period includes: Determine the number of lost packets in the second time window based on the total number of received packets in the second time window and the total number of sent packets in the first calculation period; Determine a reference packet loss rate corresponding to the first calculation period according to the number of packet losses in the second time window and the total number of packets sent in the first calculation period; A target packet loss rate corresponding to the target time is obtained by performing smoothing processing based on a reference packet loss rate corresponding to the first calculation period and a packet loss rate corresponding to the second calculation period.
10. The method according to claim 9, characterized in that The smoothing process is performed based on the reference packet loss rate corresponding to the first calculation period and the packet loss rate corresponding to the second calculation period to obtain the target packet loss rate corresponding to the target time, including: Determine a smoothing coefficient based on the total number of packets sent in the first calculation period; According to the smoothing coefficient, a reference packet loss rate corresponding to the first calculation period and a packet loss rate corresponding to the second calculation period are weighted to obtain a target packet loss rate corresponding to the target time.
11. The method according to claim 1 or 2, characterized in that: The packet loss parameter includes a target packet loss rate, and determining the packet loss parameter corresponding to the target time according to the total number of received packets in the first time window and the total number of sent packets in the first time period includes: Determine the number of lost packets in the first time window based on the total number of received packets in the first time window and the total number of sent packets in the first time period; Determine a reference packet loss rate corresponding to the target time according to the number of packet losses in the first time window and the total number of packets sent in the first time period; A smoothing process is performed based on a reference packet loss rate corresponding to the target time and a packet loss rate corresponding to a previous time point of the target time to obtain a target packet loss rate corresponding to the target time.
12. A device for calculating network packet loss parameters, characterized in that: The device comprises: A time window determination module, configured to determine a first time window based on a target time, wherein the first time window includes a first time period, and the first time period is a time period that ends at the target time and has a first time period; a packet receiving determination module, configured to determine a first maximum packet receiving sequence number within the first time period and a minimum packet receiving sequence number within the first time period, and to determine a second maximum packet receiving sequence number before the first time period; A packet number determination module, configured to determine a starting packet number within the first time period according to a minimum received packet number within the first time period and the second maximum received packet number; A packet number determination module, used to determine the total number of packets sent in the first time period according to the first maximum received packet sequence number and the start packet sequence number in the first time period; The parameter determination module is used to determine the packet loss parameter corresponding to the target time according to the total number of received packets in the first time window and the total number of sent packets in the first time period.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 11.
14. A computer device, characterized in that: include: Memory; One or more processors coupled to the memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1 to 11.
15. A computer program product or a computer program, characterized in that The computer program product or computer program includes computer instructions, which are stored in a storage medium; a processor of a computer device reads the computer instructions from the storage medium, and the processor executes the computer instructions, so that the computer executes the method according to any one of claims 1 to 11.