CN113890870A - RTP data packet sequencing method and device, electronic equipment and storage medium - Google Patents
RTP data packet sequencing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113890870A CN113890870A CN202111162213.0A CN202111162213A CN113890870A CN 113890870 A CN113890870 A CN 113890870A CN 202111162213 A CN202111162213 A CN 202111162213A CN 113890870 A CN113890870 A CN 113890870A
- Authority
- CN
- China
- Prior art keywords
- data packet
- rtp data
- sequence number
- rtp
- structure body
- 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.)
- Granted
Links
- 238000012163 sequencing technique Methods 0.000 title claims abstract description 37
- 238000000034 method Methods 0.000 claims abstract description 33
- 230000001174 ascending effect Effects 0.000 claims abstract description 17
- 238000004590 computer program Methods 0.000 claims description 10
- 230000002265 prevention Effects 0.000 claims description 9
- 238000004064 recycling Methods 0.000 claims description 8
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 230000005540 biological transmission Effects 0.000 abstract description 15
- 238000005516 engineering process Methods 0.000 abstract description 5
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000007726 management method Methods 0.000 description 5
- 238000013473 artificial intelligence Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003139 buffering effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention relates to a video transmission technology, and discloses a RTP data packet sequencing method, which comprises the following steps: the method comprises the steps of utilizing a plurality of structural bodies which are arranged from the head to the tail of a queue according to the ascending sequence of the sequence numbers of the RTP data packets and are connected end to obtain the RTP data packets in the structural body corresponding to the smallest sequence number of the RTP data packets and send the RTP data packets to a preset player, utilizing the corresponding structural bodies as available structural bodies to store received new RTP data packets, keeping the queue sequence of the structural bodies which are arranged from the head to the tail of the queue according to the ascending sequence numbers of the RTP data packets and are connected end to end all the time, continuously obtaining the RTP data packets with the smallest sequence numbers from the structural bodies and sending the RTP data packets to the preset player, utilizing the corresponding structural bodies as available structural bodies to store the received new RTP data packets. The invention also provides a device, equipment and medium for sequencing the RTP data packets. The invention can solve the problem of disorder of RTP data packets in network transmission and improve the problem solving efficiency.
Description
Technical Field
The present invention relates to the field of video transmission technologies, and in particular, to a method and an apparatus for ordering RTP packets, an electronic device, and a computer-readable storage medium.
Background
Nowadays, video transmission technology is widely applied to daily work and life of people, such as movie and television video transmission, conference video transmission, short video live broadcast and the like. In order to meet the transmission requirement of video data, the original video data is usually decomposed into a plurality of video frames at the transmitting end, each video frame is further divided into a plurality of RTP data packets, and the RTP data packets are transmitted to the receiving end or the video playing end by using a UDP (User data Protocol) Protocol.
During network transmission of RTP packets, when a network shakes, it may happen that a later generated RTP packet arrives at a receiving end or a video playing end earlier than an earlier generated RTP packet, and the earlier generated RTP packet arrives at the receiving end or the video playing end later, that is, a situation that RTP packets arrive after the earlier generated RTP packets arrive and then the later generated RTP packets arrive in a disorder is generated, which causes a problem of video data confusion at the receiving end or the playing end.
The method for achieving the video frame ordering based on the RTP data packets has the advantages that the problem that the RTP data packets are out of order in transmission is solved, generally, a plurality of RTP data packets are classified into the same video frame, then the RTP data packets in the same video frame are ordered according to information such as timestamps, serial numbers and frame types of the RTP data packets, the RTP data packet ordering and the video frame assembling are combined together, a large amount of calculation work exists, the system overhead is large, meanwhile, the code development workload is large, and therefore the prior art needs to be improved.
Disclosure of Invention
The invention provides a method and a device for sequencing RTP (real-time transport protocol) data packets and a computer readable storage medium, and mainly aims to improve the accuracy of text labeling.
In order to achieve the above object, a method for ordering RTP packets provided by the present invention includes:
step A: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
and B: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
and C: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
step D: taking the sequence number of the RTP data packet in the structure body corresponding to the rear node pointer of the available structure body as the minimum sequence number, and taking the sequence number of the RTP data packet in the structure body corresponding to the front node pointer of the available structure body as the maximum sequence number;
step E: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
when the sequence number of the new RTP data packet is smaller than the minimum sequence number, executing the step F: sending the new RTP data packet to the preset player, and returning to the step E;
when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D;
and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
Optionally, the performing, by using a front node pointer and a rear node pointer in each preset structure and a sequence number of an RTP packet buffered in the structure, an ascending and end-to-end ordering operation according to a sequence number of the RTP packet from a head of a queue to a tail of the queue on all structures, includes:
sequencing all the structural bodies according to the sequence of the sequence numbers of the RTP data packets in each structural body from small to large;
in the sequencing, a front node pointer of a structure body with the minimum sequence number of the RTP data packet points to the structure body with the maximum sequence number of the RTP data packet;
enabling a rear node pointer of the structure body with the largest sequence number of the RTP data packet to point to the structure body with the smallest sequence number of the RTP data packet;
and the front node pointer of each other structural body points to the former structural body of each structural body, and the rear node pointer of each structural body points to the rear structural body of each structural body.
Optionally, the preset formula for preventing serial number from repeating the cycle is as follows:
Nnum=Onum+K×B
the method comprises the steps of converting a sequence number of an RTP data packet, wherein the Nnum is the converted sequence number of the RTP data packet, the Onum is an original sequence number corresponding to the RTP data packet, K is the number of times of circulation of the sequence number of the RTP data packet, the initial value of the K is 0, and B is the number of the sequence number of the RTP data packet in a single circulation.
In order to solve the above problem, the present invention further provides an RTP packet sequencing apparatus, including:
a packet buffer module, configured to perform step a: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
a data packet sequencing module, configured to: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
a minimum sequence number data packet identification module, configured to: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body; step D: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
a new data packet sequence number conversion module, configured to: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
a new data packet comparing module, configured to execute step F when the sequence number of the new RTP data packet is less than the minimum sequence number: sending the new RTP data packet to the preset player, and returning to the step E; when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D; and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing a computer program; and
and the processor executes the computer program stored in the memory to realize the RTP data packet sequencing method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is executed by a processor in an electronic device to implement the RTP packet ordering method described above.
The invention uses a plurality of structural bodies which are arranged in ascending order according to the sequence number of the RTP data packet from the head to the tail of the queue and are connected end to obtain the RTP data packet in the structural body corresponding to the smallest sequence number of the RTP data packet and send the RTP data packet to a preset player, uses the corresponding structural body as an available structural body, uses the available structural body to store the received new RTP data packet, and selects whether to adjust the sequence among the structural bodies by carrying out relevant judgment on the sequence number of the new RTP data packet so as to realize that the sequence relation among the structural bodies which are arranged in ascending order according to the sequence number of the RTP data packet from the head to the tail of the queue and are connected end to end is always kept, thereby continuously obtaining the RTP data packet with the smallest sequence number from the structural bodies and sending the RTP data packet to the preset player, and ensuring that the RTP data packet sent to the preset player each time is the RTP data packet with the smallest current sequence number, therefore, the problem that RTP data packets are out of order in network transmission is solved, video frame judgment and video frame assembly operation are not involved in the scheme, the scheme is simpler, and the efficiency of solving the problem of out of order of RTP data packets is improved.
Drawings
Fig. 1 is a schematic flowchart of a method for ordering RTP packets according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a detailed implementation flow of one step in the RTP packet ordering method;
fig. 3 is a schematic diagram illustrating an effect of a RTP packet ordering method according to an embodiment of the present invention;
fig. 4 is a functional block diagram of an apparatus for sorting RTP packets according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for implementing the RTP packet ordering method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a method for sequencing RTP data packets. The execution subject of the RTP packet ordering method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiment of the present application, such as a server, a terminal, and the like. In other words, the RTP packet ordering method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a block chain platform. The server side can be an independent server, and can also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data and an artificial intelligence platform.
Fig. 1 is a schematic flow chart of a RTP packet ordering method according to an embodiment of the present invention. In this embodiment, the RTP packet ordering method includes:
s1, receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and the sequence number of the RTP data packet cached in the rear node pointer;
in the embodiment of the present invention, in the transmission process of video data such as a video, a conference video, or a live broadcast short video, in order to meet the transmission requirement of the video data in a network, generally, original video data is decomposed into a plurality of video frames at a transmitting end, each video frame is further divided into a plurality of RTP (Real-time Transport Protocol) packets, and the RTP packets are transmitted to a receiving end by using a UDP (User Datagram Protocol).
The sending end may be a device or a module providing a video data sending or transferring function, for example, a module in charge of sending video data in a device such as a mobile phone, a computer, or a television.
The receiving end may be a device or a module for providing video data reception or buffering, for example, a module in charge of video data reception in a device such as a mobile phone, a computer, or a television.
The RTP data packet is the minimum unit of the original video data transmitted in the network, and usually includes sequence number information in a data structure of the RTP data packet, where the sequence number refers to a sequence of a plurality of RTP data packets generated when the video frame is packed by using an RTP protocol, each sequence generates one RTP data packet, and the sequence number corresponding to the RTP data packet is automatically incremented by 1.
In the embodiment of the present invention, the preset structure body is composed of a series of nodes, different nodes bear different data information, the preset structure body includes a front node pointer, a rear node pointer, serial numbers of RTP packets buffered by the front node pointer and the rear node pointer, a data container, an effective data length, and other information, each information corresponds to a separate node, the front node pointer and the rear node pointer are used for recording a front-back sequence relationship between the structure body and other structure bodies, the data container is used for storing corresponding RTP packets, and the effective data length is an effective data length corresponding to the RTP packets.
S2, using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the pointers, executing the sequencing operation of ascending the sequence number of the RTP data packet from the head of the queue to the tail of the queue and connecting the head and the tail of the RTP data packet to all the structure bodies;
in the embodiment of the invention, the structural body circular chain which is connected end to end and arranged according to the ascending sequence of the RTP data packet sequence number is formed by setting the direction of the front node pointer and the direction of the rear node pointer of the preset structural body.
In detail, referring to fig. 2, the S2 includes:
s21, sequencing all the structural bodies according to the sequence of the sequence numbers of the RTP data packets in each structural body from small to large;
s22, in the sequence, the front node pointer of the structure body with the minimum sequence number of the RTP data packet points to the structure body with the maximum sequence number of the RTP data packet;
s23, the rear node pointer of the structure body with the maximum sequence number of the RTP data packet points to the structure body with the minimum sequence number of the RTP data packet;
and S24, pointing the front node pointer of each other structural body to the former structural body of each structural body, and pointing the rear node pointer of each structural body to the latter structural body of each structural body.
For example, fig. 3 is a schematic view illustrating an effect of an RTP packet ordering method according to an embodiment of the present invention, referring to fig. 3, where 0, 1, 2, 3, 4, 5, 6, and 7 are sequence numbers of a plurality of RTP packets generated within a certain time period, and a transmission sequence of an actual RTP packet in a network is 0, 2, 3, 6, 4, 1, 7, and 5 from first to last due to network congestion, and if 5 RTP packets are received in advance, sequence numbers and sequences of the received RTP packets are 0, 2, 3, 6, and 4, and the sequence numbers and the sequences are buffered in 5 preset structural bodies, respectively.
S3, acquiring the RTP data packet in the structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, and taking the structure body with the minimum sequence number of the RTP data packet as an available structure body;
in the embodiment of the present invention, referring to fig. 3, the RTP packet with the sequence number of 0 has the smallest sequence number, and the RTP packet with the sequence number of 0 is sent to a preset player, where the structure with the sequence number of 0 of the RTP packet is the available structure.
S4, taking the sequence number of the RTP packet in the structure corresponding to the back node pointer of the available structure as the minimum sequence number, and taking the sequence number of the RTP packet in the structure corresponding to the front node pointer of the available structure as the maximum sequence number;
in this embodiment of the present invention, referring to fig. 3, if the sequence number of the RTP packet in the structure pointed by the back node pointer of the available structure is 2, then 2 is the minimum sequence number, and if the sequence number of the RTP packet in the structure pointed by the front node pointer of the available structure is 6, then 6 is the maximum sequence number.
S5, receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying the serial number of the new RTP data packet, taking the serial number as the original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
in the embodiment of the present invention, according to the definition of the data structure of the RTP data packet, the value range of the sequence number of the RTP data packet is 0 to 655535, when the 655536 th RTP data packet is generated, the sequence number corresponding to the RTP data packet is counted again from 0, and the generation time of the 655536 th RTP data packet is the last, but the corresponding sequence number is 0, so that the sequence order of the corresponding RTP data packet cannot be determined from the sequence number.
In the embodiment of the invention, in order to solve the above problems, a preset formula for preventing serial number recirculation is adopted to convert the serial numbers of the RTP data packets, so that the larger the serial number of the RTP data packet is, the later the generation sequence of the corresponding RTP data packet is.
In the embodiment of the present invention, the preset formula for preventing the serial number from repeating cycles is as follows:
Nnum=Onum+K×B
where Nnum is a converted serial number of an RTP packet, Onum is an original serial number corresponding to the RTP packet, K is a number of times of a sequence number cycle of the RTP packet, an initial value of K is 0, and B is a number of serial numbers of the sequence number of the RTP packet in a single cycle, where B is 655536 in this embodiment
In the embodiment of the present invention, referring to fig. 3, an original sequence number of a received new RTP packet is 1, where 1 is the original sequence number of the new RTP packet, and if K is 0, after the formula of the preset sequence number repeat loop prevention is performed, an obtained converted sequence number is still 1, and then the sequence number of the new RTP packet is 1.
When the sequence number of the new RTP data packet is smaller than the minimum sequence number, executing S6, sending the new RTP data packet to the preset player, and returning to S5;
in the embodiment of the present invention, referring to fig. 3, if the sequence number of the new RTP packet is 1, where the minimum sequence number is 2, and the sequence number of the new RTP packet satisfies the condition that the sequence number of the new RTP packet is smaller than the minimum sequence number, the new RTP packet with the sequence number of 1 is sent to the preset player, and a new RTP packet is received again, where the sequence number of the new RTP packet is 7, and the condition that the sequence number of the new RTP packet is smaller than the minimum sequence number is not satisfied, the new RTP packet is further determined.
When the sequence number of the new RTP packet is greater than the maximum sequence number, performing S7, obtaining an RTP packet in the structure corresponding to the back node pointer of the available structure and sending the RTP packet to the preset player, taking the structure corresponding to the back node pointer of the available structure as an available structure, and returning to S4;
in this embodiment of the present invention, at this time, the sequence number of the new RTP packet is 7, the maximum sequence number is 6, the condition that when the sequence number of the new RTP packet is greater than the maximum sequence number is satisfied, at this time, the sequence number of the RTP packet in the structure pointed by the back node pointer of the available structure is 2, the RTP packet with the sequence number of 2 is sent to the preset player, the structure with the sequence number of the RTP packet 2 is used as the available structure, and after returning to S4, the minimum sequence number is 3, the maximum sequence number is 7, a new RTP packet is received, and at this time, the sequence number of the new RTP packet is 5.
When the sequence number of the new RTP packet is less than the maximum sequence number, returning to S2.
In this embodiment of the present invention, at this time, the sequence number of the new RTP packet is 5, the maximum sequence number is 7, and the condition when the sequence number of the new RTP packet is smaller than the maximum sequence number is satisfied, then the process returns to S2, and the current all the structures are reordered, so that the ordering relationship among the structures that are ordered from the head of the queue to the tail of the queue according to the sequence number of the RTP packet and are connected end to end is always maintained.
The invention uses a plurality of structural bodies which are arranged in ascending order according to the sequence number of the RTP data packet from the head to the tail of the queue and are connected end to obtain the RTP data packet in the structural body corresponding to the smallest sequence number of the RTP data packet and send the RTP data packet to a preset player, uses the corresponding structural body as an available structural body, uses the available structural body to store the received new RTP data packet, and selects whether to adjust the sequence among the structural bodies by carrying out relevant judgment on the sequence number of the new RTP data packet so as to realize that the sequence among the structural bodies which are arranged in ascending order according to the sequence number of the RTP data packet from the head to the tail of the queue and are connected end to end is always kept, thereby continuously obtaining the RTP data packet with the smallest sequence number from the structural bodies and sending the RTP data packet to the preset player, and ensuring that the RTP data packet sent to the preset player each time is the RTP data packet with the smallest current sequence number, therefore, the problem that RTP data packets are out of order in network transmission is solved, video frame judgment and video frame assembly operation are not involved in the scheme, the scheme is simpler, and the efficiency of solving the problem of out of order of RTP data packets is improved.
Fig. 4 is a functional block diagram of an apparatus for sorting RTP packets according to an embodiment of the present invention.
The RTP packet sequencing apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the RTP packet sorting apparatus 100 may include a packet buffer module 101, a packet sorting module 102, a minimum sequence number packet identification module 103, a new packet sequence number conversion module 104, and a new packet comparison module 105. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the packet cache module 101 is configured to: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
the packet sorting module 102 is configured to: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
the minimum sequence number packet identification module 103 is configured to: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body; step D: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
the new packet sequence number conversion module 104 is configured to: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
the new data packet comparing module 105 is configured to, when the sequence number of the new RTP data packet is less than the minimum sequence number, execute step F: sending the new RTP data packet to the preset player, and returning to the step E; when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D; and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
In detail, when the modules in the RTP packet sequencing apparatus 100 according to the embodiment of the present invention are used, the same technical means as the RTP packet sequencing method described in fig. 1 to 3 are adopted, and the same technical effect can be produced, which is not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device for implementing an RTP packet ordering method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as an RTP packet sequencing program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of an RTP packet sequencing program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., RTP packet sequencing programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The RTP packet sequencing program stored in the memory 11 of the electronic device 1 is a combination of instructions, and when running in the processor 10, can realize:
step A: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
and B: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
and C: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
step D: taking the sequence number of the RTP data packet in the structure body corresponding to the rear node pointer of the available structure body as the minimum sequence number, and taking the sequence number of the RTP data packet in the structure body corresponding to the front node pointer of the available structure body as the maximum sequence number;
step E: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
when the sequence number of the new RTP data packet is smaller than the minimum sequence number, executing the step F: sending the new RTP data packet to the preset player, and returning to the step E;
when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D;
and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
step A: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
and B: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
and C: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
step D: taking the sequence number of the RTP data packet in the structure body corresponding to the rear node pointer of the available structure body as the minimum sequence number, and taking the sequence number of the RTP data packet in the structure body corresponding to the front node pointer of the available structure body as the maximum sequence number;
step E: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
when the sequence number of the new RTP data packet is smaller than the minimum sequence number, executing the step F: sending the new RTP data packet to the preset player, and returning to the step E;
when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D;
and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (6)
1. A method for RTP packet sequencing, the method comprising:
step A: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
and B: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
and C: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
step D: taking the sequence number of the RTP data packet in the structure body corresponding to the rear node pointer of the available structure body as the minimum sequence number, and taking the sequence number of the RTP data packet in the structure body corresponding to the front node pointer of the available structure body as the maximum sequence number;
step E: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
when the sequence number of the new RTP data packet is smaller than the minimum sequence number, executing the step F: sending the new RTP data packet to the preset player, and returning to the step E;
when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D;
and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
2. The RTP packet sorting method according to claim 1, wherein the sorting operation performed on all the structures from head to tail of the queue in ascending order of the RTP packet sequence numbers and from head to tail by using the front node pointer, the rear node pointer and the buffered RTP packet sequence number in each of the preset structures comprises:
sequencing all the structural bodies according to the sequence of the sequence numbers of the RTP data packets in each structural body from small to large;
in the sequencing, a front node pointer of a structure body with the minimum sequence number of the RTP data packet points to the structure body with the maximum sequence number of the RTP data packet;
enabling a rear node pointer of the structure body with the largest sequence number of the RTP data packet to point to the structure body with the smallest sequence number of the RTP data packet;
and the front node pointer of each other structural body points to the former structural body of each structural body, and the rear node pointer of each structural body points to the rear structural body of each structural body.
3. The RTP packet sequencing method of claim 1 wherein the predetermined anti-sequence number repetition cycle formula is:
Nnum=Onum+K×B
the method comprises the steps of converting a sequence number of an RTP data packet, wherein the Nnum is the converted sequence number of the RTP data packet, the Onum is an original sequence number corresponding to the RTP data packet, K is the number of times of circulation of the sequence number of the RTP data packet, the initial value of the K is 0, and B is the number of the sequence number of the RTP data packet in a single circulation.
4. An apparatus for RTP packet sequencing, the apparatus comprising:
a packet buffer module, configured to perform step a: receiving a plurality of RTP data packets in advance, and caching each RTP data packet into different preset structural bodies, wherein each preset structural body comprises a front node pointer, a rear node pointer and a serial number of the RTP data packet cached in the front node pointer and the rear node pointer;
a data packet sequencing module, configured to: using the front node pointer and the rear node pointer in each preset structure body and the sequence number of the RTP data packet cached in the front node pointer and the rear node pointer in each preset structure body to perform sequencing operation on all the structure bodies from the head of the queue to the tail of the queue according to the sequence number of the RTP data packet, wherein the sequencing operation is performed in an ascending order from the head of the queue to the tail of the queue and is performed in an end-to-end way;
a minimum sequence number data packet identification module, configured to: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body; step D: acquiring an RTP data packet in a structure body with the minimum sequence number of the RTP data packet and sending the RTP data packet to a preset player, wherein the structure body with the minimum sequence number of the RTP data packet is used as an available structure body;
a new data packet sequence number conversion module, configured to: receiving a new RTP data packet, caching the new RTP data packet into the available structural body, identifying a serial number of the new RTP data packet, taking the serial number as an original serial number of the new RTP data packet, converting the original serial number by using a preset serial number recycling prevention formula to obtain a converted serial number, and replacing the original serial number by using the converted serial number;
a new data packet comparing module, configured to execute step F when the sequence number of the new RTP data packet is less than the minimum sequence number: sending the new RTP data packet to the preset player, and returning to the step E; when the sequence number of the new RTP data packet is greater than the maximum sequence number, executing step G: acquiring an RTP data packet in the structure body corresponding to the rear node pointer of the available structure body, sending the RTP data packet to the preset player, taking the structure body corresponding to the rear node pointer of the available structure body as the available structure body, and returning to the step D; and when the sequence number of the new RTP data packet is smaller than the maximum sequence number, returning to the step B.
5. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the RTP packet ordering method as claimed in any one of claims 1 to 3.
6. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a method for RTP packet ordering according to any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111162213.0A CN113890870B (en) | 2021-09-30 | 2021-09-30 | RTP data packet ordering method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111162213.0A CN113890870B (en) | 2021-09-30 | 2021-09-30 | RTP data packet ordering method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113890870A true CN113890870A (en) | 2022-01-04 |
CN113890870B CN113890870B (en) | 2023-09-19 |
Family
ID=79004986
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111162213.0A Active CN113890870B (en) | 2021-09-30 | 2021-09-30 | RTP data packet ordering method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113890870B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006067410A (en) * | 2004-08-30 | 2006-03-09 | Sony Corp | Transmitter and transmission method, program, and transmission/reception system |
JP2012151675A (en) * | 2011-01-19 | 2012-08-09 | Oki Networks Co Ltd | Communication control device and program, and communication system |
CN109547359A (en) * | 2018-11-30 | 2019-03-29 | 高新兴科技集团股份有限公司 | RTP data packet disorder rearrangement method, device, storage medium and electronic equipment |
CN111131075A (en) * | 2019-11-21 | 2020-05-08 | 武汉兴图新科电子股份有限公司 | High-concurrency data packet buffering method |
CN113014586A (en) * | 2021-03-04 | 2021-06-22 | 即时匹配(上海)网络科技有限公司 | RTP data packet out-of-order processing and framing method and system |
-
2021
- 2021-09-30 CN CN202111162213.0A patent/CN113890870B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006067410A (en) * | 2004-08-30 | 2006-03-09 | Sony Corp | Transmitter and transmission method, program, and transmission/reception system |
JP2012151675A (en) * | 2011-01-19 | 2012-08-09 | Oki Networks Co Ltd | Communication control device and program, and communication system |
CN109547359A (en) * | 2018-11-30 | 2019-03-29 | 高新兴科技集团股份有限公司 | RTP data packet disorder rearrangement method, device, storage medium and electronic equipment |
CN111131075A (en) * | 2019-11-21 | 2020-05-08 | 武汉兴图新科电子股份有限公司 | High-concurrency data packet buffering method |
CN113014586A (en) * | 2021-03-04 | 2021-06-22 | 即时匹配(上海)网络科技有限公司 | RTP data packet out-of-order processing and framing method and system |
Non-Patent Citations (1)
Title |
---|
王安静, 金赞, 杜春华, 王静: "Windows下视频传输纠错技术的实现", 计算机应用研究, no. 05, pages 237 - 238 * |
Also Published As
Publication number | Publication date |
---|---|
CN113890870B (en) | 2023-09-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112052370A (en) | Message generation method and device, electronic equipment and computer readable storage medium | |
CN112671921A (en) | Data transmission method and device, electronic equipment and readable storage medium | |
CN113163009A (en) | Data transmission method, device, electronic equipment and storage medium | |
CN113890712A (en) | Data transmission method and device, electronic equipment and readable storage medium | |
CN108702370A (en) | Multithread for network technology interweaves | |
CN112653760A (en) | Cross-server file transmission method and device, electronic equipment and storage medium | |
CN113868528A (en) | Information recommendation method and device, electronic equipment and readable storage medium | |
CN111880948A (en) | Data refreshing method and device, electronic equipment and computer readable storage medium | |
CN112015815A (en) | Data synchronization method, device and computer readable storage medium | |
CN114035987A (en) | Data transmission method and device based on message queue, electronic equipment and medium | |
CN112702228A (en) | Service current limiting response method and device, electronic equipment and readable storage medium | |
CN113365098A (en) | Video frame assembling method and device, electronic equipment and storage medium | |
CN114844844A (en) | Delay message processing method, device, equipment and storage medium | |
CN114741422A (en) | Query request method, device, equipment and medium | |
CN114205322A (en) | Message sending method and device, electronic equipment and storage medium | |
CN113890870A (en) | RTP data packet sequencing method and device, electronic equipment and storage medium | |
CN115373826B (en) | Task scheduling method and device based on cloud computing | |
CN111211887A (en) | Resource encryption method, system, device and computer readable storage medium | |
CN113347451B (en) | Video uploading method and device, electronic equipment and computer readable storage medium | |
CN114125024A (en) | Audio transmission method, electronic device and readable storage medium | |
CN115033605A (en) | Data query method and device, electronic equipment and storage medium | |
CN112540839A (en) | Information changing method, device, electronic equipment and storage medium | |
CN113032168B (en) | Data transmission rate dynamic adjustment method and device, electronic equipment and storage medium | |
CN114640618B (en) | Cluster route scheduling method and device, electronic equipment and readable storage medium | |
CN115086756B (en) | Video processing method, device and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |