CN105426261B - A kind of cross-platform real-time communication system method - Google Patents
A kind of cross-platform real-time communication system method Download PDFInfo
- Publication number
- CN105426261B CN105426261B CN201510763821.5A CN201510763821A CN105426261B CN 105426261 B CN105426261 B CN 105426261B CN 201510763821 A CN201510763821 A CN 201510763821A CN 105426261 B CN105426261 B CN 105426261B
- Authority
- CN
- China
- Prior art keywords
- data
- channel
- read
- write
- reading
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/541—Interprogram communication via adapters, e.g. between incompatible applications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/544—Remote
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
Abstract
The cross-platform real-time communication system method of one kind of the invention, it applies in the data interaction and code stream storage in process, memory is directly utilized completely, its data interaction in process is not only set to use very similar network interface, efficiency is very high, it operates very simple, and it not will cause the systematic wasting of resources and conflict, system program stability, the utilization rate of validity and system resource is greatly enhanced, simultaneously, also have developed a very scientific api interface encapsulation, video code flow is set to have obtained the management method of science and the use means of science, make it have code logic, it is readable very strong.
Description
Technical field
The present invention relates to the technical fields that the data interaction applied in process and code stream store, more particularly to one kind is across flat
The real-time communication system method of platform.
Background technique
Many communication plans all call directly the communication interface of system platform, cause communication efficiency low, while each flat
Platform communication otherness it is very big, most convenient namely utilize network interface, but will cause simultaneously it is systematic waste and not really
Fixed conflict.And the present invention then directly utilizes memory completely, and the data interaction in process is made to use very similar network
Interface, but efficiency is very high, it is easy to operate, while not will cause the systematic wasting of resources and conflict etc..
Meanwhile much the code stream way to manage of companies is very more now, and up to the present according to investigation result, these management
Mode all management methods of none science and means are used, also without code logic, taking out every time must after video code flow
The mode that stb need be used judges just to can know that the information such as the type, size and source of video code flow, readability are non-after determining
Often poor, operating procedure is complicated, inefficient.Present invention is alternatively directed to current security industries to develop one ten to the management of video code flow
The api interface of branch encapsulates, the interface make video code flow use and manage it is more scientific, it is more convenient, it is also more simple
It is single.
Summary of the invention
Memory is directly utilized completely the technical problem to be solved in the present invention is to provide a kind of, not only makes its number in process
According to very similar network interface is used interchangeably, efficiency is very high, and operation is very simple, and not will cause systematic resource
Waste and conflict, meanwhile, a very scientific api interface encapsulation is also had developed, so that video code flow using and managing
It is more scientific, it is more convenient, operate more simple real-time communication system method.The present invention is by the following technical programs
Come what is realized:
A kind of cross-platform real-time communication system method is applied in the data interaction and code stream storage in process,
Steps are as follows for application method:
A: cross-platform real-time communication pool first initializes all channels before process unlatching, needs
A channel is created using a thread, channel has been created when early period, does not just have to create again at this time.
B: after channel creates, data is written during channel is in communication and write a position, wherein write point
It sets and refers to and write o'clock in the position of a circle;It needs to change circle when size one is enclosed when writing a position and writing, number of total coils is big multiplied by every circle
Small is exactly to write the circle total data size that can a little deviate, wherein writes the bias size for a little referring to that write-in data are total, total offset is big
The small position of writing for referring to a circle or more is added up, when write a little write circle total data size when, write a zero and open again
Beginning writes data.
C: when needing to read data from this channel, the position for determining read point is first had to, will be read after reading successfully
The positional shift of point reads the size position of data.
D: inside the data of reading are enclosed two, then at this time relate to change circle, it is vertical after having read a circle data
Read point position zero at this time will be read, then proceedes to start to read in the dead-center position of next circle.
E: the type of reading is imported in the data of step B, C, D, the type of reading is data type, when reading data
The type of reading data may be selected.
F: finally destroying channel, and another channel must be re-created when channel needs to reactivate, is carried out again later
Read-write operation.
Further, when re-creating a new channel, read point and write a little all must return-to-zero.
Further, when reading data and write-in data inside channel, read point position, which should be less than, writes a position, when writing
It in the case that point position is greater than the circle of read point position one, needs to reset read point position when reading data, makes read point position and write point
It sets and is in the same point of same circle above.
Further, when data being written in the channel of step B, when the final stage in write-in data, circle sum
After subtracting the maximum value write a little according to size, it is necessary to retain the size of a circle, the speed of write-in data can be kept up with to guarantee to read data
Degree.
Further, when step C reads data, by judging that read point, the size write a little whether can to lock
Data are read, when read point, which is greater than, to be write, then it represents that the error of read point position needs to relocate;Dian Yiquan is write when read point is less than
When, read point also needs to relocate, to guarantee read point and write that a little correctly write-in can be read on the size of a circle
Data;When read point, which is equal to, to be write, then no new data is represented, other situations are normal read datas;Normally reading number
According to when, in the case that the data of reading appear in not same circle, circle need to be changed immediately, after running through when front ring in order to read
Another part data are taken, finally the data copy of reading is gone out.
Further, step C read data when need outside reset read point, then again the size of read point transmit into
Enter channel to judge, the mode of outside resetting read point, which can allow, read point and to be write a little on the same position.
Further, when reading data type in step E, during reading bit stream data, when knowing readout code
The frame type of stream or when being repositioned onto next frame data, needs first to fill out the frame type code place value of reading in outside
It is come into again after good inside channel, carries out circulation reading again after coming into inside channel, until reading data success, inside channel
When no data, then the type of sign of display no data is returned.
Further, it destroys channel and refers to the size of data that release channel is applied in creation.
Further, the thread creation channel in process, reading data, in the channel write-in data or destruction in channel
It is all to be controlled by thread lock when channel, it is therefore an objective to prevent multiple threads while create the same channel, avoid same
There is secondary creation in channel and the phenomenon that secondary read-write occurs in the same channel, and each moment can only allow a thread to this
Channel is operated, and avoids multiple threads while operation is so as to cause the data corruption inside channel, channel when destroying also only
The channel can be discharged by a thread, after per thread has operated corresponding channel, another thread could be allowed to have operated
The corresponding channel of effect.
The cross-platform real-time communication system method of one kind of the invention, applies the data interaction in process and code stream
In storage, it has the advantage that: data interaction uses very similar network interface in process, efficiency is used very
It is efficiently simple, and not will cause the waste and conflict of systemic resource, meanwhile, ten branches are had developed in code stream management
The encapsulation of api interface, make code stream use and manage it is very scientific, it is easy to use, operate very simple, it is high-efficient.
Detailed description of the invention
The present invention is described in detail by following preferred embodiments and attached drawing for ease of explanation,.
Fig. 1 is the overall structure figure of the cross-platform real-time communication system method of one kind of the invention.
Fig. 2 is that the channel creation of the cross-platform real-time communication system method of one kind of the invention and read-write point operation are shown
It is intended to.
Fig. 3 is the reading data of the cross-platform real-time communication system method of one kind of the invention and the process of write-in data
Schematic diagram.
Fig. 4 is showing for the multithreading operation channel process of the cross-platform real-time communication system method of one kind of the invention
It is intended to.
Fig. 5 is the structural schematic diagram of the circle of the cross-platform real-time communication system method of one kind of the invention.
Specific embodiment
To facilitate the understanding of the present invention, a more comprehensive description of the invention is given in the following sections with reference to the relevant attached drawings.In attached drawing
Give better embodiment of the invention.But the invention can be realized in many different forms, however it is not limited to herein
Described embodiment.On the contrary, the purpose of providing these embodiments is that making to understand more the disclosure
Add thorough and comprehensive.
Unless otherwise defined, all technical and scientific terms used herein and belong to technical field of the invention
The normally understood meaning of technical staff is identical.Term as used herein in the specification of the present invention is intended merely to description tool
The purpose of the embodiment of body, it is not intended that in the limitation present invention.
In the present embodiment, referring to figs. 1 to shown in Fig. 5, the cross-platform real-time communication system method of one kind of the invention,
It applies in the data interaction and code stream storage in process, directly utilizes memory completely, not only hand over its data in process
Very similar network interface mutually is used, efficiency is very high, and operation is very simple, and not will cause the systematic wasting of resources
And conflict, meanwhile, a very scientific api interface encapsulation is also had developed, so that video code flow using and managing more
Science, more convenient, operation is more simple, and steps are as follows for application method:
A: cross-platform real-time communication pool first initializes all channels before process unlatching, needs
A channel is created using a thread, channel has been created when early period, does not just have to create again at this time.
B: after channel creates, data is written during channel is in communication and write a position, wherein write point
It sets and refers to and write o'clock in the position of a circle;It needs to change circle when size one is enclosed when writing a position and writing, number of total coils is big multiplied by every circle
Small is exactly to write the circle total data size that can a little deviate, wherein writes the bias size for a little referring to that write-in data are total, total offset is big
The small position of writing for referring to a circle or more is added up, when write a little write circle total data size when, write a zero and open again
Beginning writes data.
C: when needing to read data from this channel, the position for determining read point is first had to, will be read after reading successfully
The positional shift of point reads the size position of data.
D: inside the data of reading are enclosed two, then at this time relate to change circle, it is vertical after having read a circle data
Read point position zero at this time will be read, then proceedes to start to read in the dead-center position of next circle.
E: the type of reading is imported in the data of step B, C, D, the type of reading is data type, when reading data
The type of reading data may be selected.
F: finally destroying channel, and another channel must be re-created when channel needs to reactivate, is carried out again later
Read-write operation.
In one embodiment, when re-creating a new channel, read point and write a little all must return-to-zero.
In one embodiment, when reading data and write-in data inside channel, read point position, which should be less than, to be write a little
Position needs to reset read point position when reading data, makes read point position in the case where writing a position and enclosing greater than read point position one
It is in the same point of same circle above with a position is write.
In one embodiment, when data being written in the channel of step B, when the final stage in write-in data
When, after circle total data size subtracts the maximum value write a little, it is necessary to retain the size of a circle, a little be greater than circle total data this is because writing
Size will do clearing processing later, that is, recalculate, and will appear when read point is also not up to maximum circle total data size and write a little
It resets and read point does not reach the purpose of clearing also, so to wait read point also to arrive when writing size position a little in the circle of read point one
Up to the position of maximum circle total data size, the speed of write-in data can be kept up with to guarantee to read data.
In one embodiment, it when step C reads data, is locked by judging read point, writing size a little
Whether data can be read, when read point, which is greater than, to be write, then it represents that the error of read point position needs to relocate;When read point is less than
When writing an a little circle, read point also needs to relocate, to guarantee read point and write a little can correctly read on the size of a circle
The data being written out;When read point, which is equal to, to be write, then no new data is represented, other situations are normal read datas;Just
When often reading data, in the case that the data of reading appear in not same circle, circle need to be changed immediately after running through when front ring,
In order to read another part data, finally the data copy of reading is gone out.
In one embodiment, read point is reset outside needing when step C reads data, then again the big of read point
Small to be conveyed into channel to judge, the mode of outside resetting read point, which can allow, read point and to be write a little on the same position.
In one embodiment, when reading data type in step E, during reading bit stream data, when knowing
When road reads the frame type of code stream or to be repositioned onto next frame data, need the frame type code place value by reading first
It is come into inside channel again after outside is filled in, carries out circulation reading again after coming into inside channel, until reading data success, when
Inside channel when no data, then the type of sign of display no data is returned.
In one embodiment, it destroys channel and refers to the size of data that release channel is applied in creation.
In one embodiment, the thread creation channel in process, in channel read data, number is written in the channel
According to or destroy channel when be all to be controlled by thread lock, it is therefore an objective to prevent multiple threads while creating the same channel, keep away
Exempt from the same channel and the phenomenon that secondary creation and appearance secondary read-write of the same channel occur, each moment can only allow one
Thread operates the channel, avoids multiple threads while operation is so as to cause the data corruption inside channel, channel is being broken
Also the channel can only be discharged when ruining by a thread, after per thread has operated corresponding channel, another thread could be allowed
To operate effective corresponding channel.
For the very big problem of video codeword data stream, the present invention is provided with the video code flow of special storage big data, makes
Corresponding video code flow can be put into corresponding channel by it, and any thread can take out from the inside, and the video taken out
Code stream can clearly illustrate situations such as its size, source and type, and every channel all has the specifying information that display generates code stream,
Keep the management of video code flow very scientific, it is very clear, it solves traditional video code flow that takes out every time and has to use stb later
Mode judge determine after just can know that the information such as the type, size and source of video code flow, make it have code logic, it is readable
Property is very strong, simplifies operating procedure, has saved the time, high-efficient, present invention overcomes cause the systematic wasting of resources
And the problem of conflict, the utilization rate of system program stability, validity and system resource is greatly enhanced.
Above-described embodiment, only an example of the present invention, be not for limiting implementation and interest field of the invention,
All technical solutions identical or equivalent with content described in the claims in the present invention should all include in the scope of the present invention.
Claims (7)
1. a kind of cross-platform real-time communication system method is applied in the data interaction and code stream storage in process,
Be characterized in that: steps are as follows for application method:
A: cross-platform real-time communication pool, process unlatching before first all channels are initialized, need using
One thread creates a channel, and channel has been created when early period, does not just have to create again at this time;
B: after channel creates, data is written during channel is in communication and write a position, wherein writing a position is
Refer to write point one enclose position;As soon as need to change circle when writing a position and writing size circle, number of total coils multiplied by every circle size
It is to write the circle total data size that can a little deviate, wherein write the bias size for a little referring to that write-in data are total, a little write circle always when writing
When size of data, writes a zero and restart to write data;
C: when needing to read data from this channel, the position for determining read point is first had to, by read point after reading successfully
The size position of positional shift reading data;
D: inside the data of reading are enclosed two, then at this time relating to change circle, immediately will after having read a circle data
Read point position zero at this time is read, then proceedes to start to read in the dead-center position of next circle;
E: importing the type of reading in the data of step B, C, D, and the type of reading is data type, reads optional when data
Select the type for reading data;
F: finally destroying channel, and another channel must be re-created when channel needs to reactivate, is written and read again later
Operation;
When re-creating a new channel, read point and write a little all must return-to-zero;
When reading data and write-in data inside channel, read point position, which should be less than, writes a position, is greater than reading when writing a position
It in the case that point position one is enclosed, needs to reset read point position when reading data, makes read point position and write a position and be in same circle
In same point above.
2. the cross-platform real-time communication system method of one kind according to claim 1, it is characterised in that: in step B
Channel in be written data when, when in write-in data final stage when, circle total data size subtract the maximum value write a little after,
The size of a circle must be retained, the speed of write-in data can be kept up with to guarantee to read data.
3. the cross-platform real-time communication system method of one kind according to claim 1, it is characterised in that: in step C
It when reading data, locks by judge read point, writing size a little and whether can read data, when read point is greater than writing a little
When, then it represents that the error of read point position needs to relocate;When read point, which is less than, writes an a little circle, read point also needs to relocate,
To guarantee read point and write the data that read write-in above the size that a little can correctly enclose one;When read point, which is equal to, to be write, then
No new data is represented, other situations are normal read datas;In normal read data, when the data of reading appear in not
In the case where same circle, circle need to be changed immediately after running through when front ring, in order to read another part data, finally reading
The data copy taken is gone out.
4. the cross-platform real-time communication system method of one kind according to claim 3, it is characterised in that: in step C
External resetting read point is needed when reading data, the size of read point is then conveyed into channel to judge again, outside resetting is read
The mode of point, which can allow, read point and to be write a little on the same position.
5. the cross-platform real-time communication system method of one kind according to claim 1, it is characterised in that: in step E
When middle reading data type, during reading bit stream data, when the frame type for knowing reading code stream or to relocate
When to next frame data, needs first to come into the frame type code place value of reading inside channel again after outside is filled in, pass
Circulation reading is carried out again after inside stand in channel, until reading data success, inside channel when no data, then it is countless to return to display
According to type of sign.
6. the cross-platform real-time communication system method of one kind according to claim 1, it is characterised in that: destroy channel
Refer to the size of data that release channel is applied in creation.
7. the cross-platform real-time communication system method of one kind according to any one of claim 2,3 and 6, feature
Be: thread creation channel in process when reading data in channel, data being written in the channel or destroy channel is all logical
It crosses thread lock to control, it is therefore an objective to prevent multiple threads while create the same channel, avoid the same channel from occurring secondary
There is the phenomenon that secondary read-write in creation and the same channel, and each moment can only allow a thread to grasp the channel
Make, avoid multiple threads while operation so as to cause the data corruption inside channel, channel also can only be by a line when destroying
Journey discharges the channel, and after per thread has operated corresponding channel, it is effective corresponding logical to operate to allow another thread
Road.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510763821.5A CN105426261B (en) | 2015-11-11 | 2015-11-11 | A kind of cross-platform real-time communication system method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510763821.5A CN105426261B (en) | 2015-11-11 | 2015-11-11 | A kind of cross-platform real-time communication system method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105426261A CN105426261A (en) | 2016-03-23 |
CN105426261B true CN105426261B (en) | 2019-04-30 |
Family
ID=55504483
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510763821.5A Active CN105426261B (en) | 2015-11-11 | 2015-11-11 | A kind of cross-platform real-time communication system method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105426261B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113824973A (en) * | 2021-08-04 | 2021-12-21 | 杭州星犀科技有限公司 | Multi-platform direct-push plug flow method, system, electronic device and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6131113A (en) * | 1998-02-24 | 2000-10-10 | International Business Machines Corporation | Managing a shared resource in a multi-processor system |
US6304924B1 (en) * | 1999-02-02 | 2001-10-16 | International Business Machines Corporation | Two lock-free, constant-space, multiple-(impure)-reader, single-writer structures |
CN102789458A (en) * | 2011-05-18 | 2012-11-21 | 腾讯科技(深圳)有限公司 | Image file processing method and system |
CN103150220A (en) * | 2011-12-07 | 2013-06-12 | 腾讯科技(深圳)有限公司 | Method and system for interprocess communications |
CN103176852A (en) * | 2011-12-22 | 2013-06-26 | 腾讯科技(深圳)有限公司 | Method and device for inter-progress communication |
-
2015
- 2015-11-11 CN CN201510763821.5A patent/CN105426261B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6131113A (en) * | 1998-02-24 | 2000-10-10 | International Business Machines Corporation | Managing a shared resource in a multi-processor system |
US6304924B1 (en) * | 1999-02-02 | 2001-10-16 | International Business Machines Corporation | Two lock-free, constant-space, multiple-(impure)-reader, single-writer structures |
CN102789458A (en) * | 2011-05-18 | 2012-11-21 | 腾讯科技(深圳)有限公司 | Image file processing method and system |
CN103150220A (en) * | 2011-12-07 | 2013-06-12 | 腾讯科技(深圳)有限公司 | Method and system for interprocess communications |
CN103176852A (en) * | 2011-12-22 | 2013-06-26 | 腾讯科技(深圳)有限公司 | Method and device for inter-progress communication |
Also Published As
Publication number | Publication date |
---|---|
CN105426261A (en) | 2016-03-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107291558B (en) | Application program interface deadlock monitoring method and device | |
US20140067457A1 (en) | Workflow execution framework | |
CN107040585A (en) | A kind of method and device of business verification | |
US20150040140A1 (en) | Consuming Ordered Streams of Messages in a Message Oriented Middleware | |
CN107395665A (en) | A kind of block chain service handling and business common recognition method and device | |
US9934077B2 (en) | Reader-writer lock | |
CN103761474B (en) | A kind of method and device for monitoring the execution time of a monitoring method | |
CN105659274A (en) | Method and device for decoding data streams in reconfigurable platforms | |
CN106844682A (en) | Method for interchanging data, apparatus and system | |
WO2013104961A1 (en) | Triggering window conditions in stream computing applications | |
CN104951410B (en) | The access method and device of a kind of chip information | |
US20080059491A1 (en) | System and method for mapping events into a data structure | |
CN102981947A (en) | Data preparation method in test and system provided with the same | |
CN103631712B (en) | A kind of medelling software critical behavior tracking based on memory management | |
CN106775689A (en) | A kind of system and method for big data application and development | |
CN105426261B (en) | A kind of cross-platform real-time communication system method | |
CN106897338A (en) | A kind of data modification request processing method and processing device for database | |
CN108241676A (en) | Realize the method and apparatus that data synchronize | |
CN108170424A (en) | A kind of self extended method and system based on cloud knowledge base | |
CN103581611A (en) | Implementation method for audio and video recording based on routing server and routing server | |
CN105095268A (en) | Method and apparatus for accessing structured data | |
CN108073709A (en) | A kind of operating method of data record, device, equipment and storage medium | |
US11294885B2 (en) | Transactional integrity in a segmented database architecture | |
CN110502478B (en) | Data interaction method and system between offline systems | |
CN104539593B (en) | H.245 message resolution method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |