CN111131075A - High-concurrency data packet buffering method - Google Patents

High-concurrency data packet buffering method Download PDF

Info

Publication number
CN111131075A
CN111131075A CN201911150603.9A CN201911150603A CN111131075A CN 111131075 A CN111131075 A CN 111131075A CN 201911150603 A CN201911150603 A CN 201911150603A CN 111131075 A CN111131075 A CN 111131075A
Authority
CN
China
Prior art keywords
data packet
packet
data
packets
order
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911150603.9A
Other languages
Chinese (zh)
Inventor
程家明
孔繁东
饶佳
程钰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Xingtu Xinke Electronic Co ltd
Original Assignee
Wuhan Xingtu Xinke Electronic Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Xingtu Xinke Electronic Co ltd filed Critical Wuhan Xingtu Xinke Electronic Co ltd
Priority to CN201911150603.9A priority Critical patent/CN111131075A/en
Publication of CN111131075A publication Critical patent/CN111131075A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a high-concurrency data packet buffering method, which is applied to the transmission process of a multi-path media stream and comprises the following steps: a receiving end receives a data packet sent by a sending end and performs enqueue preparation operation on the received data packet; then, carrying out enqueuing operation on the data packet so as to cache the data packet to a set annular buffer area; and finally, performing a post-enqueue checking operation to check whether the current ring buffer has a complete frame needing to be thrown out or an expired frame needing to be discarded. The invention has the beneficial effects that: the technical scheme provided by the invention can effectively deal with the situation that the network packet loss and the network jitter exist simultaneously, reduce unnecessary retransmission, can independently process each path of media stream without mutual influence, improves the receiving efficiency of the transmission of high concurrent media stream data in a severe network environment, reduces the consumption of system resources and improves the quality of video transmission.

Description

High-concurrency data packet buffering method
Technical Field
The invention relates to the field of video communication, in particular to a high-concurrency data packet buffering method.
Background
In the data types of network transmission, video data is a type of data with a large data volume, and for a video forwarding server which takes audio and video data transceiving as a main function, the video forwarding server is very important for the data forwarding efficiency. Under the condition of receiving multiple paths of videos, how to timely and efficiently receive received data packets, reduce consumption of service resources and ensure stability of services is a content which needs to be considered in a key way.
In a traditional data receiving mechanism, a linear queue buffer is generally used, the purpose of the buffer is to wait for missing data packets, and after a complete audio/video frame is formed, all RTP packets forming the complete frame are taken out and forwarded outwards. In this process, repeated application and release of memory are involved, and after a missing packet arrives, frequent addressing interpolation exists, which affects efficiency. In addition, when there are missing packets, a retransmission request is often made, but not all missing packets are missing packets, and there are also instances of out-of-order, and frequent and too-fast retransmission requests also consume network bandwidth.
Disclosure of Invention
In order to solve the above problems, the present invention provides a high-concurrency data packet buffering method, which is applied to a transmission process of multiple media streams, wherein a receiving end is provided with an annular buffer area for each media stream;
for each path of media stream, the specific caching method of the receiving end comprises the following steps:
s101: a receiving end receives a data packet sent by a sending end, and performs an enqueue preparation operation on the received data packet to determine whether the data packet meets an enqueue requirement? If yes, go to step S102; otherwise, directly discarding the data packet, and going to step S104;
s102: performing enqueuing operation on the data packet to cache the data packet to a set annular buffer area;
s103: checking after-enqueue operation to check whether a complete frame needing to be thrown out or an expired frame needing to be discarded exists in the current ring buffer;
s104: and entering next transmission, and receiving the data packet sent next by the sending end by the receiving end.
Furthermore, the ring buffer is initialized to be a ring buffer space which has n storage units with the same size and is connected end to end, the size of the storage space of each storage unit is x bytes, each storage unit has a unit serial number, and a data packet stored in the storage unit with the unit serial number of 0 is a head-of-line packet; wherein n and x are preset values, the value range of n is [1024,2048], and x is larger than 0.
Further, the media stream comprises an audio stream and a video stream, and the data packets comprise audio data packets and video data packets corresponding to the audio stream and the video stream respectively; for each path of media stream, the sending end marks each data packet in turn from 0 as the serial number of each data packet, and the frame position information of each data packet is the position information of each data packet in the frame data to which the data packet belongs.
Further, in step S101, the sending end sends the data packet to the receiving end using a standard RTP data packet format; and sending the sequence number of the data packet and the frame position information of the data packet to a receiving end together.
Further, in step S101, performing an enqueue preparation operation on the received data packet to determine whether the data packet meets an enqueue requirement, specifically including:
s201: is the data packet determined to be a duplicate packet? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, go to step S202; if the data packet with the same sequence number exists at the position where the data packet is to be placed, the data packet is regarded as a repeated packet;
s202: determine if it is too late? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, the data packet is a data packet meeting the enqueuing requirement, and the step S203 is executed; if the sequence number of the data packet is smaller than the sequence number of the head of line packet of the ring buffer area, the data packet is considered to arrive too late;
s203: determine whether there are other packets with different sequence numbers in the ring buffer at the position to be inserted? If yes, indicating that the current ring buffer area is full, expanding the current ring buffer area or deleting the first frame data; otherwise, the data packet is a normal data packet, and normal caching is carried out; if the current annular buffer area is expanded, expanding the buffer intervals of S units between the head packet and the tail packet of the current annular buffer area; s is greater than 0 and is a preset value; the first frame data is all data packets of the frame where the head packet of the queue is located.
Further, in step S102, performing an enqueuing operation on the data packet specifically includes:
and indexing the unit sequence number of the data packet at the position to be inserted in the ring buffer according to the sequence number of the data packet, specifically: taking the number of the data packet as the remainder of the total number of the units in the buffer area, and taking the remainder result as the unit number of the data packet in the position to be inserted in the ring buffer area;
further, according to the unit serial number, storing the data packet into a corresponding position of the annular buffer area, and meanwhile, marking the position as a used state; and recording the data packet sequence number of the data packet, the packet receiving time of the annular buffer area and the frame position information of the data packet.
Further, in step S103, a post-enqueue checking operation is performed to check whether there is a complete frame to be cast out or an expired frame to be discarded in the current ring buffer; the method specifically comprises the following steps:
s301: checking a complete frame: from the first packet in the buffer queue of the ring buffer, check if there is a complete frame? If so, taking out all the data packets corresponding to the complete frames, marking the positions of all the taken out data packets as unused, updating the head packet of the buffer queue of the ring buffer area to the data packet corresponding to the next position of the last taken out data packet, and simultaneously correspondingly updating the corresponding unit serial number of the ring buffer area;
s302: checking out of order: determine whether the data packet currently enqueued is an out-of-order packet? If so, calculating out an out-of-order time delay, updating the average out-of-order time delay, and taking the updated average out-of-order time delay as a new average out-of-order time delay; the initial value of the average out-of-order time delay is 0 second;
s303: packet loss checking: is the packet loss time of all the missing packets currently checked to see if it exceeds the current average out-of-order delay? If so, respectively carrying out retransmission requests on all missing packets exceeding the current average out-of-order delay, and recording the retransmission request times; otherwise, continuing to wait;
s304: and (4) expiration checking: and searching all data packets with the existence time exceeding the preset time in the ring buffer area from the head packet of the queue, and deleting all the searched data packets and all the data packets of the frames where the data packets are located.
Further, in step S302, it is determined whether the currently enqueued data packet is an out-of-order packet, specifically:
if the data packet currently enqueued meets the first condition and the second condition, the data packet is considered to belong to the out-of-order packet, and the packet receiving time t of the packet is obtainedi(ii) a Wherein the first condition is as follows: the data packet which is currently enqueued is an out-of-order packet which arrives for the first time and a retransmission request is not carried out; the second condition is as follows: the arrival times of the data packets of the current enqueued data packet inserted into the ring buffer at the position are more than the retransmission request number of the data packets at the position; if the condition one is met, tiThe packet receiving time of the data packet; if the condition two is met, tiThe first time packet receiving time of the data packet of the sequence number corresponding to the data packet; if the sequence number of the data packet currently enqueued is smaller than the sequence number of the data packet last enqueued, the data packet is considered to be an out-of-order packet;
out-of-order delay deltaiThe calculation formula of (a) is as follows:
Δi=ti-ti-1
in the above formula, ti-1The packet receiving time of the data packet with the previous sequence number of the currently enqueued data packet is used.
Further, in step S302, the method for updating the average out-of-order delay is as follows:
first, the updated average out-of-order delay is calculated according to the following formula:
Figure BDA0002283428060000041
in the above formula, avg _ dlt is the updated average out-of-order delay, and k is the total number of all out-of-order packets received in the ring buffer within the latest T seconds; deltaiThe disorder time delay of the ith disorder packet in the latest T seconds; wherein T is a preset value and is greater than 0;
then, it is determined whether the condition avg _ dlt < max _ delay is satisfied? If so, the updated average out-of-order delay is avg _ dlt; otherwise, the updated out-of-order delay is max _ delay; wherein max _ delay is a preset value, and max _ delay > 0.
Further, the data packets are all RTP packets.
The technical scheme provided by the invention has the beneficial effects that: the technical scheme provided by the invention can effectively deal with the situation that the network packet loss and the network jitter exist simultaneously, reduce unnecessary retransmission, can independently process each path of media stream without mutual influence, improves the receiving efficiency of the transmission of high concurrent media stream data in a severe network environment, reduces the consumption of system resources and improves the quality of video transmission.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a detailed flow chart of a method for buffering highly concurrent packets according to an embodiment of the present invention;
FIG. 2 is a flow chart of a buffering mechanism at a receiving end according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the calculation of out-of-order delays in an embodiment of the present invention;
FIG. 4 is a schematic diagram of average out-of-order delay calculation in an embodiment of the present invention;
FIG. 5 is a diagram of a ring buffer in an embodiment of the invention.
Detailed Description
For a more clear understanding of the technical features, objects and effects of the present invention, embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
The embodiment of the invention provides a high-concurrency data packet buffering method, which is applied to the transmission process of a multi-path media stream and is characterized in that: aiming at each path of media stream, a receiving end is provided with an annular buffer area;
referring to fig. 1 and fig. 2, fig. 1 is a detailed flowchart of a high concurrency data packet buffering method according to an embodiment of the present invention, and fig. 2 is a flowchart of a buffering mechanism at a receiving end according to an embodiment of the present invention;
for each path of media stream, the specific caching method of the receiving end comprises the following steps:
s101: a receiving end receives a data packet sent by a sending end, and performs an enqueue preparation operation on the received data packet to determine whether the data packet meets an enqueue requirement? If yes, go to step S102; otherwise, directly discarding the data packet, and going to step S104;
s102: performing enqueuing operation on the data packet to cache the data packet to a set annular buffer area;
s103: checking after-enqueue operation to check whether a complete frame needing to be thrown out or an expired frame needing to be discarded exists in the current ring buffer;
s104: and entering next transmission, and receiving the data packet sent next by the sending end by the receiving end.
The annular buffer area is initialized to be an annular buffer space which is provided with n storage units with the same size and is connected end to end, the size of the storage space of each storage unit is x bytes, each storage unit is provided with a unit serial number, and a data packet stored in the storage unit with the unit serial number of 0 is a head-of-line packet; wherein n and x are preset values, the value range of n is [1024,2048], and x is larger than 0.
The media stream comprises an audio stream and a video stream, and the data packets comprise audio data packets and video data packets corresponding to the audio stream and the video stream respectively; for each path of media stream, the sending end marks each data packet in turn from 0 as the serial number of each data packet, and the frame position information of each data packet is the position information of each data packet in the frame data to which the data packet belongs.
In step S101, the sending end sends a data packet to the receiving end using a standard RTP data packet format (when sending, the data packet is labeled); and sending the sequence number of the data packet and the frame position information of the data packet to a receiving end together.
In step S101, performing an enqueue preparation operation on a received data packet to determine whether the data packet meets an enqueue requirement, specifically including:
s201: is the data packet determined to be a duplicate packet? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, go to step S202; if the data packet with the same sequence number exists at the position where the data packet is to be placed, the data packet is regarded as a repeated packet;
s202: determine if it is too late? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, the data packet is a data packet meeting the enqueuing requirement, and the step S203 is executed; if the sequence number of the data packet is smaller than that of a head-of-line packet (generally, a packet which has the longest time in a buffer queue before the sequence number is the most front) of the ring buffer, the data packet is considered to arrive too late;
s203: determine whether there are other packets with different sequence numbers in the ring buffer at the position to be inserted? If yes, indicating that the current ring buffer area is full, expanding the current ring buffer area or deleting the first frame data; otherwise, the data packet is a normal data packet, and normal caching is carried out; if the current annular buffer area is expanded, expanding the buffer intervals of S units between the head packet and the tail packet of the current annular buffer area; s is greater than 0 and is a preset value; the first frame data is all data packets of the frame where the head packet of the queue is located.
In step S102, performing enqueuing operation on the data packet specifically includes:
and indexing the unit sequence number of the data packet at the position to be inserted in the ring buffer according to the sequence number of the data packet, specifically: taking the number of the data packet as the remainder of the total number of the units in the buffer area, and taking the remainder result as the unit number of the data packet in the position to be inserted in the ring buffer area;
further, according to the unit serial number, storing the data packet into a corresponding position of the annular buffer area, and meanwhile, marking the position as a used state; and recording the data packet sequence number of the data packet, the packet receiving time of the annular buffer area and the frame position information of the data packet.
In step S103, a post-enqueue checking operation is performed to check whether there is a complete frame to be thrown out or an expired frame to be discarded in the current ring buffer; the method specifically comprises the following steps:
s301: checking a complete frame: from the first packet in the buffer queue of the ring buffer, check if there is a complete frame? If so, taking out all the data packets corresponding to the complete frames, marking the positions of all the taken out data packets as unused, updating the head packet of the buffer queue of the ring buffer area to the data packet corresponding to the next position of the last taken out data packet, and simultaneously correspondingly updating the corresponding unit serial number of the ring buffer area;
s302: checking out of order: determine whether the data packet currently enqueued is an out-of-order packet? If so, calculating out an out-of-order time delay, updating the average out-of-order time delay, and taking the updated average out-of-order time delay as a new average out-of-order time delay; the initial value of the average out-of-order time delay is 0 second;
s303: packet loss checking: is the packet loss time of all the missing packets currently checked to see if it exceeds the current average out-of-order delay? If so, respectively carrying out retransmission requests on all missing packets exceeding the current average out-of-order delay, and recording the retransmission request times; otherwise, continuing to wait; wherein, the definition of the missing packet is as follows: if the sequence numbers of two adjacent arriving data packets are not consecutive, the data packet corresponding to the missing sequence number between the two sequence numbers is considered as a missing packet, for example: 1. 2, 3, 5 and 6 are data packets enqueued in sequence, and since two adjacent data packets 3 and 5 are not continuous, the data packet corresponding to the missing sequence number 4 between the two sequence numbers 3 and 5 is considered as a missing packet;
s304: and (4) expiration checking: searching all data packets with the existence time exceeding the preset time in the annular buffer area from the head packet of the queue, and deleting all the searched data packets and all the data packets of the frames where the data packets are located; in the embodiment of the present invention, the predetermined time is 3 seconds.
In step S302, it is determined whether the currently enqueued data packet is an out-of-order packet, specifically:
if the data packet currently enqueued meets the first condition and the second condition, the data packet is considered to belong to the out-of-order packet, and the packet receiving time t of the packet is obtainedi(i is the sequence number of this packet, i is less than or equal to the largest unit sequence number of the ring buffer); wherein, the condition one is that the data packet currently enqueued is the first-time arrived out-of-order packet and no retransmission request is carried out, if the condition one is met, t isiThe packet receiving time of the data packet; the second condition is that the arrival times of the data packets of the current enqueued data packet inserted into the annular buffer zone are larger than the retransmission request number of the data packets at the position, if the second condition is met, t isiThe first time packet receiving time of the data packet with the sequence number i corresponding to the data packet; if the sequence number of the data packet currently enqueued is smaller than the sequence number of the data packet last enqueued, the data packet is considered to be an out-of-order packet; for example: data packets 1, 2, 3, 5, 4 arrive in sequence, and since the sequence number of data packet 4 is smaller than the sequence number of data packet 5 which arrives first, data packet 4 is an out-of-sequence packet;
out-of-order delay deltaiThe calculation formula of (a) is as follows:
Δi=ti-ti-1
in the above formula, ti-1The packet receiving time of the data packet with the previous sequence number of the currently enqueued data packet is used.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a calculation of out-of-order delay according to an embodiment of the present invention; as shown in fig. 3, if the data packet with sequence number 4 has undergone 2 retransmission requests, but the transmitting end sequentially transmits three data packets with sequence number 4, whose packet receiving times are t4, t4_1 and t4_2, respectively, the out-of-order delay Δ of the data packet with sequence number 44=t4-t3(ii) a If the packet with sequence number 6 has not been requested to be retransmitted and is a missing packet, then the packet with sequence number 6 is transmittedOut-of-order delay delta of data packet6=t6-t5
In step S302, the method for updating the average out-of-order delay is as follows:
first, the updated average out-of-order delay is calculated according to the following formula:
Figure BDA0002283428060000081
in the above formula, avg _ dlt is the updated average out-of-order delay, and k is the total number of all out-of-order packets received in the ring buffer within the latest T seconds; deltaiThe disorder time delay of the ith disorder packet in the latest T seconds; wherein T is a preset value and is greater than 0;
then, it is determined whether the condition avg _ dlt < max _ delay is satisfied? If so, the updated average out-of-order delay is avg _ dlt; otherwise, the updated out-of-order delay is max _ delay; wherein max _ delay is a preset value, and max _ delay > 0.
All the data packets are RTP packets.
Referring to fig. 4, fig. 4 is a schematic diagram of average out-of-order delay calculation according to an embodiment of the present invention; in the embodiment of the invention, the value of T is 3, and when the average out-of-order time delay is calculated, the time delay condition when each out-of-order packet occurs, namely the delta is counted firstlyiThen the delay conditions for the last 3 seconds are averaged, ΔiCorresponding tiThe average disorder time delay condition of the current media data stream is estimated when the distance from the current time is not more than 3 seconds, if avg _ dlt is larger than the maximum set disorder time delay (namely jitter maximum threshold) max _ delay which is 1s, the maximum jitter threshold is used as the value of avg _ dlt, otherwise, avg _ dlt keeps the original value and uses the value as the time for delaying retransmission, if the average disorder time delay is larger than 0, the situation of packet disorder exists, a period of time (the time is the average disorder time delay) needs to be waited at the moment, then retransmission requests are carried out, unnecessary early retransmission requests are avoided, network load is reduced, and transmission quality is improved. The method can realize dynamic calculation of disorder time delay, namely, the retransmission request can be automatically and quickly carried out without disorder, and the node can be dynamically calculated according to disorder time delayIf appropriate, the retransmission request is delayed.
Referring to FIG. 5, FIG. 5 is a diagram illustrating a ring buffer according to an embodiment of the present invention; the size of the ring buffer shown in FIG. 5 is 1024 memory cells; the ring buffer has the following characteristics compared with the traditional line buffer:
1) and taking the rest of the size of the buffer area by using the sequence number of the RTP packet as the position index of the RTP packet in the buffer area. The advantages are that: when the network environment is not good, unnecessary insertion and deletion operations are reduced, and RTP packets are sequenced;
2) checking whether a timeout occurs with the time each packet exists in the queue; the advantages are that: older frame data can be accurately deleted, and the excessive expansion of a ring buffer is avoided;
3) if no available insertion space exists, the method is carried out by adopting a mode of expanding a buffer area or deleting a first frame (a frame where a queue head packet is located); the advantages are that: the buffer area is ensured to be friendly to the current coming RTP packet, and the continuous accessibility of the subsequent packets is improved;
4) using a state mark mode to determine whether packet information is stored in a buffer area; the advantages are that: and a large amount of repeated copying of the memory is avoided, and the memory is copied when needed at last, so that the overall packet receiving efficiency is improved.
For ease of understanding, the following explanation is provided for the case where a packet with another sequence number exists in the to-be-inserted position of the current packet:
generally speaking, if the sequence number of the current data packet does not exceed the maximum unit sequence number of the current ring buffer, the result of taking the remainder of the sequence number of the current data packet from the maximum unit sequence number of the current ring buffer is also the sequence number of the current data packet, so that the current data packet can be normally stored without deleting the first frame or expanding the buffer;
however, if the sequence number of the current packet exceeds the maximum unit sequence number of the current ring buffer, the result of the remainder of the sequence number of the current packet to the maximum unit sequence number of the current ring buffer is not the sequence number of the current packet itself, but another number, for example, the maximum unit sequence number (the size of the ring buffer) of the current ring buffer is 1024, and the sequence number of the current packet is 1025, the remainder of 1025 to 1024 is 1, then the location where the packet with the current sequence number 1025 is to be stored is the storage unit with the unit sequence number 1, obviously, the storage unit with the unit sequence number 1 stores the first packet in queue, so that the packet with the sequence number 1 in the position to be inserted of the packet with the sequence number 1025 is caused, that is, the packet with other sequence numbers in the position to be inserted of the current packet is caused, which indicates that the current ring buffer is full, at this time, this problem can be solved by deleting the first frame or expanding the ring buffer.
The invention has the beneficial effects that: the technical scheme provided by the invention uses a ring buffer zone based on the RTP packet sequence number as an index as a receiving buffer zone, the buffer zone can be dynamically expanded according to requirements, each path of media stream corresponds to one buffer zone, RTP packets in the buffer zone can form RTP packets of media frames, the RTP packets can be quickly taken out and marked as unused, for missing RTP packets, the waiting for limited time can be carried out according to a certain algorithm, retransmission requests are carried out after the waiting is overtime, and if the packet is missing at last, the corresponding position of the missing RTP packets in the ring buffer zone is emptied.
The mechanism can conveniently manage the memory of the buffer area, avoid the application release operation of the bottom-layer memory, efficiently ensure the positive sequence of the data packet, and firstly ensure the achievement of the disordered packet under the condition that disordered and packet loss exist simultaneously, thereby effectively inhibiting unnecessary retransmission requests. Under the highly concurrent media transmission scene, a part of media stream transmission has network jitter, and another part of media stream transmission has network packet loss, all media streams can be simultaneously received by depending on the network buffering mechanism without reducing the receiving rate of the media streams, and the quality of the media transmission is ensured.
The technical scheme provided by the invention can effectively deal with the situation that the network packet loss and the network jitter exist simultaneously, reduce unnecessary retransmission, can independently process each path of media stream without mutual influence, improves the receiving efficiency of the transmission of high concurrent media stream data in a severe network environment, reduces the consumption of system resources and improves the quality of video transmission.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A high concurrency data packet buffering method is applied to the transmission process of multi-path media streams, and is characterized in that: aiming at each path of media stream, a receiving end is provided with an annular buffer area;
for each path of media stream, the specific caching method of the receiving end comprises the following steps:
s101: a receiving end receives a data packet sent by a sending end, and performs an enqueue preparation operation on the received data packet to determine whether the data packet meets an enqueue requirement? If yes, go to step S102; otherwise, directly discarding the data packet, and going to step S104;
s102: performing enqueuing operation on the data packet to cache the data packet to a set annular buffer area;
s103: checking after-enqueue operation to check whether a complete frame needing to be thrown out or an expired frame needing to be discarded exists in the current ring buffer;
s104: and entering next transmission, and receiving the data packet sent next by the sending end by the receiving end.
2. The method of claim 1, wherein the buffer further comprises: the annular buffer area is initialized to be an annular buffer space which is provided with n storage units with the same size and is connected end to end, the size of the storage space of each storage unit is x bytes, each storage unit is provided with a unit serial number, and a data packet stored in the storage unit with the unit serial number of 0 is a head-of-line packet; wherein n and x are preset values, the value range of n is [1024,2048], and x is larger than 0.
3. The method of claim 2, wherein the buffer further comprises: the media stream comprises an audio stream and a video stream, and the data packets comprise audio data packets and video data packets corresponding to the audio stream and the video stream respectively; for each path of media stream, the sending end marks each data packet in turn from 0 as the serial number of each data packet, and the frame position information of each data packet is the position information of each data packet in the frame data to which the data packet belongs.
4. The method of claim 3, wherein the buffer further comprises: in step S101, a sending end sends a data packet to a receiving end by using a standard RTP data packet format; and sending the sequence number of the data packet and the frame position information of the data packet to a receiving end together.
5. The method of claim 4, wherein the buffer further comprises: in step S101, performing an enqueue preparation operation on a received data packet to determine whether the data packet meets an enqueue requirement, specifically including:
s201: is the data packet determined to be a duplicate packet? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, go to step S202; if the data packet with the same sequence number exists at the position where the data packet is to be placed, the data packet is regarded as a repeated packet;
s202: determine if it is too late? If so, directly discarding the data packet which does not meet the enqueuing requirement; otherwise, the data packet is a data packet meeting the enqueuing requirement, and the step S203 is executed; if the sequence number of the data packet is smaller than the sequence number of the head of line packet of the ring buffer area, the data packet is considered to arrive too late;
s203: determine whether there are other packets with different sequence numbers in the ring buffer at the position to be inserted? If yes, indicating that the current ring buffer area is full, expanding the current ring buffer area or deleting the first frame data; otherwise, the data packet is a normal data packet, and normal caching is carried out; if the current annular buffer area is expanded, expanding the buffer intervals of S units between the head packet and the tail packet of the current annular buffer area; s is greater than 0 and is a preset value; the first frame data is all data packets of the frame where the head packet of the queue is located.
6. The method of claim 5, wherein the buffer further comprises: in step S102, performing enqueuing operation on the data packet specifically includes:
and indexing the unit sequence number of the data packet at the position to be inserted in the ring buffer according to the sequence number of the data packet, specifically: taking the number of the data packet as the remainder of the total number of the units in the buffer area, and taking the remainder result as the unit number of the data packet in the position to be inserted in the ring buffer area;
further, according to the unit serial number, storing the data packet into a corresponding position of the annular buffer area, and meanwhile, marking the position as a used state; and recording the data packet sequence number of the data packet, the packet receiving time of the annular buffer area and the frame position information of the data packet.
7. The method of claim 6, wherein the buffer further comprises: in step S103, a post-enqueue checking operation is performed to check whether there is a complete frame to be thrown out or an expired frame to be discarded in the current ring buffer; the method specifically comprises the following steps:
s301: checking a complete frame: from the first packet in the buffer queue of the ring buffer, check if there is a complete frame? If so, taking out all the data packets corresponding to the complete frames, marking the positions of all the taken out data packets as unused, updating the head packet of the buffer queue of the ring buffer area to the data packet corresponding to the next position of the last taken out data packet, and simultaneously correspondingly updating the corresponding unit serial number of the ring buffer area;
s302: checking out of order: determine whether the data packet currently enqueued is an out-of-order packet? If so, calculating out an out-of-order time delay, updating the average out-of-order time delay, and taking the updated average out-of-order time delay as a new average out-of-order time delay; the initial value of the average out-of-order time delay is 0 second;
s303: packet loss checking: is the packet loss time of all the missing packets currently checked to see if it exceeds the current average out-of-order delay? If so, respectively carrying out retransmission requests on all missing packets exceeding the current average out-of-order delay, and recording the retransmission request times; otherwise, continuing to wait;
s304: and (4) expiration checking: and searching all data packets with the existence time exceeding the preset time in the ring buffer area from the head packet of the queue, and deleting all the searched data packets and all the data packets of the frames where the data packets are located.
8. The method of claim 7, wherein the buffer further comprises: in step S302, it is determined whether the currently enqueued data packet is an out-of-order packet, specifically:
if the data packet currently enqueued meets the first condition and the second condition, the data packet is considered to belong to the out-of-order packet, and the packet receiving time t of the packet is obtainedi(ii) a Wherein the first condition is as follows: the data packet which is currently enqueued is an out-of-order packet which arrives for the first time and a retransmission request is not carried out; the second condition is as follows: the arrival times of the data packets of the current enqueued data packet inserted into the ring buffer at the position are more than the retransmission request number of the data packets at the position; if the condition one is met, tiThe packet receiving time of the data packet; if the condition two is met, tiThe first time packet receiving time of the data packet of the sequence number corresponding to the data packet; if the sequence number of the data packet currently enqueued is smaller than the sequence number of the data packet last enqueued, the data packet is considered to be an out-of-order packet;
out-of-order delay deltaiThe calculation formula of (a) is as follows:
Δi=ti-ti-1
in the above formula, ti-1The packet receiving time of the data packet with the previous sequence number of the currently enqueued data packet is used.
9. The method of claim 8, wherein the buffer further comprises: in step S302, the method for updating the average out-of-order delay is as follows:
first, the updated average out-of-order delay is calculated according to the following formula:
Figure FDA0002283428050000031
in the above formula, avg _ dlt is the updated average out-of-order delay, and k is the total number of all out-of-order packets received in the ring buffer within the latest T seconds; deltaiThe disorder time delay of the ith disorder packet in the latest T seconds; wherein T is a preset value and is greater than 0;
then, it is determined whether the condition avg _ dlt < max _ delay is satisfied? If so, the updated average out-of-order delay is avg _ dlt; otherwise, the updated out-of-order delay is max _ delay; wherein max _ delay is a preset value, and max _ delay > 0.
10. The method for buffering highly concurrent packets according to any one of claims 1 to 9, wherein: the data packets are all RTP packets.
CN201911150603.9A 2019-11-21 2019-11-21 High-concurrency data packet buffering method Pending CN111131075A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911150603.9A CN111131075A (en) 2019-11-21 2019-11-21 High-concurrency data packet buffering method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911150603.9A CN111131075A (en) 2019-11-21 2019-11-21 High-concurrency data packet buffering method

Publications (1)

Publication Number Publication Date
CN111131075A true CN111131075A (en) 2020-05-08

Family

ID=70496212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911150603.9A Pending CN111131075A (en) 2019-11-21 2019-11-21 High-concurrency data packet buffering method

Country Status (1)

Country Link
CN (1) CN111131075A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113163346A (en) * 2021-04-21 2021-07-23 成都锐成芯微科技股份有限公司 Broadcast packet filtering method and wireless communication system
CN113726811A (en) * 2021-09-08 2021-11-30 苏州洛翌鑫珂智能科技有限公司 Packet loss compensation method for elevator video monitoring data transmission
CN113890870A (en) * 2021-09-30 2022-01-04 兰州乐智教育科技有限责任公司 RTP data packet sequencing method and device, electronic equipment and storage medium
WO2022073603A1 (en) * 2020-10-07 2022-04-14 Huawei Technologies Co., Ltd. Exhaustive measurement of delays of out of order network packets
CN114866196A (en) * 2021-01-19 2022-08-05 武汉斗鱼鱼乐网络科技有限公司 Data packet retransmission method and device, electronic equipment and storage medium
CN115203002A (en) * 2022-09-16 2022-10-18 深圳华云信息系统有限公司 Log processing method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549535A (en) * 2003-05-09 2004-11-24 华为技术有限公司 Method for ordering to eliminate its jitter time delay by rank of RTP data packet
CN103124412A (en) * 2012-11-16 2013-05-29 佳都新太科技股份有限公司 Network shaking processing technology based on RTP (real time transport protocol)
US20170142433A1 (en) * 2015-11-18 2017-05-18 Cybrook Inc. Video data processing using a ring buffer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549535A (en) * 2003-05-09 2004-11-24 华为技术有限公司 Method for ordering to eliminate its jitter time delay by rank of RTP data packet
CN103124412A (en) * 2012-11-16 2013-05-29 佳都新太科技股份有限公司 Network shaking processing technology based on RTP (real time transport protocol)
US20170142433A1 (en) * 2015-11-18 2017-05-18 Cybrook Inc. Video data processing using a ring buffer

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022073603A1 (en) * 2020-10-07 2022-04-14 Huawei Technologies Co., Ltd. Exhaustive measurement of delays of out of order network packets
CN114866196A (en) * 2021-01-19 2022-08-05 武汉斗鱼鱼乐网络科技有限公司 Data packet retransmission method and device, electronic equipment and storage medium
CN114866196B (en) * 2021-01-19 2024-05-24 北京神州数码云科信息技术有限公司 Data packet retransmission method, device, electronic equipment and storage medium
CN113163346A (en) * 2021-04-21 2021-07-23 成都锐成芯微科技股份有限公司 Broadcast packet filtering method and wireless communication system
CN113726811A (en) * 2021-09-08 2021-11-30 苏州洛翌鑫珂智能科技有限公司 Packet loss compensation method for elevator video monitoring data transmission
CN113890870A (en) * 2021-09-30 2022-01-04 兰州乐智教育科技有限责任公司 RTP data packet sequencing method and device, electronic equipment and storage medium
CN113890870B (en) * 2021-09-30 2023-09-19 兰州乐智教育科技有限责任公司 RTP data packet ordering method and device, electronic equipment and storage medium
CN115203002A (en) * 2022-09-16 2022-10-18 深圳华云信息系统有限公司 Log processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111131075A (en) High-concurrency data packet buffering method
US7876677B2 (en) Transmission control protocol queue sorting
US20200236052A1 (en) Improving end-to-end congestion reaction using adaptive routing and congestion-hint based throttling for ip-routed datacenter networks
WO2019033857A1 (en) Packet control method and network device
WO2020001192A1 (en) Data transmission method, computing device, network device and data transmission system
EP2060067B1 (en) Ethernet switching
EP1185043B1 (en) Streaming data transfer system and repeater therefor
US8717871B2 (en) Packet retransmission control system, method and program
KR100506253B1 (en) Device and Method for minimizing transmission delay in data communication system
WO2021114793A1 (en) Data forwarding method, data buffering method, device, and related apparatus
US9854062B2 (en) Data relay apparatus and method, server apparatus, and data sending method
CN111711566B (en) Receiving end disorder rearrangement method under multipath routing scene
WO2018121535A1 (en) Load balance processing method and apparatus
US20190280982A1 (en) Information processing apparatus and information processing system
US20060176893A1 (en) Method of dynamic queue management for stable packet forwarding and network processor element therefor
CN112953967A (en) Network protocol unloading device and data transmission system
CN111224888A (en) Method for sending message and message forwarding equipment
GB2423219A (en) A proxy device interposed between a server and a wireless client controls a characteristic of the server depending on the quality of the link to the client
US20100188977A1 (en) Internet protocol header compression reordering
US8054847B2 (en) Buffer management in a network device
KR100489685B1 (en) Apparatus for transmitting packet between packet controller and network processor and method thereof
EP3108631B1 (en) Buffer bloat control
JP4930275B2 (en) Communication system, communication method, transmitter, receiver, rate calculation method, and program
CN111131089B (en) Queue management method for improving multicast service HOL blocking
WO2021120764A1 (en) Method and apparatus for sending and receiving data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination