Summary of the invention
The invention provides method and terminal that a kind of packet loss retransmits, having solved in prior art makes packet loss transmitting terminal repeatedly repeat to send to a packet loss because terminal repeatedly sends packet loss repeat requests, thereby cause the network bandwidth not enough, affect the problem of the speed of transmitted data on network, in order to address the above problem, the present invention by the following technical solutions:
A terminal, comprising:
Time Calculation module, for calculating apart from the time that sent the repeat requests of same packet loss last time;
Time comparison module, for comparing described resulting time of Time Calculation module and Network Transmission Delays time;
Packet loss retransmits judge module, for judging whether the result that described time comparison module obtains is to be greater than the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, if so, again sends the repeat requests of this packet loss.
Further, described packet loss re-transmission judge module also comprises: if not, do not send repeat requests.
Further, described Time Calculation module specifically comprises:
Flag bit arranges submodule, and for the corresponding flag bit of packet loss is set, the initial value of flag bit is 0;
Flag bit operator module, if arrive for preset interval time, carries out add-one operation to flag bit corresponding to packet loss;
Whether flag bit judgement submodule, be 1 for the value of judgement symbol position, if so, directly sends the repeat requests of this packet loss;
Time Calculation submodule, when the determination result is NO according to described flag bit judgement submodule, calculates the described time apart from sending the repeat requests of same packet loss last time and is: after the value of flag bit subtracts 1, then be multiplied by described preset interval time.
Described packet loss retransmits judge module and also for need to again sending the value of the corresponding flag bit of packet loss of repeat requests, is set to 1.
Further, also comprise Network Transmission Delays Time Calculation module, specifically for sending network delay detection packet to packet loss transmitting terminal, calculate described packet loss transmitting terminal the feedback time of described network delay detection packet is to the described Network Transmission Delays time.
The method that packet loss retransmits, comprising:
Calculating is apart from the time that sent the repeat requests of same packet loss last time;
Described time and the Network Transmission Delays time apart from sending the repeat requests of same packet loss last time is compared;
Judge whether the described time apart from sending the repeat requests of same packet loss last time be greater than the described Network Transmission Delays time, if so, again send the repeat requests of this packet loss.
Further, also comprise: if not, do not send repeat requests.
Further, calculating specifically comprised apart from the time that sent the repeat requests of same packet loss last time:
The corresponding flag bit of packet loss is set, and the initial value of flag bit is 0;
If preset interval time arrives, flag bit corresponding to packet loss carried out to add-one operation;
Whether the value of judgement symbol position is 1, if so, directly sends the repeat requests of this packet loss; If not, the described time apart from sending the repeat requests of same packet loss last time is: after the value of flag bit subtracts 1, then be multiplied by described preset interval time;
The described repeat requests that again sends this packet loss also comprises afterwards: the value of the corresponding flag bit of this packet loss is set to 1.
Further, described Network Transmission Delays Time Calculation method comprises: send network delay detection packet to packet loss transmitting terminal, calculate described packet loss transmitting terminal the feedback time of described network delay detection packet is to described network-induced delay.
The invention provides method and terminal that a kind of packet loss retransmits, described terminal comprises that Time Calculation module, time comparison module and packet loss retransmit judge module, these modules can send according to calculated distance after time of repeat requests of same packet loss and Network Transmission Delays time compares terminal last time, when the described time apart from sending the repeat requests of same packet loss last time, be greater than Network Transmission Delays during the time, obtain described packet loss and need to send repeat requests.It can not be blindly each packet loss to be sent to repeat requests that this programme makes terminal, but send selectively the repeat requests of packet loss, making can not occur packet loss in the transmitting procedure of packet repeatedly retransmits, take the situation of data channel, the transmission of network data will be more quick, unimpeded like this, real-time due to market demand is greatly improved simultaneously, has increased user's experience.
Embodiment
Below by embodiment, by reference to the accompanying drawings the present invention is described in further detail.
The structure chart that is illustrated in figure 1 a kind of terminal shown in one embodiment of the invention, refers to Fig. 1, and described terminal 100 comprises: Time Calculation module 101, time comparison module 102 and packet loss retransmit judge module 103; Time Calculation module 101, for calculating apart from the time that sent the repeat requests of same packet loss last time; Time comparison module 102, for comparing described resulting time of Time Calculation module 101 and Network Transmission Delays time; Packet loss retransmits judge module 103, for judging whether the result that described time comparison module obtains is to be greater than the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, if so, again sends the repeat requests of this packet loss.In the process of network data transmission, due to network generation local fault or the congested situation that produces data-bag lost, the packet of losing is described packet loss; Described repeat requests is for asking packet loss transmitting terminal to send request once to described packet loss again; Described network-induced delay means the needed time of reciprocal transmission of now carrying out a packet in network; If be greater than the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, show, described packet loss is not also being received after the time over Network Transmission Delays, the packet loss that is this re-transmission has been lost again in Internet Transmission, therefore, described packet loss need to send repeat requests again; Described terminal 100 comprises that computer, mobile phone, panel computer etc. have the equipment of network transmission function.
In certain embodiments, described packet loss retransmits judge module 103, for judging whether the result that described time comparison module obtains is to be greater than the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, if not, does not send repeat requests.If be less than or equal to the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, illustrate and also do not receive that to the re-transmission of this packet loss be because the reason of network delay, in this packet loss repeat requests, just do not need so this packet loss to send repeat requests, that has avoided too much repetition sends packet loss repeat requests to packet loss transmitting terminal, reduced the transmission times of packet loss transmitting terminal to this packet loss, thereby reduced the waste of bandwidth, improved the efficiency retransmitting.
In certain embodiments, described Time Calculation module 101 specifically comprises: flag bit arranges submodule 1011, and for the corresponding flag bit of packet loss is set, the initial value of flag bit is 0; Flag bit operator module 1012, if arrive for preset interval time, carries out add-one operation to flag bit corresponding to packet loss; Whether flag bit judgement submodule 1013, be 1 for the value of judgement symbol position, if so, directly sends the repeat requests of this packet loss; Time Calculation submodule 1014, when the determination result is NO according to described flag bit judgement submodule, calculates the described time apart from sending the repeat requests of same packet loss last time and is: after the value of flag bit subtracts 1, then be multiplied by described preset interval time.Described flag bit is simultaneous with packet loss, and its span is integer, and what its initial value represented is that while a packet loss often being detected, the value of the flag bit that this packet loss is corresponding is set to 0; Described preset interval time is the interval time whether each its packet loss of detection of described terminal 100 needs to send repeat requests, and each preset interval time arrives, and terminal 100 all can detect whether need to send repeat requests to its packet loss; If the result that described Time Calculation submodule 1014 calculates is greater than the Network Transmission Delays time, its corresponding packet loss need to send repeat requests; If flag bit value is 1, represent that the packet loss that this flag bit is corresponding is new packet loss, do not send repeat requests, therefore need to send repeat requests.
In further embodiments, described packet loss retransmits judge module 103 and also for need to again sending the value of the corresponding flag bit of packet loss of repeat requests, is set to 1.The flag bit value corresponding to packet loss that need to again send repeat requests be set to 1 be for convenient when next preset interval time arrives, calculate described packet loss apart from the time that sent repeat requests last time.
In further embodiments, described terminal 100 also comprises Network Transmission Delays Time Calculation module, specifically for sending network delay detection packet to packet loss transmitting terminal, calculate described packet loss transmitting terminal the feedback time of described network delay detection packet is to the described Network Transmission Delays time.Be that terminal 100 sends network delay detection packet to packet loss transmitting terminal, packet loss transmitting terminal is responded network delay response packet after receiving network delay detection packet immediately, terminal 100 is received after network delay response packet, the time difference of network delay response packet and transmission network delay detection packet is received in calculating, and this time difference is the Network Transmission Delays time now.Further, for computing network propagation delay time more exactly, terminal 100 can repeatedly send detection packet to packet loss transmitting terminal, and computing time is poor, then the mode of averaging is carried out the computing network propagation delay time; In addition, because the network state of each period is not identical, therefore, the Network Transmission Delays time need to calculate once at set intervals.
The terminal that the present embodiment provides, can send repeat requests selectively to packet loss, and packet loss transmitting terminal just can repeatedly not repeat to send to a packet loss like this, make the transmission of network data can not take more passage, thereby transmitted data on network is more quick.
As shown in Figure 3, the method flow diagram retransmitting for a kind of packet loss shown in another embodiment of the present invention.Refer to Fig. 3, after the method that this packet loss retransmits starts,
S301: calculate apart from the time that sent same packet loss repeat requests last time.In the process of network data transmission, due to network generation local fault or the congested situation that produces data-bag lost, the packet of losing is described packet loss; Described repeat requests is for asking packet loss transmitting terminal to send request once to described packet loss again; Apart from the concrete computational methods of time that sent the repeat requests of same packet loss last time, can be: the corresponding flag bit of packet loss is set, and the initial value of flag bit is 0; If preset interval time arrives, flag bit corresponding to packet loss carried out to add-one operation; According to the value of described flag bit, determine that packet loss is apart from the time that sent repeat requests last time.Described flag bit is simultaneous with packet loss, and its span is integer, and what its initial value represented is that while a packet loss often being detected, the value of the flag bit of this packet loss is set to 0; Described preset interval time is that described terminal detects the interval time whether its packet loss needs to send repeat requests at every turn, be that each preset interval time arrives, flag bit adds 1 computing, and then terminal all can detect whether need to send repeat requests to its packet loss; After the value of flag bit is subtracted to 1, then be multiplied by described preset interval time, just can obtain described packet loss apart from the time that sent repeat requests last time.
S302: described time and the Network Transmission Delays time apart from sending the repeat requests of same packet loss last time is compared.The described Network Transmission Delays time means the needed time of reciprocal transmission of carrying out a packet in network; Its computational methods can be: send network delay detection packet to packet loss transmitting terminal, calculate described packet loss transmitting terminal the feedback time of described network delay detection packet is to the described Network Transmission Delays time.Particularly, send network delay detection packet to packet loss transmitting terminal, packet loss transmitting terminal is responded network delay response packet after receiving network delay detection packet immediately, after receiving network delay response packet, calculate the time difference of receiving network delay response packet and sending network delay detection packet, this time difference is the Network Transmission Delays time now.Further, for computing network propagation delay time more exactly, can repeatedly send detection packet to packet loss transmitting terminal, computing time is poor, then the mode of averaging is carried out the computing network propagation delay time; In addition, because the network state of each period is not identical, therefore, the Network Transmission Delays time need to calculate once at set intervals.
S303: whether be greater than the described Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, if so, carry out S304, if not, carry out S305.
S304: the repeat requests that again sends this packet loss.Because now, described packet loss also do not receiving after the time surpassing Network Transmission Delays, i.e. the packet loss of this re-transmission has been lost again in Internet Transmission, and therefore, described packet loss need to send repeat requests again.
S305: the repeat requests that does not send this packet loss.Now, also do not receive the re-transmission to this packet loss, for no other reason than that the reason of network delay.In this packet loss repeat requests, just do not need so this packet loss to send repeat requests, that has avoided too much repetition sends packet loss repeat requests to packet loss transmitting terminal, thereby has reduced the waste of bandwidth, has improved the efficiency retransmitting.
The method that the packet loss that the present embodiment provides retransmits, according to calculating, apart from the time that sent repeat requests last time, screen packet loss and whether need to send repeat requests, avoid the number of times of too much transmission repeat requests, thereby reduced the waste of bandwidth, improved the efficiency of network data transmission.
In addition, in actual applications, be often that a plurality of packet losses the mode of depositing exist, when there is a plurality of packet loss in terminal, there is the form with packet loss array in described packet loss in terminal.The production process of described packet loss array is: receive after new packet, judge that whether this new packet is the packet loss retransmitting, and if so, wraps in this in packet loss array and rejects; If not, detect this packet and whether have packet loss, if there is new packet loss, new packet loss is added in packet loss array, and be 0 by mark position corresponding to packet loss.Now, the method that its packet loss retransmits is specially: as shown in Figure 4, be the method flow diagram of a kind of packet loss re-transmission shown in another embodiment of the present invention.Refer to Fig. 4, after the method that this packet loss retransmits starts,
S401: preset interval time arrives.Described preset interval time is for detect the interval time whether its packet loss needs to send repeat requests at every turn.
S402: the flag bit corresponding to packet loss carries out add-one operation.If now the value of flag bit is 0, to carry out after add-one operation, the value of this flag bit is 1; If now the value of flag bit is 1, to carry out after add-one operation, the value of this flag bit is 2.
S403: judge that whether packet loss respective flag position is 1, if so, carries out S405; If not, carry out S404.
S404: whether the packet loss of calculation flag position correspondence is greater than the Network Transmission Delays time apart from the time of repeat requests last time, if so, carries out S405; If not, finish this operation.Apart from the computational process of time that sent the repeat requests of same packet loss last time, be: after the value of flag bit is subtracted to 1, then be multiplied by described preset interval time; The computational methods of described Network Transmission Delays time are for sending network delay detection packet to transmitting terminal; Described transmitting terminal the network delay response packet sending and the time difference that sends network delay detection packet are received in calculating, and the described time difference is the Network Transmission Delays time now.
S405: the repeat requests that sends this packet loss.Because if flag bit corresponding to packet loss is 1, represent that this packet loss is a new packet loss, so need to send repeat requests; If this packet loss is greater than the Network Transmission Delays time apart from the time of repeat requests last time, represent that this packet loss surpasses Network Transmission Delays and also do not receive after the time, the packet loss that is this re-transmission has been lost again in Internet Transmission, and therefore, described packet loss need to send repeat requests.
S406: the flag bit value that packet loss is corresponding is set to 1.Be like this for convenient when next preset interval time arrives, calculate the described time apart from sending the repeat requests of same packet loss last time.
Use the method that packet loss of the present invention retransmits significantly reducing under the circumstances that retransmits bandwidth, guarantee packet loss repeat requests timely simultaneously, especially larger at network delay, in the higher situation of packet loss.Suppose that current network packet loss is 20%, the Network Packet Loss retransmitting in hypothesis is no longer lost ideally, and the bandwidth of transmitting so 1 unit just need to retransmit the extra packet loss re-transmission bandwidth of 1x20%=0.2, so total bandwidth is 1+0.2=1.2.If now network delay is 100ms, in order to guarantee low delay, the preset interval time that packet loss retransmits is set to 20ms (being the time of delay of a two field picture for the video of 50 frame/seconds), if the method for not using packet loss of the present invention to retransmit, in this 100ms, to the repeat requests of same packet loss, can send 100/20=5 time so, it is 5x0.2=1 that the extra packet loss producing retransmits bandwidth, total bandwidth is 1+1=2 like this, this bandwidth use amount 1.2 needing than above-mentioned ideal situation exceeds (2-1.2)/1.2, be about 66%, if the method for using packet loss of the present invention to retransmit, can guarantee, in 100ms, same packet loss is only sent to a repeat requests, the re-transmission bandwidth producing is like this same with the bandwidth use amount 1.2 that above-mentioned ideal situation needs, this is equivalent to than not using method of the present invention to save the bandwidth use amount of (2-1.2)/2=40%.
The method that the packet loss that the present embodiment provides retransmits, its main feature is, send selectively packet loss repeat requests, thereby reduce the number of times that sends repeat requests, transmitting terminal can repeatedly not retransmitted certain packet loss, saved bandwidth use amount, like this, the transmission of network data will be more unimpeded, quick.
The invention provides method and terminal that a kind of packet loss retransmits, time and Network Transmission Delays time that described terminal can send the repeat requests of same packet loss last time according to the distance calculating compare, if be greater than the Network Transmission Delays time apart from the time that sent the repeat requests of same packet loss last time, judge that this packet loss need to send repeat requests.Transmitting terminal can repeatedly not retransmitted this packet loss owing to repeatedly receiving the repeat requests of certain packet loss, thereby reduced the use of the network bandwidth, make the transmission of network data quicker.
Above content is in conjunction with concrete execution mode further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, can also make some simple deduction or replace, all should be considered as belonging to protection scope of the present invention.