Video stream transmission packet loss retransmission method, device and storage device based on RTP

文档序号:1642188 发布日期:2019-12-20 浏览:22次 中文

阅读说明:本技术 一种基于rtp的视频流传输丢包重传方法、设备及存储设备 (Video stream transmission packet loss retransmission method, device and storage device based on RTP ) 是由 程家明 王军明 孔繁东 周志祥 于 2019-08-07 设计创作,主要内容包括:本发明公开了一种基于RTP的视频流传输丢包重传方法、设备及存储设备。其方法具体步骤如下:发送终端和接收终端时间参数初始化;发送终端响应重传请求向接收终端发送数据包;接收终端检测是否接收完整,若完整,则重传成功;若不完整,则接收终端根据时间参数作出数据包有效性、重传频率有效性的判断;若数据包无效或重传频率无效,则不进行下一次重传请求;反之,接收终端进行下一次重传请求;发送终端根据时间参数判断是否响应该重传请求;若响应重传请求,则发送终端再次向接收终端发送数据包;否则,不响应重传请求。本发明的有益效果是:实现在高并发路数(至少64路)和高丢包率(30%以上)的情况下,实现视频流的流畅播放。(The invention discloses a video stream transmission packet loss retransmission method, equipment and storage equipment based on RTP. The method comprises the following specific steps: initializing time parameters of a sending terminal and a receiving terminal; the sending terminal responds to the retransmission request and sends a data packet to the receiving terminal; the receiving terminal detects whether the receiving is complete, if so, the retransmission is successful; if the data packet is not complete, the receiving terminal judges the validity of the data packet and the validity of the retransmission frequency according to the time parameter; if the data packet is invalid or the retransmission frequency is invalid, the next retransmission request is not carried out; otherwise, the receiving terminal carries out the next retransmission request; the sending terminal judges whether to respond to the retransmission request according to the time parameter; if the retransmission request is responded, the sending terminal sends the data packet to the receiving terminal again; otherwise, no retransmission request is responded. The invention has the beneficial effects that: the smooth playing of the video stream is realized under the conditions of high concurrent path number (at least 64 paths) and high packet loss rate (more than 30%).)

1. A video stream transmission packet loss retransmission method based on RTP is characterized in that: the method comprises the following steps:

s101: initializing time parameters in a sending terminal and a receiving terminal according to the actual network bandwidth condition and the server condition;

the sending terminal is used for sending a data packet to a receiving terminal, and the receiving terminal is used for receiving the data packet, adding the lost data packet to a retransmission queue, generating a retransmission request and further sending the retransmission request to the sending terminal; the retransmission queue consists of lost data packets;

s102: the sending terminal sends the lost data packet in the last data transmission process to the receiving terminal according to the retransmission queue;

s103, the receiving terminal receives the lost data packet, judges whether the receiving is complete?, if so, indicates that the retransmission is successful, and goes to step S106, if not, indicates that the receiving is failed, considers that the data packet is lost again, and goes to step S104;

s104: the receiving terminal adds the lost data packet to a retransmission queue and removes the over-old data packet in the retransmission queue;

the over-old data packet is defined by the length of a retransmission queue; the length of the retransmission queue is different according to different server conditions and is a preset value; the specific method for clearing the over-old data packet in the retransmission queue is as follows:

assuming that the length of a retransmission queue is L, after a lost data packet is newly added to the retransmission queue, judging whether the length of the retransmission queue exceeds L, if so, determining that the data packet at the tail of the retransmission queue is an old data packet, discarding the old data packet by a receiving terminal, and if not, not clearing the retransmission queue;

s105, the receiving terminal judges whether the retransmission frequency is effective? according to the time parameter, if so, the step S106 is carried out, otherwise, the step S107 is carried out;

s106, the receiving terminal carries out the next retransmission request, the sending terminal judges whether to respond to the retransmission request? according to the time parameter, if so, the step S102 is returned, otherwise, the step S107 is carried out;

s107: the retransmission procedure is ended.

2. The RTP-based video streaming packet loss retransmission method according to claim 1, wherein: in step S101, time parameters in the sending terminal and the receiving terminal are initialized according to the actual network bandwidth condition and the server condition, and the specific steps are as follows:

setting a scanning period T at a receiving terminal0And a time threshold T1(ii) a For the first lost data packet, recording the time t of the first losssAnd add it to the retransmit queue; setting an initial value of an avg _ rtt _ new of a time threshold value for responding to a retransmission request at a sending terminal; wherein, the calculation formula of avg _ rtt _ new is as follows:

avg_rtt_new=avg_rtt_pre*0.7+avr_rtt_list*0.3

in the above formula, avg _ rtt _ list is the average value of the actual round-trip delay rtt values in the latest 5 s; avg _ rtt _ new is the latest average value calculated currently; avg _ rtt _ pre is the last value of avg _ rtt _ new, and the initial value is avg _ rtt _ list;

the scanning period T0The system is used for scanning the retransmission queue at regular time, and the value of the retransmission queue is a preset value according to the actual network bandwidth condition and the server condition; the time threshold value T1The delay time is a preset value, which is different according to the delay requirement of video transmission.

3. The RTP-based video streaming packet loss retransmission method according to claim 2, wherein: in step S105, the receiving terminal determines whether the retransmission frequency is valid according to the time parameter, and the specific steps are as follows:

s201: the receiving terminal records the current lost time t of the data packetc

S202: the receiving terminal carries out the next transmission according to the retransmission queueSecondary retransmission request and recording current retransmission request time te

S203: judgment condition te-tc>T0If the determination is true?, the retransmission frequency is valid and goes to step S204, otherwise, the retransmission frequency is invalid;

s204: the judgment routine is ended.

4. The RTP-based video streaming packet loss retransmission method according to claim 3, wherein: in step S106, the sending terminal determines whether to respond to the retransmission request according to the time parameter, and the specific steps are as follows:

s301: judgment condition te-ts>rtt&&te-ts<T1? if yes, then the data packet can be retransmitted again, if it meets the retransmission requirement, it is retained in the retransmission queue, and go to step S302, otherwise, if it does not meet the retransmission requirement, it is removed from the retransmission queue, and go to step S302;

s302: the receiving terminal sends out a retransmission request and records the time t of the current retransmission requeste'; transmitting terminal judging condition te′-te>and if the avg _ rtt _ new is established?, responding to the retransmission request, otherwise, not responding to the retransmission request.

5. A storage device, characterized by: the storage device stores instructions and data for implementing any of the video stream transmission packet loss retransmission methods based on RTP according to claims 1 to 4.

6. A video stream transmission packet loss retransmission device in RTP is characterized in that: the method comprises the following steps: a processor and a storage device; the processor loads and executes instructions and data in the storage device to implement any one of the video stream transmission packet loss retransmission methods based on RTP according to claims 1 to 4.

Technical Field

The present invention relates to the field of video communication, and in particular, to a method, an apparatus, and a storage apparatus for packet loss retransmission in video streaming transmission based on RTP.

Background

At present, video transmission generally performs transmission based on a UDP protocol because the requirement on real-time performance is high, and UDP is a non-connection-oriented unreliable protocol, so that a packet loss phenomenon easily occurs in a data packet transmission process, and particularly, the packet loss is serious under the condition of poor network conditions. Therefore, a large amount of screen-splash card segment phenomena appear when the receiving end decodes, and the playing quality of the audio and video is seriously influenced.

To solve this problem, it is a common solution to make improvements on the transport layer. Specifically, a packet loss retransmission manner is adopted, when a receiving end receives a discontinuous data packet, the receiving end actively requests a missing packet that has not been received to a sending end, and after receiving a retransmission request, the sending end retransmits the requested packet to a receiving end (as shown in fig. 1). The scheme can solve the problem of partial screen splash and blocking, but still causes certain video delay, and when network congestion is serious, the situation of the network is worsened by repeatedly sending a large number of data packets, so that more data packets can not be reached, and a vicious circle is formed. For this reason, the receiver needs to have better control over the frequency of requests, while the sender also needs to have better control over the frequency of retransmission packets.

The webrtc is an open source interface which can support a web browser to perform real-Time voice conversation and video conversation, a packet loss retransmission part is also arranged in the aspect of media transmission, a sending end of the webrtc checks retransmission at intervals of rtt (Round-Trip Time) aiming at the sequence number of each request, so that the retransmission is avoided from being too frequent, at a receiving end of the webrtc, a retransmission request is performed again at approximately one rtt, a missing packet list and a packet list of key frames are maintained at the same Time, and a retransmission request is abandoned for packets which exceed a certain retransmission Time and are too old.

This is ideal for the case of bidirectional mutual transmission of media streams with only a few media paths, but for a high performance video forwarding server, the delay is greatly affected by the excessive processing procedure at the receiving end, and the retransmission is easily abandoned too early or too late by using the retransmission times as the threshold. Webrtc does not apply well to video forwarding servers.

In order to solve the above problems, the present invention provides a request packet queue mode based on a time threshold, so that a receiving end can reasonably discard some outdated missing packets, reduce network pressure, and simultaneously can make requests for missing packets to the maximum extent, so that even under the condition of bad network conditions, the basic acceptance of video quality can be ensured, and the situations of large screens and jam stop can be avoided.

Disclosure of Invention

The invention aims to provide a video stream transmission packet loss retransmission method, equipment and storage equipment based on RTP. A video stream transmission packet loss retransmission method based on RTP comprises the following steps:

s101: initializing time parameters in a sending terminal and a receiving terminal according to the actual network bandwidth condition and the server condition;

the sending terminal is used for sending a data packet to a receiving terminal, and the receiving terminal is used for receiving the data packet, adding the lost data packet to a retransmission queue, generating a retransmission request and further sending the retransmission request to the sending terminal; the retransmission queue consists of lost data packets;

s102: the sending terminal sends the lost data packet in the last data transmission process to the receiving terminal according to the retransmission queue;

s103, the receiving terminal receives the lost data packet, judges whether the receiving is complete?, if so, indicates that the retransmission is successful, and goes to step S106, if not, indicates that the receiving is failed, considers that the data packet is lost again, and goes to step S104;

s104: the receiving terminal adds the lost data packet to a retransmission queue and removes the over-old data packet in the retransmission queue;

the over-old data packet is defined by the length of a retransmission queue; the length of the retransmission queue is different according to different server conditions and is a preset value; the specific method for clearing the over-old data packet in the retransmission queue is as follows:

assuming that the length of a retransmission queue is L, after a lost data packet is newly added to the retransmission queue, judging whether the length of the retransmission queue exceeds L, if so, determining that the data packet at the tail of the retransmission queue is an old data packet, discarding the old data packet by a receiving terminal, and if not, not clearing the retransmission queue;

s105, the receiving terminal judges whether the retransmission frequency is effective? according to the time parameter, if so, the step S106 is carried out, otherwise, the step S107 is carried out;

s106, the receiving terminal carries out the next retransmission request, the sending terminal judges whether to respond to the retransmission request? according to the time parameter, if so, the step S102 is returned, otherwise, the step S107 is carried out;

s107: the retransmission procedure is ended.

Further, in step S101, time parameters in the sending terminal and the receiving terminal are initialized according to the actual network bandwidth condition and the server condition, and the specific steps are as follows:

setting a scanning period T at a receiving terminal0And a time threshold T1(ii) a For the first lost data packet, recording the time t of the first losssAnd add it to the retransmit queue; setting an initial value of an avg _ rtt _ new of a time threshold value for responding to a retransmission request at a sending terminal; wherein, the calculation formula of avg _ rtt _ new is as follows:

avg_rtt_new=avg_rtt_pre*0.7+avr_rtt_list*0.3

in the above formula, avg _ rtt _ list is the average value of the actual round-trip delay rtt values in the latest 5 s; avg _ rtt _ new is the latest average value calculated currently; avg _ rtt _ pre is the last value of avg _ rtt _ new, and the initial value is avg _ rtt _ list;

the scanning period T0The system is used for scanning the retransmission queue at regular time, and the value of the retransmission queue is a preset value according to the actual network bandwidth condition and the server condition; the time threshold value T1The delay time is a preset value, which is different according to the delay requirement of video transmission.

Further, in step S105, the receiving terminal determines whether the retransmission frequency is valid according to the time parameter, and the specific steps are as follows:

s201: the receiving terminal records the current lost time t of the data packetc

S202: the receiving terminal carries out the next retransmission request according to the retransmission queue and records the current retransmission request time te

S203: judgment condition te-tc>T0If the determination is true?, the retransmission frequency is valid and goes to step S204, otherwise, the retransmission frequency is invalid;

s204: the judgment routine is ended.

Further, in step S106, the sending terminal determines whether to respond to the retransmission request according to the time parameter, and the specific steps are as follows:

s301: judgment condition te-ts>rtt&&te-ts<T1? if yes, then the data packet can be retransmitted again, if it meets the retransmission requirement, it is retained in the retransmission queue, and go to step S302, otherwise, if it does not meet the retransmission requirement, it is removed from the retransmission queue, and go to step S302;

s302: the receiving terminal sends out a retransmission request and records the time t of the current retransmission requeste'; transmitting terminal judging condition te′-te>and if the avg _ rtt _ new is established?, responding to the retransmission request, otherwise, not responding to the retransmission request.

Further, the storage device stores instructions and data for implementing any of the video streaming packet loss retransmission methods based on RTP according to claims 1 to 4.

A video stream transmission packet loss retransmission device in RTP is characterized in that: the method comprises the following steps: a processor and a storage device; the processor loads and executes instructions and data in the storage device to implement any one of the video stream transmission packet loss retransmission methods based on RTP according to claims 1 to 4.

The technical scheme provided by the invention has the beneficial effects that: the smooth playing of the video stream is realized under the conditions of high concurrent path number (at least 64 paths) and high packet loss rate (more than 30%).

Drawings

The invention will be further described with reference to the accompanying drawings and examples, in which:

fig. 1 is a flowchart of a video streaming packet loss retransmission method based on RTP in an embodiment of the present invention;

fig. 2 is a schematic diagram of packet loss retransmission according to an embodiment of the present invention;

fig. 3 is a schematic diagram of the operation of the hardware device in the embodiment of the present 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 video stream transmission packet loss retransmission method, equipment and storage equipment based on RTP.

Referring to fig. 1, fig. 1 is a flowchart of a method, an apparatus, and a storage apparatus for packet loss retransmission in video streaming transmission based on RTP according to an embodiment of the present invention, and particularly shows that a lost data packet is taken as an example, the technical solution includes the following steps:

the invention aims to provide a method, equipment and storage equipment for retransmitting lost packets in video stream transmission based on RTP. A video stream transmission packet loss retransmission method based on RTP comprises the following steps:

s101: initializing time parameters in a sending terminal and a receiving terminal according to the actual network bandwidth condition and the server condition;

the sending terminal is used for sending a data packet to a receiving terminal, and the receiving terminal is used for receiving the data packet, adding the lost data packet to a retransmission queue, generating a retransmission request and further sending the retransmission request to the sending terminal; the retransmission queue consists of lost data packets;

s102: the sending terminal sends the last lost data packet to the receiving terminal according to the retransmission queue;

s103, the receiving terminal receives the lost data packet, judges whether the receiving is complete?, if so, indicates that the retransmission is successful, and goes to step S106, if not, indicates that the receiving is failed, considers that the data packet is lost again, and goes to step S104;

s104: the receiving terminal adds the lost data packet to a retransmission queue and removes the over-old data packet in the retransmission queue so as to obtain an updated retransmission queue;

the over-old data packet is defined by the length of a retransmission queue; the length of the retransmission queue is different according to different server conditions and is a preset value; assuming that the length of a retransmission queue is L, after a lost data packet is newly added to the retransmission queue, judging whether the length of the retransmission queue exceeds L, if so, determining that the data packet at the tail end of the retransmission queue is an old data packet, and discarding the old data packet in sequence by a receiving terminal, otherwise, not clearing the retransmission queue;

s105, the receiving terminal judges whether the retransmission frequency is effective? according to the time parameter, if so, the step S106 is carried out, otherwise, the step S107 is carried out;

s106, the receiving terminal carries out the next retransmission request, the sending terminal judges whether to respond to the retransmission request? according to the time parameter, if so, the step S102 is returned, otherwise, the step S107 is carried out;

s107: the retransmission procedure is ended.

In step S101, time parameters in the sending terminal and the receiving terminal are initialized according to the actual network bandwidth condition and the server condition, and the specific steps are as follows:

setting a scanning period T at a receiving terminal0And a time threshold T1(ii) a For the first lost data packet, recording the time t of the first losssAnd add it to the retransmit queue; setting an initial value of an avg _ rtt _ new of a time threshold value for responding to a retransmission request at a sending terminal; wherein, the calculation formula of avg _ rtt _ new is as follows:

avg_rtt_new=avg_rtt_pre*0.7+avr_rtt_list*0.3

in the above formula, avg _ rtt _ list is the average value of the actual round-trip delay rtt values in the latest 5 s; avg _ rtt _ new is the latest average value calculated currently; avg _ rtt _ pre is the last value of avg _ rtt _ new, and the initial value is avg _ rtt _ list;

the scanning period T0The system is used for scanning the retransmission queue at regular time, and the value of the retransmission queue is a preset value according to the actual network bandwidth condition and the server condition; the time threshold value T1The delay time is a preset value, which is different according to the delay requirement of video transmission.

In step S105, the receiving terminal determines whether the retransmission frequency is valid according to the time parameter, and the specific steps are as follows:

s201: the receiving terminal records the current lost time t of the data packetc

S202: the receiving terminal carries out the next retransmission request according to the updated retransmission queue and records the current retransmission request time te

S203: judgment condition te-tc>T0If the determination is true?, the retransmission frequency is valid and goes to step S204, otherwise, the retransmission frequency is invalid;

s204: the judgment routine is ended.

In step S106, the sending terminal determines whether to respond to the retransmission request according to the time parameter, and the specific steps are as follows:

s301: judgment condition te-ts>rtt&&te-ts<T1? if yes, then the data packet is considered to be retransmitted again, and if the data packet meets the retransmission requirement, the data packet is retained in the retransmission queue, and the step S302 is reached, otherwise, if the data packet does not meet the retransmission requirement, the data packet is cleared out of the retransmission queue, so as to update the retransmission queue again;

s302: the receiving terminal sends out a retransmission request and records the time t of the current retransmission requeste'; transmitting terminal judging condition te′-te>and if the avg _ rtt _ new is established?, responding to the retransmission request, otherwise, not responding to the retransmission request.

A storage device, wherein the storage device stores instructions and data for implementing the RTP-based video streaming packet loss retransmission method according to any one of claims 1 to 4.

A video streaming packet loss retransmission apparatus in RTP, comprising: a processor and a storage device; the processor loads and executes instructions and data in the storage device to implement any one of the video stream transmission packet loss retransmission methods based on RTP according to claims 1 to 4.

Referring to fig. 2, fig. 2 is a schematic diagram of packet loss retransmission. In fig. 2, there are 3 queues in total, which are a receive queue, a retransmit queue, and a transmit queue, respectively; the retransmission queue is mainly composed of data packets to be retransmitted, and the sending terminal sends the data packets to the receiving terminal according to the latest data packets in the retransmission queue, so that the data packets in the retransmission queue are updated, scanned and judged before retransmission requests are made every time, and invalid data packets are not in the retransmission queue, so that the purposes of reducing the size of the retransmission queue and reducing the occupied bandwidth resources are achieved.

Referring to fig. 3, fig. 3 is a schematic diagram of a hardware device according to an embodiment of the present invention, where the hardware device specifically includes: an RTP-based video streaming packet loss retransmission device 401, a processor 402 and a storage device 403.

An RTP-based video streaming packet loss retransmission apparatus 401: the video streaming packet loss retransmission apparatus 401 based on the RTP implements the video streaming packet loss retransmission method based on the RTP.

The processor 402: the processor 402 loads and executes the instructions and data in the storage device 403 to implement the RTP-based video streaming packet loss retransmission method.

The storage device 403: the storage device 403 stores instructions and data; the storage device 403 is configured to implement the video streaming packet loss retransmission method based on RTP.

The invention has the beneficial effects that: the smooth playing of the video stream is realized under the conditions of high concurrent path number (at least 64 paths) and high packet loss rate (more than 30%).

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.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于带宽趋势的带宽复用方法和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类