A kind ofly improve the method that data flow is broadcast efficient
Technical field
The present invention relates to a kind of method that data flow is broadcast efficient that improves, belong to the data broadcast of digital TV technical field.
Background technology
Digital TV Broadcasting Techniques develops rapidly at present, compares with traditional simulated television, and software engineering is occupied even more important position in digital television techniques.Except the decoding of looking audio frequency is realized by hardware, comprise the reproduction of television content, the realization of electronic program guides (EPG) operation interface, the realization of data broadcast service, until the interconnection of apparatus of digital television receiving and personal computer and and the interconnection of the Internet all need realize by software.The introducing of Digital Television epoch software engineering will greatly enlarge the scope of business of traditional tv network.
Digital television techniques mainly comprises the two large divisions: apparatus of digital television receiving and software systems thereof; Front end audio-video signal and data broadcasting system.
Apparatus of digital television receiving has begun to enter in a large number family because it is powerful, easy to operate.What apparatus of digital television receiving received is digitized image and data message, therefore, be different from the reception and the processing of traditional anolog TV signals, apparatus of digital television receiving is to be undertaken by its inner central processing unit (CPU) and coupled peripheral components to the reception and the processing of digitized image information and data.
The major function of front end system is to play interactive application and data on MPEG-2 stream.These are used with data and are packaged into the MPEG-2 transmission package, and these bags connect together, and form mpeg 2 transport stream, by multiplexer, by wired, satellite, ground or other medium, download to apparatus of digital television receiving-set-top box.The front end system block diagram is seen Fig. 1.
As everyone knows, generally speaking, apparatus of digital television receiving manufacturer also will develop the application program that this apparatus of digital television receiving is suitable for usually on the basis of relevant hardware and operating system after design, having made the hardware of apparatus of digital television receiving; Equally, some professional digital broadcast content service providers also need to go out corresponding service software according to the hardware performance and the functional development of different apparatus of digital television receiving.
One of core of data broadcasting control centre is a data broadcast server in the front end system, and its effect is: handle the client and connect, with a plurality of client dialogues, handle their request respectively.The transmission package that it transmits client is delivered separately buffer according to transport protocol standard; Play transmission package according to broadcasting strategy, form transport stream and deliver multiplexer.
The method course of work that the single buffer mode of traditional employing transmits transmission package is as follows:
The corresponding buffer of each client, if do not have when finishing new transmission package to need to handle when the transmission package in this buffer is processed, then new transmission package formation must be waited for, when the data in the buffer are disposed fully, processing client-requested task detects the buffer sign and is changed to and can writes, could be with the transmission package write buffer of waiting for.
Mainly there is following defective in the method that adopts single buffer to carry out the transmission package transmission:
Owing to adopt single buffer to carry out the storage of transmission package (packet), buffer is only supported the single task operation, can not carry out read operation when carrying out write operation that is:; When carrying out read operation, can not carry out write operation.Handling client-requested task detection buffer flag bit is could be with the transmission package write buffer in the time of can writing; When being readable, transmission package could be read main task poll detection buffer flag bit.When the transmission package quantity of handling when needs is a lot, when main task very easily occurring and being polled to the buffer of certain client correspondence, though the last consignment of data dispose in the buffer, but new transmission package does not also have in the complete write buffer, main task detects the buffer flag bit and also can not write, and changes and removes to inquire about next buffer state; And new transmission package write could be processed when needing to wait for the inquiry of main task next round after finishing, thereby lost the single treatment chance.Adopt the method for single buffer transmits data packets because packet waits for that the time that enters buffer is long, so the whole efficient of broadcasting the server process transmission package reduces.
At above-mentioned problem, the present invention adopted a kind of based on the client/server framework, utilize method more than a buffer to substitute traditional single buffer approach to carry out the transmission of transmission package, effectively reduced transmission package and waited for the time that enters buffer, improved and broadcast efficient.
Summary of the invention
The technical problem to be solved in the present invention is the implementation method that a kind of many buffers are provided for the transmission of the transmission package of data broadcast of digital TV transmitting system, make each client correspondence more than a buffer, reduce transmission package and waited for the time that enters buffer, improved the efficient of TS bag transmission.
The present invention adopts following technical method to solve above problem.By a kind of data broadcasting system based on the client/server framework is provided, described server index is according to broadcasting server; Client is communicated by letter by client-server communication protocol with server, and client Connection Service device also sends request, and server receives client's connection and the task of opening up is handled client requests; Method of the present invention just is based on this framework, utilize many buffers to improve data broadcast server broadcasts efficient, a kind of strategy of transmission package scheduling is provided simultaneously, make a plurality of transport stream be combined into a transport stream, promptly the data flow of a plurality of low rates is combined into the data flow of a two-forty.
Below method of the present invention is done detailed explanation.
Implementation step:
A kind of method of broadcasting efficient based on the raising data of client/server framework.
The major function of client and server end:
Client: main purpose is the Connection Service device, and sends request according to client-server communication protocol.The request of client mainly contains following several:
1) application connects with server
2) bandwidth application
3) application transmits data packets
4) application is closed and being connected of server
Client is set up communication by client-server communication protocol and server, sends respective request.
Server end: mainly carry out three generic tasks, their major function is as follows:
1) main task: main task is carried out initialization and is broadcast chained list, and broadcasts packet according to broadcasting the chained list circulation.
2) monitor the client and connect task: whether this task is monitored has the client to connect, and when new client connects, creates the client-requested task of handling.
3) handle the client-requested task: this task keep and client between communication, and according to the client
-server communication protocol processes client-requested.
Server process client-requested task job step is as follows:
Step 1:, be ready for sending packet by client Connection Service device;
Step 2: monitor client's connection task and listened to the client connection, open up the client-requested task of handling;
Step 3: handle a plurality of buffer states that the inquiry of client-requested task has connected the client of data broadcast server, if one of them buffer state is masked as and can writes, then write packet to this buffer, this process is handled client-requested task and is kept and the communicating by letter of client, finish until the data packets operation, buffer state is changed to readable, and client withdraws from connection, handles the client-requested task and closes;
Step 4: the main task poll detects the pairing buffer state of each client:
Situation 1: if in the corresponding a plurality of buffers of certain client a Status Flag is arranged is readable, then main task is according to broadcast the tactful packet that reads certain bag number at every turn, until this buffer is empty, and main task is changed to the buffer sign can write, then handles the packet in other buffer;
Situation 2: if do not have Status Flag in corresponding all buffers of certain client is readable, and main task directly forwards the corresponding pool of buffer device of next client to and detects;
Step 5: data broadcast server forms transport stream according to broadcasting tactful playback data, delivers multiplexer;
Fig. 2 is seen in the read-write signal in a plurality of buffers of above-mentioned steps and packet.
The present invention is further illustrated below in conjunction with accompanying drawing.
Description of drawings
Fig. 1 is the digital TV front-end structural representation,
Fig. 2 describes the read-write flow process of server end buffer memory.
Fig. 3 data broadcast server operation principle schematic diagram represents that a plurality of buffers of a kind of employing based on the client/server framework improve the server architecture that data are broadcast, and adopt the framework of double buffering.
The present invention is described in further detail below in conjunction with specific embodiment.
Embodiment
Referring to Fig. 3, a plurality of buffers of a kind of employing based on the client/server framework that the present invention relates to improve the method that data are broadcast efficient, are example with the double buffering, and its specific implementation process is as follows:
Client sends to server by client-server communication protocol and creates connection requests, and this request comprises data type and other relevant supplementary information that client transmits;
Whether continuous monitoring has client to connect according to ICP/IP protocol to monitor client connection task (task A), connects when listening to new client, then creates the client-requested task (task B) of handling.
Book server can be handled the client-requested task, and while maintain customer end is communicated by letter with server, and handles other request that client sends.
After data broadcast server received the client connection request, the job step that task B handles client requests was as follows:
1) distribute suitable bandwidth according to broadcasting strategy, if available bandwidth is arranged, and client connects unsaturation, then returns successful information of client, creates this client node simultaneously, and this node is inserted into broadcasts in the chained list.
Node information comprises:
(1) the open ended maximum bag number of every block buffer: initial value is 0.
(2) the bag number that require to transmit: initial value is 0, represent no transferable packet, and by assignment, and value is not more than the open ended maximum of every block buffer and wraps number when transfer data packets for it.
(3) the current bag number that has transmitted: initial value is 0.
(4) bandwidth of being distributed: by broadcasting the strategy decision.
Can (5) repeat to send: default value be not reproducible transmission, and this value can be created when being connected by client-requested and server end and specify.
(6) data type of Chuan Songing: send by client, broadcast strategy and distribute bandwidth according to the data type that transmits.
(7) the buffer interval of node: initial value is empty, has only when client application buffer is interval and just distributes; The buffer interval of node is corresponding to each client, and each client corresponding two block buffers, the i.e. notion of double buffering.
(8) readable resource: initial value is 0, and is on duty greater than 0, and expression has at least a block buffer readable; Otherwise the expression buffer data has run through or has not had new buffer interval to be ready to.
(9) can write resource: initial value is 2, represents that each client can write two block buffers should be arranged.
(10) readable position: initial value is 1, and expression is read since first block buffer.
(11) but writing position: initial value is 1, the expression write since first block buffer.
2) client sends the request of application buffer space by client-server communication protocol to server, sends the buffer space size of needs to data broadcast server, and server-assignment is the buffer space of unit with the bag.If server can distribute the space of these client needs, then return information that is allocated successfully of client, and the node information of this client of resetting.
3) client sends the request of broadcasting packet by client-server communication protocol to server, send the information such as number of this packet that need broadcast and packet to server, server determines that the request of this client is legal, to apply for to write resource: can write resource greater than 0, show that then having one in two block buffers at least can write; Can write resource is 0, shows that two block buffers are not all run through.If do not apply for to write resource, then get clogged until applying for that successfully other request of client also will get clogged during this period.After the buffer space of applying for writing, the client-requested data packets transmitted is sent to buffer.After buffer is delivered packet and is finished, the relevant information of replacement client node.
4) client sends to server by client-server communication protocol and closes connection requests, server is deleted this client node from broadcast chained list, and discharge the buffer space of this client application, and close and being connected of client, close the client requests task of handling.
The step of main task (task C) work is:
Chained list is broadcast in its initialization, each node in the inquiry linked list, when the readable resource of finding certain node greater than zero the time, but will from readable buffer, choose the packet that will broadcast according to the read buffer designator; Rewrite the current bag number information that sent; If more than or equal to the bag number that requires to send, showing all to send in anterior bumper, the current bag number that sent finishes; Otherwise forward next node to and carry out same operation; When this buffer data is read when finishing, detect current readable resource and can repeat to send sign, if all be 1, showing does not have new data demand to send, and current data can repeat to send, the bag of the transmission information of counting of this buffer is reset to 0, forward next node then to and carry out same operation; Otherwise, but the read buffer designator is pointed to another block buffer, and readable resource is subtracted 1, can write resource and add 1, turn to next client node to carry out same operation; If the task that have corresponding processing client to transmit data this moment gets clogged, then this getting clogged of task will be waken up, and the request of proceeding is handled.
It should be noted last that: the present invention is to provide a kind of method and design philosophy thereof that data broadcast server is broadcast efficient that improve, above embodiment is the unrestricted technical scheme of the present invention in order to explanation only, although the present invention is had been described in detail with reference to the foregoing description, those of ordinary skill in the art is to be understood that: still can make amendment or be equal to replacement the present invention, and not breaking away from any modification or partial replacement of the spirit and scope of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.