CN107612841A - A kind of method, apparatus and computer equipment for transmitting data - Google Patents

A kind of method, apparatus and computer equipment for transmitting data Download PDF

Info

Publication number
CN107612841A
CN107612841A CN201710717945.9A CN201710717945A CN107612841A CN 107612841 A CN107612841 A CN 107612841A CN 201710717945 A CN201710717945 A CN 201710717945A CN 107612841 A CN107612841 A CN 107612841A
Authority
CN
China
Prior art keywords
packet
data bag
data
sheet data
interactive
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710717945.9A
Other languages
Chinese (zh)
Inventor
杨亮
陈少杰
张文明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710717945.9A priority Critical patent/CN107612841A/en
Publication of CN107612841A publication Critical patent/CN107612841A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a kind of method, apparatus and computer equipment for transmitting live data, method includes:From interactive direct broadcasting room is loaded onto between current live, living broadcast interactive packet is gathered in the interactive direct broadcasting room;Judge packet size whether beyond MTU MTU capability value;If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, forms each sheet data bag;Utilize each sheet data bag described in UDP UDP sequential deliveries;In this way, when carrying out interactive during live, during because transmitting data by udp protocol, without receiving terminal can be sent data to by the forwarding of direct broadcast server, that is just do not connected between user and server, you can data transfer is realized, so as to reduce data delay;And when transmitting data, without the affirmation mechanism for carrying out packet, data delay time is reduce further, and then meets the interactive demand of instantaneity.

Description

A kind of method, apparatus and computer equipment for transmitting data
Technical field
The invention belongs to direct seeding technique field, more particularly to a kind of method, apparatus and computer equipment for transmitting data.
Background technology
With comprehensive rise of live industry, live communication mode is also increasingly welcomed by the general public, more and more Live content also add to main broadcaster's industry.
In current existing live software, it is to push to direct broadcast server after the live content of main broadcaster is encoded, sees Many live contents that main broadcaster is pulled by being connected to direct broadcast server watch live function so as to realize.Main broadcaster during this It is required for being connected to direct broadcast server with spectators, direct broadcast server carries out live content point equivalent to one between spectators and main broadcaster The bridge enjoyed, but be exactly the shortcomings that such a scheme postpone it is bigger, it is this if to carry out the real-time interactive of main broadcaster and spectators Postpone necessarily satisfying for the interactive demand of not instantaneity.
The content of the invention
The problem of existing for prior art, the embodiments of the invention provide a kind of method, apparatus and meter for transmitting data Machine equipment is calculated, for solving in the prior art in the interaction of live process, due to larger late in transmission data delay, it is impossible to full The technical problem of sufficient instantaneity interactive demand.
The present invention provides a kind of method for transmitting data, and methods described includes:
From being loaded onto interactive direct broadcasting room between current live;
Living broadcast interactive packet is gathered in the interactive direct broadcasting room;
Judge the size of packet whether beyond MTU (MTU, Maximum Transmission Unit) Capability value;
If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, forms each Packet;
Utilize each sheet data bag described in UDP (UDP, User Datagram Protocol) sequential delivery.
It is described from being loaded onto interactive direct broadcasting room between current live in such scheme, including:
Login identification (ID, Identity) and the main broadcaster for obtaining user are current just in live live room ID;
According to the login identification ID and live room ID by the straight of the interactive data of the user and the main broadcaster Multicast data is loaded onto in the interactive direct broadcasting room.
It is described that burst is carried out to the packet in such scheme, after forming each sheet data bag, in addition to:
The integer vernier value sended of current slice packet is obtained, the current slice packet is in each sheet data bag Any piece of data bag;
Judging the integer vernier value sended and default transmission station location marker of the current slice packet initial value is It is no consistent;
If the integer vernier value sended of the current slice packet is consistent with the initial value of default transmission station location marker, It is then starting sheet packet using current slice packet described in the first mark code labeling.
It is described that burst is carried out to the packet in such scheme, after forming each sheet data bag, in addition to:
The integer vernier value sended of the current slice packet and sizes values sizeToSend of current sheet data is obtained, it is described Current slice packet is any piece of data bag in each sheet data bag;
If the sended+sizeToSend=packetSize, current slice number described in the second mark code labeling is utilized It is end sheet data bag according to bag;Wherein, the packetSize is the sizes values of the current slice packet.
In such scheme, described in the utilization UDP UDP sequential deliveries during each sheet data bag, including:
According to the transmission order of each sheet data bag, index value is added to each sheet data bag successively;The index Value according to default incremental spacing from default initial index value sequentially.
The present invention also provide it is a kind of transmit data device, applied to the barrage it is live in, described device includes:
Loading unit, for from being loaded onto interactive direct broadcasting room between current live;
Collecting unit, for gathering living broadcast interactive packet in the interactive direct broadcasting room;
First judging unit, for judge the packet size whether beyond MTU MTU capacity Value;
Sharding unit, in the case of in the size of each packet beyond the capability value of the MTU, then to described Packet carries out burst, forms each sheet data bag;
Transmission unit, for utilizing each sheet data bag described in UDP UDP sequential deliveries.
In such scheme, the loading unit includes:
First acquisition unit, the login identification ID and main broadcaster for obtaining user are current just in live live room ID;
Loading unit, for according to the login identification ID and live room ID by the interactive data of the user and The live data of the main broadcaster is loaded onto in the interactive direct broadcasting room.
In such scheme, described device also includes:
Second acquisition unit, for obtaining the integer vernier value sended of current slice packet, the current slice packet For any piece of data bag in each sheet data bag;
Second judging unit, for the integer vernier value sended for judging the current slice packet and default transmission position Whether the initial value for putting mark is consistent;
Indexing unit, for the integer vernier value sended in the current slice packet and default transmission station location marker Initial value it is consistent in the case of, utilize the current slice packet starting sheet packet that is described in the first mark code labeling.
The present invention also provides a kind of computer-readable recording medium, is stored thereon with computer program, the program is processed Device realizes following steps when performing:
From being loaded onto interactive direct broadcasting room between current live;
Living broadcast interactive packet is gathered in the interactive direct broadcasting room;
Judge the packet size whether beyond MTU MTU capability value;
If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, forms each Packet;
Utilize each sheet data bag described in UDP UDP sequential deliveries.
The present invention also provides a kind of computer equipment for transmitting data, including:
At least one processor;And
At least one memory being connected with the processor communication, wherein,
The memory storage has and by the programmed instruction of the computing device, the processor described program can be called to refer to Order is able to carry out any described method as described above.
The invention provides it is a kind of transmit data method, apparatus and computer equipment, applied to barrage it is live in, it is described Method includes:From being loaded onto interactive direct broadcasting room between current live;Living broadcast interactive packet is gathered in the interactive direct broadcasting room;Institute Interactive direct broadcasting room is stated to be different from currently just in live direct broadcasting room;Judge the size of the packet whether beyond maximum transmitted Unit MTU capability value;If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, Form each sheet data bag;Utilize each sheet data bag described in UDP UDP sequential deliveries;In this way, during live When carrying out interactive, because by udp protocol transmit data when, can send data to and connect without the forwarding by direct broadcast server Receiving end, that is to say, that just do not connected between user and server, you can data transfer is realized, so as to reduce data delay; And when transmitting data, without the affirmation mechanism for carrying out packet, data delay time is reduce further, and then meet The interactive demand of instantaneity.
Brief description of the drawings
Fig. 1 is the method flow schematic diagram for the transmission data that the embodiment of the present invention one provides;
Fig. 2 is the apparatus structure schematic diagram for the transmission data that the embodiment of the present invention two provides;
Fig. 3 is the overall structure diagram for the loading unit that the embodiment of the present invention two provides;
Fig. 4 is the computer equipment overall structure diagram for the transmission data that the embodiment of the present invention three provides.
Embodiment
In order to solve in the prior art in the interaction of the live process of barrage, due to larger late in transmission data delay, no The technical problem of instantaneity interactive demand can be met, the invention provides a kind of method, apparatus for transmitting data and computer to set Standby, methods described includes:From being loaded onto interactive direct broadcasting room between current live;Living broadcast interactive number is gathered in the interactive direct broadcasting room According to bag;Judge packet size whether beyond MTU MTU capability value;If the size of the packet exceeds The capability value of the MTU, then burst is carried out to the packet, form each sheet data bag;It is suitable using UDP UDP Sequence transmits each sheet data bag.
Technical scheme is described in further detail below by drawings and the specific embodiments.
Embodiment one
The invention provides it is a kind of transmit data method, applied to barrage it is live in, methods described includes:
S101, from interactive direct broadcasting room is loaded onto between current live, living broadcast interactive data are gathered in the interactive direct broadcasting room Bag;
In this step, when wanting to carry out interactive with main broadcaster between current live because of user, it is necessary to carry out even wheat with main broadcaster, use Family need to main broadcaster send even wheat request, main broadcaster have received this connect wheat request after, main broadcaster and user will then enter same interaction In direct broadcasting room, the dynamic direct broadcasting room is to connect wheat room.
Specifically, based on the even wheat request, by the loading built-in function for calling Windows operating system LoadLibrary, using douyuInterActive.dll as the parameter for connecting wheat service module so that wheat service module will be connected DouyuInterActive is loaded onto in even wheat server.Company's wheat server in the present embodiment can be live companion.
Then the establishment interaction interface Service Instance function that even wheat service module provides is called CreateInteractiveSdkInstance, to create an interactive even wheat service module interface IDouyuInterActiveSdk。
Login identification ID and the main broadcaster for finally obtaining user are current just in live live room ID;Based on interaction even wheat clothes It is engaged in module interface, according to the login identification ID and live room ID by the interactive data of the user and the main broadcaster Live data is loaded onto in the interactive direct broadcasting room, and living broadcast interactive packet is gathered respectively in the interactive direct broadcasting room.It is described Living broadcast interactive data include:The interactive data of the interactive data of user, the live data of main broadcaster and main broadcaster, these data can be Video data and voice data, the living broadcast interactive data include multiple packets.
S102, judge the packet size whether beyond MTU MTU capability value;If the data The size of bag exceeds the capability value of the MTU, then carries out burst to the packet, form each sheet data bag;
In this step because when being carried out data transmission using udp protocol, the UDP message headers of live data transmission be In network hierarchy model, UDP is in transport layer, and its lower floor is IP network layer, to data transfer to during IP network layer, it is necessary to judge The size of packet whether beyond MTU MTU capability value;If the size of the packet is beyond the MTU's Capability value, then burst is carried out to the packet on the basis of MTU capability value, form each sheet data bag.Wherein, the MTU Capability value be 576 bytes.
During appearing in each sheet data bag of transmission, because certain reason causes some sheet data bag to be lost Lose, or in receiving terminal, because receiving the reasons such as buffering area is full, cause each sheet data bag to be dropped in receiving terminal, then will Cause whole big packet imperfect, so as in the Internet of receiving terminal by the situation of whole data packet discarding, it is described to institute State packet and carry out burst, after forming each sheet data bag, in addition to:
The integer vernier value sended of current slice packet is obtained, the current slice packet is in each sheet data bag Any piece of data bag;Judge the integer vernier value sended of the current slice packet and default transmission station location marker Whether initial value is consistent;If the integer vernier value sended of the current slice packet is initial with default transmission station location marker Value is consistent, then is starting sheet packet using current sheet data described in the first mark code labeling.
Obtain the integer vernier value sended of the current slice packet and sizes values sizeToSend of current slice packet, institute Current slice packet is stated as any piece of data in each sheet data bag;If the sended+sizeToSend= PacketSize, then it is end sheet data bag using current slice packet described in the second mark code labeling;Wherein, it is described PacketSize is the sizes values of the current slice packet.
In the present embodiment, the default initial value for sending station location marker is 0, and first identification code is the lowest order of byte Bof, the second identification code are the second bit eof of the byte;That is, when integer vernier value sended is 0, expression is current Sheet data bag is starting sheet packet, then with regard to bof be 1.
As sended+sizeToSend=packetSize, current slice packet is represented to terminate sheet data bag, then It is 1 with regard to eof.
If current sheet data is unsatisfactory for above-mentioned two situations, eof and bof are 1, and it is middle to represent current sheet data Sheet data bag.In general, when the sizes values of packet are less than MTU capability value, it is 1 feelings that eof and bof, which just occurs, Condition.
Thus starting sheet packet, intermediate packet and sheet data bag progress clearly differentiation can be terminated.
S103, utilize each sheet data bag described in UDP UDP sequential deliveries;
After forming each sheet data bag, each sheet data bag described in UDP UDP sequential deliveries is utilized.
When here, because being carried out data transmission using udp protocol, it is possible that out of order situation, than the sheet data of transmission Bag is 1,2,3;And the sheet data bag that receiving terminal receives is probably 1,3,2;So in order to occur it is out of order in the case of, receive End correctly can be also combined to packet, it is necessary to add index value to each sheet data bag.
Specifically according to the transmission order of each sheet data bag, index value is added to each sheet data bag successively;Institute Index value is stated according to default incremental spacing from default initial index value to be incremented by.For example initial index value is 0, incremental spacing For 1 when, then when sending first sheet data bag, the index value of first sheet data bag is just 0;The rope of second sheet data bag It is 1 to draw value, the like.Receiving terminal is after these sheet data bags are received, can also be according to rope even if there is out of order situation Draw value each sheet data bag is carried out being correctly ordered combination.
When transmitting current slice packet, whether had time in the data window queue m_udpWindow for judging to pre-establish Not busy data window, if the idle data window be present, transmit current slice packet, and by the current slice packet Preserve into the data window of free time.If in the absence of the idle data window, by current slice data pack buffer pending Send in data queue.The current slice packet is any piece of data bag in each sheet data bag.
In the present embodiment, the data window queue includes multiple data windows, and the idle data window can also Referred to as currently there are the data window or sliding window of capacity.The capacity of the default data window queue is 255 bytes, That is the total capacity of the idle data window is 255 bytes.
Further, after current slice packet is transmitted, in addition to:Create timer;The time of the timer can be with Preset, the time of timer is 1s in the present embodiment;The current slice packet is stored to the data window queue In;After receiving terminal receives current slice packet, obtain the index value of the current slice packet, and based on the index value to Transmitting terminal returns to the confirmation of the current slice packet, and the confirmation includes:ACK confirms bag.
Transmitting terminal judges the confirmation of receiving terminal return whether is received in default timing, if receiving institute Confirmation is stated, then the current slice packet is deleted in the data window queue, and delete the timer.If do not connect The confirmation is received, in addition to:Continue to transmit the current slice packet, and by the weight of the current slice data packet header Open position is arranged to retransmit ident value, and the re-transmission ident value could be arranged to 1, and reset the timer.Thus can root Packet loss phenomenon is avoided the occurrence of according to affirmation mechanism and retransmission mechanism.
So correspondingly, receiving terminal obtains data window team when it is 1 current slice packet to receive re-transmission ident value Minimum index value in row, judges whether the index value of the current slice packet is more than minimum index value, if being more than, then it represents that Current data packet is to need packet to be processed;If it is less than, then it represents that the current slice packet is the packet for repeating transmission (having received before), then directly abandon the current slice packet.
In addition, in order that transmission rate can be controlled by obtaining transmitting terminal, when transmitting terminal receives the confirmation letter of receiving terminal return After breath, the index value of current slice packet is obtained according to confirmation, based on the index value in the data window queue The current slice packet is deleted, so that the data window that current slice packet takes is in idle condition, thus may be used To transmit lower piece of data bag, after transmitting lower piece of data bag, and lower piece of data bag is stored into the data window.It is this By way of adding to data window queue m_udpWindow or removing sheet data bag so that data window queue m_ States of the udpWindow all the time in dynamic adjustment, when the network condition of receiving terminal is fine, immediately returns to confirmation, from And data window would not be occupied full, transmission of the transmitting terminal with regard to supported progress data;But if the network condition of receiving terminal Bad, the return of confirmation will be slow, so that the data window of transmitting terminal may be occupied full, so as to cause to send End stops the transmission of data.It can so avoid connecing by the transmission rate regulation of transmitting terminal to the maximum network speed of receiving terminal There is the phenomenon of process collapse in receiving end.
Further, after by all sheet data bag end of transmissions, when receiving terminal receives each sheet data bag, root first According to the index value of each sheet data bag, each sheet data bag is ranked up according to the order from small arrival, and each sheet data bag is protected PacketList queues are stored to, so as to ensure the succession of whole packet.
Then the bof values of first sheet data bag are obtained, judge whether the bof values are 1, if the bof values are 1, It is starting sheet packet to determine first sheet data bag.
Equally, the eof values of first sheet data bag are obtained, judge whether the eof values are 1, if the eof values are 1, It is also end sheet data to determine first sheet data bag.So then illustrate that first sheet data bag is complete packet, by the One sheet data bag removes from packetList queues.
Conversely, when if eof values are not 1, continue to search the sheet data bag that eof values are 1 in packetList queue sequences, look into After finding the sheet data bag that eof values are 1, then using the sheet data bag as end sheet data bag, then a complete UDP message Bag just includes:First sheet data unwraps all sheet data bags to begin untill the sheet data bag.It should be noted that:From first The index value that individual sheet data unwraps all sheet data bags to begin untill the sheet data bag is that consecutive order increases certainly.If from The index value that one sheet data unwraps all sheet data bags to begin untill the sheet data bag is not that continuous order increases certainly, then This UDP message bag is also incomplete.
For example the index value that the index value of first sheet data bag is the sheet data bag that 0, eof values are 1 is 5, then if Should be included by unwrapping all sheet data bags of the beginning untill the sheet data bag from first sheet data by three, these three sheet data bags Index value should be respectively 2,3,4, the UDP message bag so eventually formed is exactly complete packet.
But if the index value of these three sheet data bags is respectively 2,3,6, that UDP message bag eventually formed is not just Complete packet.
So, receiving terminal is just completed to live data restructuring, and the decoding of audio frequency and video can be carried out to live data and is broadcast Put.Compared with prior art, the time delay of this transmission method is reduced to 1~2s from 10s, and meeting the interactive of instantaneity needs Ask.
Embodiment two
Corresponding to embodiment one, the present embodiment provides a kind of device for transmitting data, as shown in Fig. 2 described device includes: Loading unit 21, collecting unit 22, the first judging unit 23, sharding unit 24 and transmission unit 25;Wherein,
In this step, when wanting to carry out interactive with main broadcaster because of user, it is necessary to which carrying out even wheat, user with main broadcaster needs to main broadcaster The wheat request of the company of transmission, main broadcaster have received after this connects wheat request, and main broadcaster and user will then enter in same interactive direct broadcasting room, described It can be Lian Maifang that interactive direct broadcasting room, which is different from the current interactive direct broadcasting room just in live direct broadcasting room, the present embodiment of main broadcaster, Between.
Specifically, include referring to Fig. 3, the loading unit 21:First acquisition unit 31 and loading subelement 32, it is described to add Subelements 32 are based on the even wheat request, will by calling the loading built-in function LoadLibrary of Windows operating system DouyuInterActive.dll is as the parameter for connecting wheat service module so as to will connect wheat service module douyuInterActive In the company's of being loaded onto wheat server.Company's wheat server in the present embodiment can be live companion.
Then the establishment interaction interface Service Instance function that even wheat service module provides is called CreateInteractiveSdkInstance, to create an interactive even wheat service module interface IDouyuInterActiveSdk。
So login identification ID of the acquisition of first acquisition unit 31 user and main broadcaster are current just in live live room ID; Load subelement 32 and be based on interactive even wheat service module interface, be additionally operable to according to the login identification ID and live room ID The live data of the interactive data of the user and the main broadcaster is loaded onto in the interactive direct broadcasting room.
After main broadcaster and user are in interactive direct broadcasting room, collecting unit 22 is used to gather living broadcast interactive in interactive direct broadcasting room Data packet.The living broadcast interactive packet includes:The interactive data of user, the live data of main broadcaster and the interactive number of main broadcaster According to these data can be video data and voice data, and the living broadcast interactive data include multiple packets.
Here, because when being carried out data transmission using udp protocol, the UDP message headers of live data transmission are in network In hierarchical mode, UDP is in transport layer, and its lower floor is IP network layer, during to data transfer to IP network layer, the first judging unit 23 also need to judge the packet size whether beyond MTU MTU capability value;If the packet is big The small capability value beyond the MTU, sharding unit 24 then carry out burst to the packet, form each sheet data bag.Wherein, institute The capability value for stating MTU is 576 bytes.
During appearing in each sheet data bag of transmission, because certain reason causes some sheet data bag to be lost Lose, or in receiving terminal, because receiving the reasons such as buffering area is full, cause each sheet data bag to be dropped in receiving terminal, then will Cause whole big packet imperfect, so as in the Internet of receiving terminal by the situation of whole data packet discarding, described device Also include:Second acquisition unit 26, the second judging unit 27 and indexing unit 28;Wherein,
Second acquisition unit 26 is used for the integer vernier value sended for obtaining current slice packet, the current slice packet For any piece of data bag in each sheet data bag;Second judging unit 27 is used to judge the whole of the current slice packet Whether type vernier value sended is consistent with the initial value of default transmission station location marker;Indexing unit 28 is used in the current slice In the case that the integer vernier value sended of packet is consistent with the initial value of default transmission station location marker, the first mark is utilized The starting sheet data that current slice packet described in code labeling is.
The second acquisition unit 26 is additionally operable to obtain the sizes values sizeToSend of current slice packet, the current slice Packet is any piece of data in each sheet data bag;Second judging unit 27 is additionally operable to described in judgement Whether sended, the sizeToSend meet sended+sizeToSend=packetSize, if satisfied, the mark is single Member 28 is then end sheet data bag using current slice packet described in the second mark code labeling;Wherein, the packetSize is The sizes values of the current slice packet.
In the present embodiment, the default initial value for sending station location marker is 0, and first identification code is the lowest order of byte Bof, the second identification code are the second bit eof of the byte;That is, when integer vernier value sended is 0, expression is current Sheet data bag is starting sheet packet, then with regard to bof be 1.
As sended+sizeToSend=packetSize, current slice packet is represented to terminate sheet data bag, then It is 1 with regard to eof.
If current sheet data is unsatisfactory for above-mentioned two situations, eof and bof are 1, and it is middle to represent current sheet data Sheet data bag.In general, when the sizes values of packet are less than MTU capability value, it is 1 feelings that eof and bof, which just occurs, Condition.
Thus starting sheet packet, intermediate packet and sheet data bag progress clearly differentiation can be terminated.
After forming each sheet data bag, transmission unit 25 utilizes each sheet data described in UDP UDP sequential deliveries Bag.
Here, when transmission unit 25 using udp protocol because being carried out data transmission, it is possible that out of order situation, than hair The sheet data bag sent is 1,2,3;And the sheet data bag that receiving terminal receives is probably 1,3,2;So in order to out of order in appearance In the case of, receiving terminal correctly can be also combined to packet, it is necessary to add index value to each sheet data bag.
Specifically transmission unit 25 adds to each sheet data bag successively according to the transmission order of each sheet data bag Index value;The index value is incremented by according to default incremental spacing from default initial index value.For example initial index value is 0, When incremental spacing is 1, then when sending first sheet data bag, the index value of first sheet data bag is just 0;Second piece number Index value according to bag is 1, the like.Receiving terminal, even if there is out of order situation, also may be used after these sheet data bags are received To carry out being correctly ordered combination to each sheet data bag according to index value.
The transmission unit 25 judges the data window queue m_ pre-established when transmitting current slice packet In udpWindow whether available free data window, if the idle data window be present, transmit current slice packet, And the current slice packet is preserved into the data window of free time.If, ought in the absence of the idle data window Anter data pack buffer is in data queue to be sent.The current slice packet is any a piece of in each sheet data bag Packet.
In the present embodiment, the data window queue includes multiple data windows, and the idle data window can also Referred to as currently there are the data window or sliding window of capacity.The capacity of the default data window queue is 255 bytes, That is the total capacity of the idle data window is 255 bytes.
Further, after current slice packet is transmitted, transmission unit 25 is additionally operable to:Create timer;The timer Time can preset, the time of timer is 1s in the present embodiment;The current slice packet is stored to the number According in window queue;After receiving terminal receives current slice packet, the index value of the current slice packet is obtained, and be based on institute The confirmation that index value returns to the current slice packet to transmitting terminal is stated, the confirmation includes:ACK confirms bag.
Judge the confirmation that receiving terminal returns whether is received in default timing, if receiving the confirmation Information, then the current slice packet is deleted in the data window queue, and delete the timer.If it is not received by institute Confirmation is stated, in addition to:Continue to transmit the current slice packet, and the re-transmission position of the current slice data packet header is set Re-transmission ident value is set to, the re-transmission ident value could be arranged to 1, and reset the timer.Thus can be according to confirmation Mechanism and retransmission mechanism avoid the occurrence of packet loss phenomenon.
So correspondingly, receiving terminal obtains data window team when it is 1 current slice packet to receive re-transmission ident value Minimum index value in row, judges whether the index value of the current slice packet is more than minimum index value, if being more than, then it represents that Current data packet is to need packet to be processed;If it is less than, then it represents that the current slice packet is the packet for repeating transmission (having received before), then directly abandon the current slice packet.
In addition, in order that transmitting terminal can control transmission rate, when receive receiving terminal return confirmation after, root The index value of current slice packet is obtained according to confirmation, deleted based on the index value in the data window queue described in Current slice packet, so that the data window that current slice packet takes is in idle condition, it can thus transmit down Piece of data bag, after transmitting lower piece of data bag, and lower piece of data bag is stored into the data window.It is this by number The mode of sheet data bag is added or removed according to window queue m_udpWindow so that data window queue m_udpWindow is all the time State in dynamic adjustment, when the network condition of receiving terminal is fine, immediately returns to confirmation, so as to data window just not It can be occupied full, transmission of the transmitting terminal with regard to supported progress data;But if the network condition of receiving terminal is bad, confirmation Return will be slow, so that the data window of transmitting terminal may be occupied full, so as to cause transmitting terminal to stop the biography of data It is defeated.Receiving terminal can so be avoided process occur and collapsed by the transmission rate regulation of transmitting terminal to the maximum network speed of receiving terminal Routed phenomenon.
Further, after by all sheet data bag end of transmissions, when termination receives each sheet data bag, first according to each The index value of sheet data bag, each sheet data bag is ranked up according to the order from small arrival, and each sheet data bag is saved in PacketList queues, so as to ensure the succession of whole packet.
Then the bof values of first sheet data bag are obtained, judge whether the bof values are 1, if the bof values are 1, It is starting sheet packet to determine first sheet data bag.
Equally, the eof values of first sheet data bag are obtained, judge whether the eof values are 1, if the eof values are 1, It is also end sheet data to determine first sheet data bag.So then illustrate that first sheet data bag is complete packet, by the One sheet data bag removes from packetList queues.
Conversely, when if eof values are not 1, continue to search the sheet data bag that eof values are 1 in packetList queue sequences, look into After finding the sheet data bag that eof values are 1, then using the sheet data bag as end sheet data bag, then a complete UDP message Bag just includes:First sheet data unwraps all sheet data bags to begin untill the sheet data bag.It should be noted that:From first The index value that individual sheet data unwraps all sheet data bags to begin untill the sheet data bag is that consecutive order increases certainly.If from The index value that one sheet data unwraps all sheet data bags to begin untill the sheet data bag is not that continuous order increases certainly, then This UDP message bag is also incomplete.
For example the index value that the index value of first sheet data bag is the sheet data bag that 0, eof values are 1 is 5, then if Should be included by unwrapping all sheet data bags of the beginning untill the sheet data bag from first sheet data by three, these three sheet data bags Index value should be respectively 2,3,4, the UDP message bag so eventually formed is exactly complete packet.
But if the index value of these three sheet data bags is respectively 2,3,6, that UDP message bag eventually formed is not just Complete packet.
So, receiving terminal is just completed to live data restructuring, and the decoding of audio frequency and video can be carried out to live data and is broadcast Put.Compared with prior art, the time delay of this transmission is reduced to 1~2s from 10s, meets the interactive demand of instantaneity.
Embodiment three
The present embodiment also provides a kind of computer equipment for transmitting data, as shown in figure 4, the computer equipment includes: Radio frequency (Radio Frequency, RF) circuit 310, memory 320, input block 330, display unit 340, voicefrequency circuit 350th, the part such as WiFi module 360, processor 370 and power supply 380.It will be understood by those skilled in the art that shown in Fig. 4 Computer equipment structure do not form restriction to computer equipment, can include than illustrating more or less parts, or Person combines some parts, or different parts arrangement.
Each component parts of computer equipment is specifically introduced with reference to Fig. 4:
RF circuits 310 can be used for the reception and transmission of signal, especially, after the downlink information of base station is received, to processing Device 350 is handled.Generally, RF circuits 310 include but is not limited at least one amplifier, transceiver, coupler, low noise amplification Device (Low Noise Amplifier, LNA), duplexer etc..
Memory 320 can be used for storage software program and module, and processor 350 is stored in memory 320 by operation Software program and module, so as to perform the various function application of computer equipment and data processing.Memory 320 can be led To include storing program area and storage data field, wherein, storing program area can storage program area, needed at least one function Application program etc.;Storage data field can store uses created data etc. according to computer equipment.In addition, memory 320 High-speed random access memory can be included, can also include nonvolatile memory, a for example, at least disk memory, Flush memory device or other volatile solid-state parts.
Input block 330 can be used for the numeral or character information for receiving input, and produce the user with computer equipment Set and function control it is relevant key signals input.Specifically, input block 330 may include keyboard 331 and other inputs Equipment 332.Keyboard 331, user is collected in input operation thereon, and corresponding connection is driven according to formula set in advance Device.Keyboard 331 gives processor 350 again after collecting output information.Except keyboard 331, input block 330 can also include Other input equipments 332.Specifically, other input equipments 332 can include but is not limited to contact panel, function key (such as sound Measure control button, switch key etc.), trace ball, mouse, the one or more in action bars etc..
Display unit 340 can be used for display by the information of user's input or be supplied to the information and computer equipment of user Various menus.Display unit 340 may include display panel 341, optionally, can use liquid crystal display (Liquid Crystal Display, LCD), the form such as Organic Light Emitting Diode (Organic Light-Emitting Diode, OLED) To configure display panel 341.Further, keyboard 331 can cover display panel 341, when keyboard 331 is detected thereon or attached After near touch operation, processor 350 is sent to determine the type of touch event, is followed by subsequent processing device 350 according to incoming event Type corresponding visual output is provided on display panel 341.Although keyboard 331 and display panel 341 are conducts in Fig. 4 Two independent parts realize the input of computer equipment and input function, but in some embodiments it is possible to by keyboard 331 integrate with display panel 341 and realize input and the output function of computer equipment.
Voicefrequency circuit 350, loudspeaker 351, microphone 352 can provide the COBBAIF between user and computer equipment. Electric signal after the voice data received conversion can be transferred to loudspeaker 351, is changed by loudspeaker 351 by voicefrequency circuit 350 Exported for voice signal;
WiFi belongs to short range wireless transmission technology, and computer equipment can help user to receive and dispatch by WiFi module 360 Email, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 4 WiFi module 360 is shown, but it is understood that, it is simultaneously not belonging to must be configured into for computer equipment, completely can root Omitted according to needs in the essential scope for do not change invention.
Processor 370 is the control centre of computer equipment, utilizes various interfaces and the whole computer equipment of connection Various pieces, by running or performing the software program and/or module that are stored in memory 320, and call and be stored in Data in memory 320, the various functions and processing data of computer equipment are performed, it is overall so as to be carried out to computer equipment Monitoring.Optionally, processor 370 may include one or more processing units;Preferably, processor 370 can be integrated using processing Device, wherein, application processor mainly handles operating system, user interface and application program etc..
Computer equipment also includes the power supply 380 (such as power supply adaptor) to all parts power supply, it is preferred that power supply can With logically contiguous by power-supply management system and processor 370.
The beneficial effect that the method, apparatus and computer equipment of transmission data provided by the invention can be brought is at least:
The invention provides a kind of method, apparatus and computer equipment for transmitting data, methods described includes:It is straight from currently Interactive direct broadcasting room is loaded onto between broadcasting, the packet of live data is gathered in the interactive direct broadcasting room;Judge the packet Size whether beyond MTU MTU capability value;If the size of the packet exceeds the capacity of the MTU Value, then burst is carried out to the packet, form each sheet data bag;Using each described in UDP UDP sequential deliveries Sheet data bag;In this way, when carrying out interactive during live, during because transmitting data by udp protocol, without passing through direct broadcast service The forwarding of device can send data to receiving terminal, that is to say, that just not connected between user and server, you can realize number According to transmission, so as to reduce data delay;And when transmitting data, without carry out packet affirmation mechanism, further Data delay time is reduced, and then meets the interactive demand of instantaneity.And corresponding index is added in sheet data bag Value, in the case of out of order, receiving terminal can also correctly be recombinated according to corresponding index value to each sheet data bag, be avoided out Existing sheet data coating discarding causes the incomplete situation of whole packet.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein. Various general-purpose systems can also be used together with teaching based on this.As described above, required by constructing this kind of system Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that it can utilize various Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair Bright preferred forms.
In the specification that this place provides, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect, Above in the description to the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor The application claims of shield features more more than the feature being expressly recited in each claim.It is more precisely, such as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself Separate embodiments all as the present invention.
Those skilled in the art, which are appreciated that, to be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so to appoint Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power Profit requires, summary and accompanying drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation Replace.
In addition, it will be appreciated by those of skill in the art that although some embodiments in this include institute in other embodiments Including some features rather than further feature, but the combination of the feature of different embodiments means to be in the scope of the present invention Within and form different embodiments.For example, in the following claims, embodiment claimed it is any it One mode can use in any combination.
The all parts embodiment of the present invention can be realized with hardware, or to be run on one or more processor Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that it can use in practice Microprocessor or digital signal processor (DSP, Digital Signal Processing) are implemented to realize according to the present invention The gateway of example, proxy server, some or all functions of some or all parts in system.It is of the invention acceptable real Now be for perform method as described herein some or all equipment or program of device (for example, computer journey Sequence and computer program product).Such program for realizing the present invention can be stored on computer-readable recording medium, or There can be the form of one or more signal.Such signal can be downloaded from internet website and obtained, or carried There is provided on body signal, or provided in the form of any other;The program realizes following steps when being executed by processor:It is straight from currently Interactive direct broadcasting room is loaded onto between broadcasting, the packet of live data is gathered in the interactive direct broadcasting room;Judge the packet Size whether beyond MTU MTU capability value;If the size of the packet exceeds the capability value of the MTU, Burst then is carried out to the packet, forms each sheet data bag;Utilize each number described in UDP UDP sequential deliveries According to bag.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such Element.The present invention can be by means of including the hardware of some different elements and being come by means of properly programmed computer real It is existing.In if the unit claim of equipment for drying is listed, several in these devices can be by same hardware branch To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame Claim.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention, it is all All any modification, equivalent and improvement made within the spirit and principles in the present invention etc., it should be included in the protection of the present invention Within the scope of.

Claims (10)

  1. A kind of 1. method for transmitting data, it is characterised in that methods described includes:
    From being loaded onto interactive direct broadcasting room between current live;
    Living broadcast interactive packet is gathered in the interactive direct broadcasting room;
    Judge the packet size whether beyond MTU MTU capability value;
    If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, forms each sheet data Bag;
    Utilize each sheet data bag described in UDP UDP sequential deliveries.
  2. 2. the method as described in claim 1, it is characterised in that it is described from being loaded onto interactive direct broadcasting room between current live, including:
    Login identification ID and the main broadcaster for obtaining user are current just in live live room ID;
    According to the login identification ID and the live room ID respectively by the straight of the interactive data of the user and the main broadcaster Multicast data is loaded onto in the interactive direct broadcasting room.
  3. 3. the method as described in claim 1, it is characterised in that it is described that burst is carried out to the packet, form each sheet data Bao Hou, in addition to:
    The integer vernier value sended of current slice packet is obtained, the current slice packet is appointing in each sheet data bag Meaning piece of data bag;
    Judge the integer vernier value sended of the current slice packet and default transmission station location marker initial value whether one Cause;
    If the integer vernier value sended of the current slice packet is consistent with the initial value of default transmission station location marker, profit The current slice packet described in the first mark code labeling is starting sheet packet.
  4. 4. the method as described in claim 1, it is characterised in that it is described that burst is carried out to the packet, form each sheet data Bao Hou, in addition to:
    The integer vernier value sended of the current slice packet and sizes values sizeToSend of current sheet data is obtained, it is described current Sheet data bag is any piece of data bag in each sheet data bag;
    If the sended+sizeToSend=packetSize, current slice packet described in the second mark code labeling is utilized To terminate sheet data bag;Wherein, the packetSize is the sizes values of the current slice packet.
  5. 5. the method as described in claim 1, it is characterised in that described using described in UDP UDP sequential deliveries During each sheet data bag, including:
    According to the transmission order of each sheet data bag, index value is added to each sheet data bag successively;The index value is pressed According to default incremental spacing from default initial index value sequentially.
  6. 6. a kind of device for transmitting data, it is characterised in that described device includes:
    Loading unit, for from being loaded onto interactive direct broadcasting room between current live;
    Collecting unit, for gathering living broadcast interactive packet in the interactive direct broadcasting room;
    First judging unit, for judge the packet size whether beyond MTU MTU capability value;
    Sharding unit, in the case of in the size of each packet beyond the capability value of the MTU, then to the data Bag carries out burst, forms each sheet data bag;
    Transmission unit, for utilizing each sheet data bag described in UDP UDP sequential deliveries.
  7. 7. device as claimed in claim 6, it is characterised in that the loading unit includes:
    First acquisition unit, the login identification ID and main broadcaster for obtaining user are current just in live live room ID;
    Loading unit, for according to the login identification ID and live room ID by the interactive data of the user and described The live data of main broadcaster is loaded onto in the interactive direct broadcasting room.
  8. 8. device as claimed in claim 6, it is characterised in that described device also includes:
    Second acquisition unit, for obtaining the integer vernier value sended of current slice packet, the current slice packet is institute State any piece of data bag in each sheet data bag;
    Second judging unit, for judging the integer vernier value sended and default transmission position mark of the current slice packet Whether the initial value of knowledge is consistent;
    Indexing unit, the first of station location marker is sent with default for the integer vernier value sended in the current slice packet In the case that initial value is consistent, the current slice packet starting sheet packet that is described in the first mark code labeling is utilized.
  9. 9. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is held by processor Following steps are realized during row:
    From being loaded onto interactive direct broadcasting room between current live;
    Living broadcast interactive packet is gathered in the interactive direct broadcasting room;
    Judge the packet size whether beyond MTU MTU capability value;
    If the size of the packet exceeds the capability value of the MTU, burst is carried out to the packet, forms each sheet data Bag;
    Utilize each sheet data bag described in UDP UDP sequential deliveries.
  10. A kind of 10. computer equipment for transmitting data, it is characterised in that including:
    At least one processor;And
    At least one memory being connected with the processor communication, wherein,
    The memory storage has can be by the programmed instruction of the computing device, and the processor calls described program instruction energy Enough perform the method as described in claim 1 to 5 is any.
CN201710717945.9A 2017-08-21 2017-08-21 A kind of method, apparatus and computer equipment for transmitting data Pending CN107612841A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710717945.9A CN107612841A (en) 2017-08-21 2017-08-21 A kind of method, apparatus and computer equipment for transmitting data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710717945.9A CN107612841A (en) 2017-08-21 2017-08-21 A kind of method, apparatus and computer equipment for transmitting data

Publications (1)

Publication Number Publication Date
CN107612841A true CN107612841A (en) 2018-01-19

Family

ID=61065175

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710717945.9A Pending CN107612841A (en) 2017-08-21 2017-08-21 A kind of method, apparatus and computer equipment for transmitting data

Country Status (1)

Country Link
CN (1) CN107612841A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109474547A (en) * 2019-01-11 2019-03-15 广东省气象公共服务中心(广东气象影视宣传中心) Boat-carrying gateway communication system, boat-carrying gateway communication method and electronic equipment
CN110912942A (en) * 2019-12-30 2020-03-24 深圳市瑞云科技有限公司 Method for reducing UDP message sending time delay
CN112486697A (en) * 2020-11-16 2021-03-12 杭州电魂网络科技股份有限公司 Data transmission method, system, electronic device and storage medium
CN113497783A (en) * 2020-03-19 2021-10-12 北京沃东天骏信息技术有限公司 Method and device for processing data
CN114205679A (en) * 2021-12-06 2022-03-18 北京百度网讯科技有限公司 Live broadcast interaction method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202604A (en) * 2007-08-14 2008-06-18 深圳市同洲电子股份有限公司 Method, system and equipment for transmitting and receiving network data
CN101945427A (en) * 2009-07-03 2011-01-12 深圳市融创天下科技发展有限公司 Efficient streaming media transmission method
CN102377524A (en) * 2011-10-11 2012-03-14 北京邮电大学 Fragment processing method and system
US20140245453A1 (en) * 2013-02-28 2014-08-28 Motorola Solutions, Inc. Method and apparatus for transmitting a user datagram protocol message that is larger than a defined size
CN106341695A (en) * 2016-08-31 2017-01-18 腾讯数码(天津)有限公司 Interaction method, device and system of live streaming room

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202604A (en) * 2007-08-14 2008-06-18 深圳市同洲电子股份有限公司 Method, system and equipment for transmitting and receiving network data
CN101945427A (en) * 2009-07-03 2011-01-12 深圳市融创天下科技发展有限公司 Efficient streaming media transmission method
CN102377524A (en) * 2011-10-11 2012-03-14 北京邮电大学 Fragment processing method and system
US20140245453A1 (en) * 2013-02-28 2014-08-28 Motorola Solutions, Inc. Method and apparatus for transmitting a user datagram protocol message that is larger than a defined size
CN106341695A (en) * 2016-08-31 2017-01-18 腾讯数码(天津)有限公司 Interaction method, device and system of live streaming room

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109474547A (en) * 2019-01-11 2019-03-15 广东省气象公共服务中心(广东气象影视宣传中心) Boat-carrying gateway communication system, boat-carrying gateway communication method and electronic equipment
CN110912942A (en) * 2019-12-30 2020-03-24 深圳市瑞云科技有限公司 Method for reducing UDP message sending time delay
CN110912942B (en) * 2019-12-30 2021-09-21 深圳市瑞云科技有限公司 Method for reducing UDP message sending time delay
CN113497783A (en) * 2020-03-19 2021-10-12 北京沃东天骏信息技术有限公司 Method and device for processing data
CN113497783B (en) * 2020-03-19 2024-01-16 北京沃东天骏信息技术有限公司 Method and device for processing data
CN112486697A (en) * 2020-11-16 2021-03-12 杭州电魂网络科技股份有限公司 Data transmission method, system, electronic device and storage medium
CN114205679A (en) * 2021-12-06 2022-03-18 北京百度网讯科技有限公司 Live broadcast interaction method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107612841A (en) A kind of method, apparatus and computer equipment for transmitting data
CN107580233A (en) A kind of method, apparatus and computer equipment for transmitting data
WO2021232568A1 (en) Method, terminal and system for transceiving data over wireless local area network, and network access device
CN101043306A (en) Method and apparatus for handling retransmissions in a wireless communications system
CN101309210A (en) Method and related apparatus for setting packet headers in a wireless communications system
JP6145216B2 (en) Data transmission method, apparatus, and computer storage medium
CN102025638A (en) Data transmission method and device based on priority level as well as network equipment
KR102046792B1 (en) Method of transporting data from sending node to destination node
CN107342848A (en) A kind of adaptive code stream transmission method, device and equipment
CN104780401B (en) The sending method and device of video data
CN109862377A (en) Video transmission method, device, system and computer readable storage medium
EP3021555B1 (en) Message processing method and device
CN103973414B (en) A kind of data transmission method and device
CN107426806A (en) Internet-of-things terminal transmits the method and device of data
CN107483279A (en) A kind of method for the local batch operation network equipment detectd based on Ethernet
JP2003196244A5 (en)
CN108235379A (en) A kind of method and apparatus of data transmission
CN109257138A (en) A kind of data transfer control method and relevant device
CN107508828B (en) A kind of very-long-range data interaction system and method
CN105050196B (en) Multi-user communication based on full duplex relaying caching dispatches system and method
CN108809502A (en) The feedback information generating method and Related product of mixed automatic retransfer
CN1988537A (en) Data transmission protocol
US20190052405A1 (en) SYSTEM, METHOD AND APPARATUS FOR QoS RETRANSMISSION FOR MG.Fast
CN101631074B (en) Multilink message sending method, device and network equipment
CN109391379A (en) A kind of HARQ indicating means, apparatus and system

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180119