Embodiment three
Embodiments provide a kind of transmission method of packet, in conjunction with above-described embodiment one and embodiment two
Hold, the method that the present embodiment is provided is illustrated.Referring to Fig. 3, the method flow that the present embodiment provides includes:
301:Transmitting terminal obtains at least one packet to be sent;
Specifically, the present embodiment not to obtain at least one packet to be sent mode specifically limit, including but
It is not limited to transmitting terminal according to the data in own service logical organization packet, number to be sent is determined according to practical situation simultaneously
According to the number of bag, so that it is determined that packet to be sent, and using the packet to be sent determining as the packet getting.
Further, the packet to be sent that in this step, transmitting terminal gets is the packet that this will send,
When sending packet to receiving terminal due to transmitting terminal, the number of the packet sending every time can obtain in packet to receiving terminal
Hold and the transmission of packet produces certain impact, therefore, need in operation to be determined according to practical situation and send out every time
The number of the packet to be sent sending, and then determine the number of packet to be sent that transmitting terminal gets.
For example, transmitting terminal is when determining the number of the packet to be sent sending every time, packet to be sent
Number is fewer, then receiving terminal, when obtaining the content of packet, needs the time waiting shorter, that is, the content of acquisition packet is got over
Hurry up.But if transmitting terminal determines that the number of the packet to be sent sending every time is very few, in the packet sending equal number
Under situation, the number of times sending packet can be increased, so that it is more to send the resource consuming during packet.For example, transmitting terminal
Need to send 100 packets to receiving terminal, if the packet to be sent getting every time is 10, that is, transmitting terminal is each
Send 10 packets to receiving terminal, then transmitting terminal needs the number of times sending packet to receiving terminal is 10 times;If obtained every time
The packet to be sent got be 50, that is, transmitting terminal every time to receiving terminal send 50 packets, then transmitting terminal need to
The number of times that receiving terminal sends packet is 2 times.
Therefore, in conjunction with above-mentioned 2 points, in order to obtain optimum efficiency in transmission of data packets, need according to practical situation
Determine the number of packet to be sent, and then determine the number of packet to be sent that transmitting terminal gets.
As when the packet of transmission is video data bag, in this case, receiving terminal may require video data bag and passes
Transmission quality is high, or transmission delay is little, then now every group of packet to be sent can be set to less number, to ensure to connect
Receiving end can obtain the content in each packet in time.If conversely, the specific requirement that receiving terminal is not similar to, in order to save net
Network bandwidth, then now can be set to more number by every group of packet to be sent, and the present embodiment is not to be sent to determine
The number of packet makees concrete restriction.
302:Obtain RS code redundancy(-ce);
Specifically, the present embodiment does not specifically limit to the mode obtaining RS code redundancy(-ce), and including but not limited to following three
The mode of kind:
First kind of way:Receive the redundancy confirmation that receiving terminal sends;RS code is determined according to redundancy confirmation
Redundancy, and using the redundancy of determination as the RS code redundancy(-ce) getting.
Wherein, the packet loss sum that redundancy confirmation includes but is not limited under packet loss and every kind of packet loss species accounts for always to be lost
Percentage ratio of bag number etc..Certainly, redundancy confirmation can also be other information, and the present embodiment is not especially limited to this.
RS code redundancy(-ce) can be a percentage ratio number, can be according to the calculation of redundancy packet number/raw data packets number * 100%
To calculate, certain redundancy also may indicate that other implications, and to be calculated using corresponding mode, the present embodiment is to this not yet
Make concrete restriction., before receiving the redundancy confirmation of receiving terminal transmission, redundancy confirmation can be by for transmitting terminal
It is transmitted in the way of packet according to the agreement pre-setting, the present embodiment is also not especially limited to this.No matter receiving terminal
Which kind of redundancy confirmation sent to transmitting terminal, when transmitting terminal determines RS code redundancy(-ce) according to redundancy confirmation, specifically
Implementation includes but is not limited to:Transmitting terminal inquires about, according to the redundancy confirmation receiving, the network that transmitting terminal prestores
Packet-dropping model determines RS code redundancy(-ce).
Any one in including but not limited to following three kinds of the Network Packet Loss model that this transmitting terminal prestores:
The first Network Packet Loss model:Corresponding relation between packet loss and redundancy, for example, with as shown in table 1 below be
Example;And the packet loss sum under packet loss and every kind of packet loss species accounts for the corresponding relation between the percentage ratio of total number of discarded packets, with such as
As a example shown in table 2 below.
Table 1
Packet loss |
Redundancy |
10% |
20% |
20% |
30% |
… |
… |
Table 2
Second Network Packet Loss model:Packet loss sum under every kind of packet loss species accounts for percentage ratio and the redundancy of total number of discarded packets
Between corresponding relation, taking as shown in table 3 below as a example;And the packet loss sum under every kind of packet loss species accounts for the percentage of total number of discarded packets
Than packet loss and between corresponding relation, taking as shown in table 4 below as a example.
Table 3
Table 4
The third Network Packet Loss model:Packet loss sum under every kind of packet loss species accounts for the percentage ratio of total number of discarded packets, packet loss
Corresponding relation and redundancy between, taking as shown in Table 5 below as a example.
Table 5
Wherein, the Network Packet Loss model that transmitting terminal prestores rule of thumb can be configured by relevant staff, also
Losing under packet loss and every kind of packet loss species in this time can be sent from receiving terminal at set intervals to transmitting terminal
Bag sum accounts for the percentage ratio of total number of discarded packets, and transmitting terminal is according to the related data receiving and statistical relative theory according to pre-
Imputation method carries out planning as a whole to calculate, after accumulation after a while, you can sum up the corresponding every kind of packet loss kind of different packet loss rate
Packet loss sum under class accounts for the percentage ratio of total number of discarded packets, determines corresponding RS code redundancy(-ce) according to certain algorithm afterwards, thus building
Found above-mentioned three kinds of Network Packet Loss models, locally stored simultaneously.Certainly, Network Packet Loss model can also be using other methods
Set up, the present embodiment is not especially limited to this.Further, can also be locally stored Network Packet Loss model setting
One update cycle, so that transmitting terminal is updated to locally stored Network Packet Loss model in the manner described above, the present embodiment
This is also not especially limited.
In order to make it easy to understand, the present embodiment combines practical situation, to according to above two redundancy confirmation respectively really
The method determining RS code redundancy(-ce) makees explanation explained in detail, and concrete explaination is as follows:
Method one:Receiving terminal sends packet loss to transmitting terminal, and transmitting terminal is according to packet loss and the Network Packet Loss that prestores
Model determines RS code redundancy(-ce).
Wherein, the packet loss that receiving terminal sends can be that receiving terminal determines according to the packet collected, when being embodied as
When, receiving terminal can first determine the number of packet that should receive in a period of time, then determine loss packet individual
Number, using the number of the packet of loss divided by the packet that should receive the percentage ratio that obtains of number as this period
Packet loss.For example, transmitting terminal is ready for sending the packet that numbering is 1~100 to receiving terminal, and the information that simultaneously sends informs receiving terminal
Specifically have sent 100 packets, that is, the number of receiving terminal the packet that should receive is 100, and receiving terminal is actual connects
Have received 80 packets, then receiving terminal can determine that and lost 20 packets, the packet loss obtaining is 20/100*100%
=20%.Certainly, receiving terminal can also determine packet loss using alternate manner, and the present embodiment is not especially limited to this.
Further, receiving terminal sends the packet loss of determination to transmitting terminal, the network being prestored according to transmitting terminal
The difference of packet-dropping model, transmitting terminal determines that the mode of redundancy can be specifically divided into several situations as follows:
The first situation:If the Network Packet Loss model that transmitting terminal prestores is the first Network Packet Loss model above-mentioned,
After then transmitting terminal receives the packet loss of receiving terminal transmission, directly can inquire about the prestoring according to the packet loss that receives
A kind of Network Packet Loss model can get corresponding RS code redundancy(-ce).
For example, the packet loss that transmitting terminal receives receiving terminal transmission is 10%, and now transmitting terminal is looked into according to packet loss 10%
Ask the first Network Packet Loss model of prestoring, referring to table 1, when packet loss is 10% it may be determined that corresponding RS code redundancy
Spend for 20%.
Second situation:If the Network Packet Loss model that transmitting terminal prestores is above-mentioned second Network Packet Loss model,
After then transmitting terminal receives the packet loss of receiving terminal transmission, packet loss is first passed through according to above-mentioned second Network Packet Loss model true
Packet loss sum under fixed corresponding every kind of packet loss species accounts for the percentage ratio of total number of discarded packets, then by the packet loss under every kind of packet loss species
The percentage ratio that sum accounts for total number of discarded packets determines corresponding RS code redundancy(-ce).
Wherein, packet loss species including but not limited to loses the situation of a bag and the situation of continual data package dropout, wherein, continual data package dropout
Refer to the phenomenon that packet consecutive numbers packet loss in transmitting procedure, the different packet loss species of different packet loss quantity correspondences.
For example, transmitting terminal is ready for sending 100 packets to receiving terminal, 100 packets is numbered, respectively 1~100, and
100 packets are sent to receiving terminal.These packets are in network transmission it may happen that the phenomenon of packet loss.For example, with
As a example packet loss species is the situation continuously losing 2 packets, receiving terminal have received packet 1, packet 4, but does not connect
Receive packet 2 data bag 3.Of course, it is also possible to there be the species of other packet losses, such as continuously lose the situation of 3 packets, herein
Repeat no more.
For example, the packet loss that transmitting terminal receives receiving terminal transmission is 10%, and now transmitting terminal is according to above-mentioned second net
Network packet-dropping model first passes through packet loss and determines that the packet loss sum under corresponding every kind of packet loss species accounts for the percentage ratio of total number of discarded packets, ginseng
It is shown in Table 4, when packet loss is 10% it may be determined that the packet loss sum under corresponding every kind of packet loss species accounts for the percentage ratio of total number of discarded packets
For as shown in table 6 below:
Table 6
Wherein, packet loss species 1 represents the packet loss species losing 1 packet, and packet loss species 2 represents continuously loses 2 packets
Packet loss species, packet loss species 3 represents the packet loss species continuously losing 3 packets, and packet loss species 4 represents continuously loses more than 3
The packet loss species of packet.
After packet loss sum under determining every kind of packet loss species accounts for the percentage ratio of total number of discarded packets, can be according to every kind of packet loss species
Under packet loss sum account for the percentage ratio of total number of discarded packets and determine redundancy, referring to table 3, when the packet loss sum under every kind of packet loss species accounts for
It may be determined that corresponding RS code redundancy(-ce) is 20% when the percentage ratio of total number of discarded packets is as shown in table 6.
The third situation:If the Network Packet Loss model that transmitting terminal prestores is the third Network Packet Loss model above-mentioned,
After then transmitting terminal receives the packet loss of receiving terminal transmission, can be blunt by packet loss according to the third Network Packet Loss model above-mentioned
Connect the corresponding redundancy of determination.
For example, the packet loss that transmitting terminal receives receiving terminal transmission is 10%, and now transmitting terminal is looked into according to packet loss 10%
Ask the third Network Packet Loss model of prestoring, referring to table 5, when packet loss is 10% it may be determined that corresponding RS code redundancy
Spend for 20%.
Method two:The packet loss sum that receiving terminal sends under every kind of packet loss species to transmitting terminal accounts for the percentage ratio of total number of discarded packets,
The Network Packet Loss model that transmitting terminal when prestores according to the percentage that the packet loss sum under every kind of packet loss species accounts for total number of discarded packets
Determine RS code redundancy(-ce).
In order to make it easy to understand, solving to the implication of the percentage ratio that the packet loss sum under every kind of packet loss species accounts for total number of discarded packets
Release explanation:
For example, when the total data bag number that receiving terminal should receive is 1200, can lose in transmitting procedure
The quantity of packet is 120, that is, determine that total number of discarded packets is 120.In the packet of this 120 loss, if continuously losing 2
The packet loss sum of packet is 24, then now under the packet loss species continuously losing 2 packets, packet loss sum accounts for total number of discarded packets
Percentage ratio be 24/120*100%=20%.In the same manner, if the packet loss sum losing 1 packet is 72, now losing 1
The percentage ratio that packet loss sum under the packet loss species of packet accounts for total number of discarded packets is 60%.If continuously losing the packet loss of 3 packets
Sum is 12, then the percentage ratio that now the packet loss sum under the packet loss species continuously losing 3 packets accounts for total number of discarded packets is
12/120*100%=10%.Finally it is left a kind of situation for continuously losing 3 data above bags, now can determine that and continuously losing
Packet loss sum under the packet loss species of 3 data above bags account for total number of discarded packets percentage ratio be (1-20%-60%-10%)=
10%.
Further, the percentage ratio that the packet loss sum under every kind of packet loss species that receiving terminal will determine accounts for total number of discarded packets sends
To transmitting terminal, the difference of the Network Packet Loss model being prestored according to transmitting terminal, transmitting terminal determines that the mode of redundancy also may be used
It is specifically divided into several situations as follows:
The first situation:If the Network Packet Loss model that transmitting terminal prestores is the first Network Packet Loss model above-mentioned,
After the packet loss sum that then transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage ratio of total number of discarded packets, according to
The packet loss sum that the first Network Packet Loss model above-mentioned first passes through under every kind of packet loss species account for total number of discarded packets percentage ratio determine right
The packet loss answered, more corresponding RS code redundancy(-ce) is determined by packet loss.
For example, the packet loss sum that transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage of total number of discarded packets
Ratio is as shown in table 6, and the packet loss that now transmitting terminal first passes through under every kind of packet loss species according to the first Network Packet Loss model above-mentioned is total
The percentage ratio that number accounts for total number of discarded packets determines corresponding packet loss, referring to table 2, always loses when the packet loss sum under every kind of packet loss species accounts for
It may be determined that corresponding packet loss is 10% when the percentage ratio of bag number is as shown in table 6.
After determining packet loss, redundancy can be determined according to packet loss, referring to table 1, when packet loss is 10% it may be determined that
Corresponding RS code redundancy(-ce) is 20%.
Second situation:If the Network Packet Loss model that transmitting terminal prestores is above-mentioned second Network Packet Loss model,
After the packet loss sum that then transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage ratio of total number of discarded packets, can root
Directly determine corresponding RS code redundancy(-ce) according to above-mentioned second Network Packet Loss model.
For example, the packet loss sum that transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage of total number of discarded packets
Ratio is as shown in table 6, and now transmitting terminal is inquired about in advance according to the percentage ratio that the packet loss sum under every kind of packet loss species accounts for total number of discarded packets
The second Network Packet Loss model of storage, referring to table 3, when the packet loss sum under every kind of packet loss species accounts for the percentage ratio of total number of discarded packets
It may be determined that corresponding RS code redundancy(-ce) is 20% when as shown in table 6.
The third situation:If the Network Packet Loss model that transmitting terminal prestores is the third Network Packet Loss model above-mentioned,
After the packet loss sum that then transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage ratio of total number of discarded packets, according to
The third Network Packet Loss model above-mentioned can by the packet loss sum under every kind of packet loss species account for total number of discarded packets percentage ratio directly true
Fixed corresponding RS code redundancy(-ce).
For example, the packet loss sum that transmitting terminal receives under every kind of packet loss species of receiving terminal transmission accounts for the percentage of total number of discarded packets
Ratio is as shown in table 6, and now transmitting terminal is looked into according to the percentage ratio that the packet loss sum under packet loss every kind of packet loss species accounts for total number of discarded packets
Ask the third Network Packet Loss model prestoring, referring to table 5, when the packet loss sum under every kind of packet loss species accounts for total number of discarded packets
It may be determined that corresponding RS code redundancy(-ce) is 20% when percentage ratio is as shown in table 6.
The second way:Retrieve locally stored RS code redundancy(-ce), and using the RS retrieving code redundancy(-ce) as getting
RS code redundancy(-ce), the redundancy confirmation that the receiving terminal receiving before retrieving according to RS code redundancy(-ce) sends calculates
And store.
Because network has relative stability in the short period of time, that is, send packet when redundancy packet number
Without being changed within a period of time, corresponding redundancy is not need to change.Therefore, transmitting terminal is getting RS
After code redundancy(-ce), RS code redundancy(-ce) locally can stored.When needing to send packet, retrieve locally stored RS
Code redundancy(-ce), and using the RS retrieving code redundancy(-ce) as the RS code redundancy(-ce) getting.Wherein, obtain RS code redundancy(-ce) can press
The method providing according to above-mentioned first kind of way to execute, and the present embodiment is not especially limited to this.
Further although network environment change in a short period of time less, but through after a period of time, network environment
It may happen that larger change, therefore, it can, while locally stored RS code redundancy(-ce), be provided with for this RS code redundancy(-ce)
In the effect time limit, send every time packet when obtaining locally stored RS code redundancy(-ce) it can be determined that this RS code redundancy(-ce) whether mistake
Phase, if not out of date, using the locally stored RS code redundancy(-ce) getting as the RS code redundancy(-ce) determining, if expired,
Now can reacquire, and locally stored RS code redundancy(-ce) and relevant information are updated, the present embodiment is not made to this
Concrete restriction.
For example, before locally stored acquisition RS code redundancy(-ce) the concrete time be 10 points 30 minutes, arrange RS code redundancy
The expiry date of degree is 3 minutes.When send packet when, if now the time be 10 points 32 minutes, can determine that RS code redundancy(-ce)
Not out of date, the locally stored RS code redundancy(-ce) of direct access.If current time be 10 points 34 minutes, can determine that RS code redundancy
Degree is expired, now needs to reacquire RS code redundancy(-ce), and to locally stored RS code redundancy(-ce) and acquisition RS code redundancy
The concrete time of degree is updated.
The third mode:RS code redundancy(-ce) is determined according to RS model;
Receiving terminal, after determining RS model, RS model is sent to transmitting terminal, transmitting terminal is according to the RS model receiving
Determine RS code redundancy(-ce).The present embodiment does not make concrete restriction, including but not limited to the content of RS model:RS model with RS (N,
K) such form is given, and wherein N represents the total number of the packet after packet is encoded, and K represents packet in coding
The total number of front packet, numerical value (N-K) is the number of redundant data packets, and RS code redundancy(-ce) is (N-K)/K*100%.
The present embodiment does not determine to receiving terminal that the mode of RS model specifically limits, including but not limited to:Receiving terminal according to
Said method is inquired about Network Packet Loss model by redundancy confirmation and is determined RS model, and wherein, concrete implementation mode can
So that with reference to above-mentioned steps, here is omitted.
303:RS code redundancy(-ce) according to getting determines the number of redundancy packet;
Specifically, from above-mentioned steps, the computational methods of RS code redundancy(-ce) are redundancy packet number/raw data packets
Number * 100%, therefore, when the number determining raw data packets number and can determine that redundancy packet.
For example, RS code redundancy(-ce) is 66.67%, and when the number of raw data packets is 3, the calculating according to redundancy is public
Formula is Converse solved it may be determined that the number of redundancy packet is 2.
304:Number according to redundancy packet and the number of packet to be sent, according to RS algorithm to sent packet
Encoded, the packet after being encoded;
Specifically, after determining the number of redundancy packet and the number of packet to be sent, according to RS algorithm to pending
The packet sending is encoded, you can the packet after being encoded.It should be noted that the quantity of the packet after coding is
The number sum of the number of redundancy packet and packet to be sent.
Wherein, the present embodiment does not make concrete limit to according to RS algorithm to sent the coded system that packet is encoded
Fixed.In order to make it easy to understand, the present embodiment is lifted with reference to the concrete situation of the present embodiment with the feasible coded system of one of which
Example explanation, certainly in practical operation, may also take on other coded systems, and the coded system that this illustrates specifically is explained
As follows:
Transmitting terminal has got 3 packets to be sent, respectively packet 1, packet 2, packet 3, gets
RS code redundancy(-ce) be 66.67%, from the calculating process in above-mentioned steps, now the number of redundancy packet is 2.In order to just
In explanation, three data, three numbers of packet 1 storage are included with the information of each packet storage in three packets
According to for (x1, y1, z1), three data of packet 2 storage are (x2, y2, z2), three data of packet 3 storage are (x3, y3,
z3) as a example.A data in three packets is taken out row vector a that one a line three of composition arranges1For (x1, x2, x3), will
Second data takes out one row vector a of composition2For (y1, y1, y3), the 3rd data is taken out one row vector a of composition3For
(z1, z2, z3).
Determine a matrix A, the line number of this matrix A is numerically equal to the number of packet to be sent, as 3, this matrix A
Columns be numerically equal to the number of packet to be sent and the number of redundancy packet, as 5.Meanwhile, the row of this matrix A and row
Between linear independence, such as this matrix A can use generalized circular matrix.Certainly, other matrixes, the present embodiment can also be had been set to as needed
This is not especially limited, illustrates below taking generalized circular matrix A as a example:
By above-mentioned vector a1, a2, a3Do multiplication with matrix A respectively, can get the row vector of three a line five row, respectively
Row vector b1=(x '1, x '2, x '3, x '4, x '5), row vector b2=(y '1, y '2, y '3, y '4, y '5), row vector b3=(z '1, z
′2, z '3, z '4, z '5) by three row vectors first take out respectively, you can building up one with group has after three digital codings
Three row vector second data are taken out by packet in the same manner respectively, also can be after group builds up a coding having three data
Packet.The packet after five new codings, respectively packet 1 (x ' finally can be obtained in the manner described above1, y '1,
z′1), packet 2 (x '2, y '2, z '2), packet 3 (x '3, y '3, z '3), packet 4 (x '4, y '4, z '4), packet 5 (x '5,
y′5, z '5).
305:Packet after coding is sent to receiving terminal.
Specifically, after transmitting terminal is encoded to sent packet, by network, the packet after encoding is sent
To receiving terminal, the present embodiment does not make concrete restriction to the sending method sending during packet.
306:Packet after the coding that receiving terminal receiving end/sending end sends, and to the packet after coding according to RS algorithm
It is decoded, obtain decoded packet.
The present embodiment does not specifically limit according to the mode that RS algorithm is decoded to data bag to receiving terminal, for the ease of
Understand, the present embodiment explains with reference to the mode of above-mentioned coding.Certainly, in practical operation, may also take on other
Decoding process, the concrete explaination of the decoding process that this illustrates is as follows:
Receiving terminal receives the packet after coding, respectively packet 1 (x '1, y '1, z '1), packet 2 (x '2, y '2,
z′2), packet 3 (x '3, y '3, z '3), packet 4 (x '4, y '4, z '4), packet 5 (x '5, y '5, z '5).Thus can get three
Individual ternary linear function group:
Wherein, each equation group has 5 equations, from the step of upper face code, because matrix A is linearly uncorrelated, because
5 equations in this each equation group are appointed and take 3 equations can solve, and solution of equations solution out is respectively:(x1, x2, x3),
(y1, y1, y3), (z1, z2, z3).By first taking-up of three solutions, raw data packets 1 (x can be formed1, y1, z1), second takes
Go out to form raw data packets 2 (x2, y2, z2), the 3rd taking-up can form raw data packets 3 (x3, y3, z3), i.e. packet quilt
It is successfully decoded.
Being appointed due to 5 equations in each equation group above-mentioned takes 3 equations can solve, corresponding, the packet after coding
After arbitrarily losing two packets, in three equation group, each equation group also remains 3 equations just, therefore, when the data lost
When bag is less than or equal to 2, original packet still can be decoded out.
Further, in order that transmitting terminal can determine RS code redundancy(-ce), receiving terminal sends at least in receiving end/sending end
Before packet after one coding, also include:
Redundancy confirmation is determined according to the packet after the coding receiving before;
The redundancy confirmation of determination is sent to transmitting terminal, makes transmitting terminal obtain RS code according to redundancy confirmation
Redundancy.
Wherein, determine that the mode of redundancy confirmation refers to according to the packet after the coding receiving before above-mentioned
Step, here is omitted.
The method that the present embodiment provides, the packet due to receiving is that transmitting terminal is true according to the RS code redundancy(-ce) getting
Determine the number of redundancy packet, the number of the number according to redundancy packet and packet to be sent is entered to sent packet by RS algorithm
Row coding obtains, and therefore, if packet occurs in that the phenomenon of packet loss in transmitting procedure, is sent according to the transmitting terminal receiving
Arbitrary data bag in packet can recover packet loss data, and the delay not only recovering packet loss is shorter, and recovery capability is stronger, makes
The reliability obtaining during packet transmission is higher.