CN102868908B - High-efficiency streaming media playing method and device - Google Patents
High-efficiency streaming media playing method and device Download PDFInfo
- Publication number
- CN102868908B CN102868908B CN201110184906.XA CN201110184906A CN102868908B CN 102868908 B CN102868908 B CN 102868908B CN 201110184906 A CN201110184906 A CN 201110184906A CN 102868908 B CN102868908 B CN 102868908B
- Authority
- CN
- China
- Prior art keywords
- buffer
- play
- streaming media
- size
- audio
- 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.)
- Expired - Fee Related
Links
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention provides a high-efficiency streaming media playing method and a high-efficiency streaming media playing device. The method comprises the steps: establishing connection with a streaming media server; reading preset data from the steaming media server; analyzing the preset data according to a communication protocol of the steaming media server to acquire related parameter information; calculating the size of a buffer zone practically distributed according to the related parameter information, and then applying a memory with size equal to that of the buffer zone as a playing buffer zone; reading data stream from the steaming media server; storing the data stream to the playing buffer zone; and decoding and playing the data stream in the playing buffer zone according to the type of the steaming media. According to the scheme, steaming media at different code rates and in different network environments can be dynamically buffered by adopting a dynamic buffering management mode through analyzing the related parameters of the steaming media data to determine the size of the buffer zone, and an effect playing high-code steaming data fast can be fulfilled with lower component configuration.
Description
Technical field
The present invention relates to network communication technology field, particularly relate to a kind of highly efficient stream media playing method and device.
Background technology
Streaming Media (Streaming Media) technology is a kind of emerging network transmission technology, for the time-base media continuously of transmission of audio, video or multimedia file etc. in a network.Streaming technology is put into continuous print sound and image information on the webserver exactly after overcompression process, user is allowed to download while listen to viewing, and the network transmission technology just can watched after not needing to wait for whole file download to oneself machine, only can need play through the startup time delay of seconds or tens of seconds, reception limit, back play.
Along with the develop rapidly of multimedia technology and network technology, the application based on Streaming Media is also used in that video conference, video request program, the Internet are live, the numerous areas such as hand-held set and Set Top Box broadcasting.The transmission of Streaming Media, normally with what transmit as a stream, generally adopts real time streaming transport protocol (RTSP, Real Time Streaming Protocol) to transmit.Real Time Streaming needs specific server, the server of current main flow comprises the Windows Media of RealMedia, Microsoft of RealNetworks company and the QuickTime etc. of Apple company, these servers have oneself specific agreement and specific control method, and most Streaming Media schemes only support the smooth playing of certain streaming media server or certain stream media protocol.And for DST PLAYER, thousands of live broadcast stream media and kind in network enabled is needed more to put broadcasting flow-medium, form, the coding packaged type of these Streaming Medias are different, these abundant streaming media resources can be play with specific player on a personal computer, also can play on embedded device, the universal method of playing stream media is described for embedded device below:
Step one, the flow module fixedly opening this agreement according to protocol name are set up network and are connected;
Step 2, set up the buffer area of specific size;
Network for Streaming Media is play online, due to the difference of network self environment, cause the transmission speed of Streaming Media can not keep continuing unanimously, therefore streaming media data flow is needed to cushion, carried out the buffering started by the buffer area (such as 640K) arranging fixed size, solve the jitter problem because network transmission speed instability causes.
Step 3, employing process mode read data, read and play, repeatedly carry out the data interaction between process;
Step 4, the data read are passed to player decoder module decode;
Step 5, carry out showing according to the data of having decoded and the output of sound, the timestamp according to voice data carries out audio-visual synchronization;
The control (comprise beginning, suspend, exit) of step 6, broadcasting, wherein, the state information of broadcasting is obtained or is undertaken alternately by principal and subordinate (Master/Slave) mode in main application.
Above-mentioned prior art cushions because adopting the buffering area of fixed size, the Streaming Media that there will be some low code streams will wait for that the long period just starts to play, and the data that may cushion for the Streaming Media of some high code streams are inadequate, the stream information that can not carry out starting is resolved, cause follow-up decoder module failure or occur that buffered data is inadequate, play interrupted situation.In order to solve the result of broadcast of high code stream Streaming Media, need to configure the higher process chip of dominant frequency, memory size more greatly, parts that the performance such as more professional audio hardware is higher realize, and greatly add the cost of DST PLAYER.Such as, need when playing the high code stream audio frequency of 24bit the audio hardware equipment of specialty just can reach good result of broadcast, and when playing the H264 format video of 720P, need the predominant chip of 1GHz.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of highly efficient stream media player method, can solving prior art to realize the result of broadcast of high code stream Streaming Media, needing to configure high performance components and parts, thus greatly increases the problem of DST PLAYER cost.
Present invention also offers a kind of highly efficient stream media playing device, to ensure said method application in practice.
In order to solve the problem, the invention discloses a kind of highly efficient stream media player method, comprising: set up and be connected with streaming media server; Read the data of pre-sizing from described streaming media server, resolve the data of this pre-sizing according to the communications protocol of described streaming media server, obtain relevant parameter information; Wherein, described relevant parameter information comprises the type of Streaming Media, bit rate and/or file format; Calculate the buffer size needing actual allocated according to described relevant parameter information, then apply for that size equals the internal memory of this buffer size as play buffer; From described streaming media server reading data flow; Described data flow is saved to described play buffer; Type according to described Streaming Media is decoded to the data flow in described play buffer, is play.
Preferably, the described computing formula of the buffer size of actual allocated that needs is:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, described buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters.
Preferably, also comprised before described data flow in described play buffer being decoded, playing step: judge whether the buffered data in described play buffer reaches default beginning play buffering percentage, if so, follow-up decoding, playing flow is then performed; Otherwise, suspend and play.
Preferably, also comprise: judge whether the described number of times play that suspends reaches default threshold value, if so, then increases the preset value of described buffer time, recalculates the size of described buffering area, and adjust described play buffer according to the size of this buffering area.
Preferably, described data flow being saved in the process of described play buffer, buffer offset position is recorded; When described buffer offset position equals buffer size, be 0 by described buffer offset position reset, again fill described data flow from the starting position of play buffer; Decoding to the data flow in described play buffer, in playing process, record reading buffer position; When described reading buffer position equals buffer size, described reading buffer position is reset to 0, again reads described data flow from the starting position of play buffer.
Preferably, the described method connected with streaming media server specifically comprises: the communications protocol title according to described streaming media server sends connection request; If include connectivity port parameter in streaming media server address, then attempt successively connecting with other ports in the stream protocol connectivity port of presetting; Attempt successively by other Streaming Media communications protocol not comprising this communications protocol title, repeat above-mentioned connection procedure; Wherein, described Streaming Media communications protocol comprises real time streaming transport protocol, HTML (Hypertext Markup Language) and Microsoft's Streaming Media transportation protocol; Connect in step above-mentioned, as long as successful connection, then interrupt connection procedure and directly enter subsequent flows media play flow process.
Preferably, also comprise user interactions rate-determining steps, concrete grammar is: when player is started working, and creates a first two-way pipeline and a second two-way pipeline respectively; Described player reads the operation control command from user interactions control interface from the second two-way pipeline, and according to the state information of aforesaid operations control command to described first two-way pipeline write player; Described user interactions control interface reads the state information of described player from the first two-way pipeline, and to described second two-way pipeline write operation control command; Wherein, described operation control command comprise broadcasting, time-out, stopping.
Preferably, described Streaming Media is video flowing; Audio and video synchronization method when playing described video flowing is: with the audio time stamp in described video flowing for reference value, the difference of comparing audio timestamp, video time stamp and next reproduction time stamp, if the two equal or difference is within the offset error preset, then audio time stamp is adopted to be that reference value carries out audio-visual synchronization; Otherwise, adopt video time stamp to be that reference value carries out audio-visual synchronization.
According to another preferred embodiment of the present invention, also disclose a kind of highly efficient stream media playing device, comprise linkage unit, stream protocol analytic unit, buffer management unit, decoding broadcast unit and user interactions control interface, wherein: described linkage unit is for setting up the connection of described device and streaming media server; Described stream protocol analytic unit is used for the connection of setting up according to described linkage unit, the data of pre-sizing are read from described streaming media server, the data of this pre-sizing are resolved according to the communications protocol of described streaming media server, obtain relevant parameter information, wherein, described relevant parameter information comprises the type of Streaming Media, bit rate and/or file format; The relevant parameter information that described buffer management unit is used for obtaining according to described stream protocol analytic unit calculates the buffer size needing actual allocated, then applies for that size equals the internal memory of this buffer size as play buffer; And, from described streaming media server reading data flow, and described data flow is saved to described play buffer; Described decoding broadcast unit is used for the type of the Streaming Media obtained according to described stream protocol analytic unit, and the data flow in the play buffer write described buffer management unit is decoded, play; Described user interactions control interface is used for the control control command of user to be passed to described device, and, feed back the state information of described device.
Preferably, described buffer management unit specifically comprises computation subunit, cushioning control subelement and buffering area adjustment subelement, wherein:
The relevant parameter information that described computation subunit is used for obtaining according to described stream protocol analytic unit calculates the buffer size needing actual allocated, and its computing formula is as follows:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, described buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters;
Cushioning control subelement is for judging whether the buffered data in described play buffer reaches default beginning play buffering percentage, if not, then suspends the work of described decoding broadcast unit;
Whether adjustment subelement in described buffering area reaches default threshold value for the number of times judging described cushioning control subelement and suspend the work of described decoding broadcast unit, if, then increase the preset value of described buffer time, execution cost computation subunit recalculates the size of described buffering area, and adjusts described play buffer according to the size of this buffering area.
Preferably, also comprise circulating memory administrative unit, for controlling write and the reading of described play buffer, wherein: data flow be saved in the process of described play buffer in described buffer management unit, record buffer offset position; When described buffer offset position equals buffer size, be 0 by described buffer offset position reset, again fill described data flow from the starting position of play buffer; At described decoding broadcast unit, the data flow in described play buffer decoded, in playing process, record reading buffer position; When described reading buffer position equals buffer size, described reading buffer position is reset to 0, again reads described data flow from the starting position of play buffer.
Preferably, also comprise control information transfer unit, for creating a first two-way pipeline and a second two-way pipeline; When described device is started working, described parsing broadcast unit reads the operation control command from user interactions control interface from the second two-way pipeline, and writes the state information of described device to described first two-way pipeline according to aforesaid operations control command; Described user interactions control interface reads the state information of described device from the first two-way pipeline, and to described second two-way pipeline write operation control command; Wherein, described operation control command comprise broadcasting, time-out, stopping.
Preferably, also comprise audio-visual synchronization unit, for controlling the audio-visual synchronization of described decoding broadcast unit: with the audio time stamp in described video flowing for reference value, the difference of comparing audio timestamp, video time stamp and next reproduction time stamp, if the two equal or difference is within the offset error preset, then audio time stamp is adopted to be that reference value carries out audio-visual synchronization; Otherwise, adopt video time stamp to be that reference value carries out audio-visual synchronization.
Compared with prior art, the present invention has the following advantages:
The preferred embodiment of the present invention adopts dynamic buffer management mode, the size of buffering area is calculated by the relevant parameter (as bit rate) of analysis stream media data, achieve the dynamic buffering to Streaming Media under different code check different network environments, the quick result of broadcast of high code stream data can be realized with the configuration of lower components and parts.Solving prior art to realize the result of broadcast of high code stream Streaming Media, needing to configure high performance components and parts, thus greatly increase the problem of DST PLAYER cost.Based on this preferred embodiment scheme, dominant frequency is adopted to be the smooth playing that the chip of 360MHz can realize the high code stream audio stream of 24bit form, dominant frequency is adopted to be the smooth playing that the chip of 600MHz can realize 720P H264 format video stream, compared with the predominant chip needing 1GHz during video flowing with the same rank of prior art smooth playing, greatly can save implementation cost.
In the further preferred embodiment of the present invention, support multiple stream media protocol, the broadcasting to Streaming Media most of on network can be realized; Managed by circulating memory, decrease the distribution number of times of internal memory, can further improve memory efficient and system effectiveness, realize the effect of response fast; Suspend mechanism by buffering, reach the perfect result of broadcast of network environment difference.Utilize two-way pipeline to carry out the mutual of player and user interactions control interface (UI), achieve the mutual fast of UI and player, decrease system I/O operations number of times, UI response quickly.In addition, by new audio-visual synchronization mechanism, prior art can be avoided to carry out the synchronous audio and video playing asynchrony phenomenon that may be caused because the audio time stamp of part Streaming Media is forbidden of audio frequency and video according to audio time stamp.
Accompanying drawing explanation
Fig. 1 is the flow chart of highly efficient stream media player method first embodiment of the present invention;
Fig. 2 is the structured flowchart of highly efficient stream media playing device one embodiment of the present invention.
Embodiment
For enabling above-mentioned purpose of the present invention, feature and advantage become apparent more, and below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
Embodiment of the method one:
With reference to Fig. 1, show the flow process of highly efficient stream media player method first embodiment of the present invention, specifically comprise the following steps:
S101: set up and be connected with streaming media server;
Communications protocol title according to streaming media server sends connection request; If connection failure, then judge whether include connectivity port parameter in streaming media server address, if so, then attempt successively connecting with other stream protocol connectivity port; If connect or failure, attempt successively, by other Streaming Media communications protocol not comprising this communications protocol title, repeating above-mentioned connection procedure; Wherein, Streaming Media communications protocol comprises RTSP, HTTP and MMS (Microsoft Media Server) Protocol etc.; Connect in step above-mentioned, as long as successful connection, then interrupt connection procedure and directly enter subsequent flows media play flow process.
S102: the data reading pre-sizing from streaming media server, resolves the data of this pre-sizing according to the communications protocol of this streaming media server, obtain relevant parameter information;
Wherein, described relevant parameter information comprises the type of Streaming Media, bit rate and/or file format;
S103: calculate the buffer size needing actual allocated according to above-mentioned relevant parameter information, then applies for that size equals the internal memory of this buffer size as play buffer;
The computing formula of buffer size is:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters.
S104: from streaming media server reading data flow, and be saved to above-mentioned play buffer;
Data flow is being saved in the process of play buffer, is recording buffer offset position offset; When offset equals buffer size size, illustrate that buffering area is full, offset is reset to 0, again from the starting position padding data stream of play buffer;
S105: the type according to Streaming Media is decoded to the data flow in play buffer, play.
Wherein, can also comprise before step S105:
Judge whether the buffered data in play buffer reaches default beginning play buffering percentage, if so, then performs follow-up decoding, playing flow; Otherwise, suspend and play.
Judge that whether suspend the number of times play reaches default threshold value, if so, then increases the preset value of described buffer time, recalculates the size of described buffering area, and adjust described play buffer according to the size of this buffering area.
Decoding to the data flow in play buffer, in playing process, record and read buffer position pos; When pos equals size, illustrate that the digital independent in buffering area completes, pos is reset to 0, again read described data flow from the starting position of play buffer.
Embodiment of the method two:
In the preferred embodiment, comprise and connect, stream protocol analysis, circulating memory management, play and suspend the flow process such as control, dynamic buffer management, the management of UI user interactions.Wherein:
One, connect flow process, specifically comprises:
S201: connect according to the stream read module that protocol name preferentially adopts this protocol name to mate;
When connecting, preferably connection is set to non-blocking fashion, arranging time-out time is 10s.
S202: judge that whether connection establishment successful? if so, S211 is gone to step; Otherwise, go to step S203;
S203: judge streaming media server address strap ports having (Port), if so, go to step S204; Otherwise, go to step S206;
S204: the ip address that the domain name of preserving First Contact Connections has been resolved, attempts connecting other stream protocol port of generally acknowledging according to Current protocol type successively
What have domain name no longer carries out domain name mapping, directly with the parsing domain name IP preserved last time, accelerates connection speed.
S205: judge that whether connection establishment successful? if so, S211 is gone to step; Otherwise, go to step S206;
S206: according to RTSP agreement, http protocol, MMS (Microsoft Media Server) Protocol order, repeat step S201 ~ S205, until successful connection or failure.
The protocol sequence that conventional network flow-medium adopts is generally RTSP, HTTP, MMS, when performing this step, if will skip with the agreement of this protocol name coupling, no longer repeats to connect.
This preferred embodiment supports multiple stream media protocol, the connection with most of streaming media server on network can be set up, solving prior art needs the server fixedly opening this agreement according to protocol name to connect, the problem of the Streaming Media connection failure caused when protocol name and the actual agreement adopted are inconsistent.Streaming media server type on network is varied, and different streaming media servers can support different Streaming transfer protocol, such as HTML (Hypertext Markup Language) (HTTP for title, HyperText Transfer Protocol) or Microsoft Streaming Media transportation protocol (MMS, Microsoft Media Server protocol) etc. beginning, and the communications protocol that reality adopts is when being RTSP, to there is the problem of connection failure in prior art, and the preferred embodiment of the present invention can well solve this problem.
Two, circulating memory management process, specifically comprises:
S211: apply for a fritter internal memory;
This preferred embodiment selects 64K.
S212: the data first reading 10K, resolves and obtains relevant parameter information;
After reading completes, according to different stream media protocol RFC documents, analyze above-mentioned 10K data, parse the relevant information of data flow, such as stream type, bit rate, file format etc.
S213: according to the bit rate result analyzed out, calculates and needs actual buffer size;
Computing formula is:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
What-if bit rate is out 192kbps, and the bit stream buffer time is 5s, and buffering 20% starts to play, and the actual buffer size of needs is ((192/8) * 5*2)/0.2=1200KByte; For the code stream of 32kpbs, actual buffer size required when buffer time is 8s is ((32/8) * 8*2)/0.2=320KByte.
S214: according to above-mentioned result of calculation, applies for that one piece of memory field is as play buffer again;
After internal memory application, play buffer is pointed to again the position, memory field of new application, and to arrange buffer size be the buffer size newly calculated.
S215: adopt the write of circulating memory way to manage or read data;
For the data in play buffer, remember the deviation post offset of buffering area, the pos reading buffering and buffer size size; When offset equals size, represent that buffering is full, resetting offset is 0, again from 0, fills buffering area; When pos equals size, represent that the digital independent of buffering area completes, reset pos and equal 0 and read data again, circulate always.
By analyzing various stream media protocol feature, not only can realize fast and streaming media server connect, obtain data, and according to the bit rate dynamic assignment buffering area of Streaming Media, achieve the dynamic buffering to Streaming Media under different code check different network environments, can realize outside the quick result of broadcast of high code stream data with the configuration of lower components and parts, decoding can also be carried out play to mate relative decoding module by the stream media information that gets of fast resolving, further improve the playing efficiency of Streaming Media.
In addition, adopt the EMS memory management process that goes in ring, decrease Memory Allocation number of times, avoid frequent application and the dispose procedure of internal memory in data handling procedure, improve system effectiveness.
Three, play time-out to control
In order to ensure result of broadcast, this preferred embodiment adopts pre-cache method (play to suspend and control), a certain amount of data of buffer memory just start decoding and play (such as 20%), by starting resolution flow media information, obtain bit rate, changing into cache-time size with fixing data cached size, the size of data of such as 5S starts to play, namely ensure that the quick broadcasting of beginning, also ensure that result of broadcast.
Play and suspend control method 1: in playing process, if detect that the buffered data size that can read is 0, send to player and suspend (pause) message; When the buffered data size that can read reaches the buffer size starting to cushion (such as 20%), send to player and play (start) message;
Play and suspend control method 2: adopt player automatic pause waiting mechanism, detect the pos of buffering area, offset and size parameter, judges the size of data that buffering area also can read, when buffered data reaches default buffer size, start to play.
Four, dynamic buffer management
If there is the situation repeatedly suspending broadcasting in playing process, suitably can increase buffer time, recalculate and apply for buffer area by the method for step S213 ~ S214, the size of adjustment buffering area, has reached perfect result of broadcast.
Five, audio-visual synchronization
Audio time stamp according to obtaining makes reference value, obtain timestamp and the reproduction time of the next time stamp of video again, if both two difference precision are equal with audio frequency or close, audio time stamp is then adopted to carry out synchronously, if audio time stamp is very large, then video difference is adopted to carry out audio-visual synchronization as reference synchronization value.
Six, UI user interactions management
Two-way pipe method is adopted to realize the mutually mutual and control of player and UI.When player starts, create a two-way pipeline mcla, also create a two-way pipeline mcld in the main application of UI.The thread that player creates reads the state of the pipeline mcld of the main application of UI, performs the operation starting the UI such as broadcasting, time-out, stopping, simultaneously according to the UI associative operation read, writes the state value of the player required for UI toward pipeline mcla.The thread that UI creates reads the state information of the player of pipeline mcla, and simultaneously toward write control information in mcld pipeline and the message needing the state obtaining player, both carry out interacting message fast in two-way pipeline, carries out the mutual and control of mutual state.
The UI of this preferred embodiment and the interactive mode of player, not only solve when UI in prior art carries out mutually mutual, to adopt player to be embedded in main application and occur the problem that transplantability is poor, maintenance difficulties is large, it also avoid that prior art adopts slave pattern to carry out between player and UI mutual time the I/O operation that occurs many, the problem of poor controllability.
For aforesaid each embodiment of the method, simple in order to describe, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or perform simultaneously; Secondly, those skilled in the art also should know, said method embodiment all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
Device embodiment one:
In the preferred embodiment:
With reference to Fig. 2, show the structured flowchart of highly efficient stream media playing device one embodiment of the present invention, specifically comprise linkage unit 21, stream protocol analytic unit 22, buffer management unit 23, decoding broadcast unit 24, user interactions control interface 25, circulating memory administrative unit 26, control information transfer unit 27 and audio-visual synchronization unit 28, wherein:
Linkage unit 21 is for setting up the connection of this playing device and streaming media server; Specifically comprise: the communications protocol title according to streaming media server sends connection request, if successful connection, terminate connection procedure; Judge whether include connectivity port parameter in streaming media server address, if other ports then attempted successively in the stream protocol connectivity port commonly used connect; If can't be connected by above-mentioned each port, then attempt successively by other Streaming Media communications protocol (preferably attempting by the order of RTSP, HTTP, MMS) not comprising this communications protocol title, repeat above-mentioned connection procedure;
The connection of stream protocol analytic unit 22 for setting up according to linkage unit 21, the data of pre-sizing (as 10K) are read from streaming media server, resolve the data of this pre-sizing according to the communications protocol of this streaming media server, obtain the relevant parameter information such as type, bit rate (bps), file format of Streaming Media;
Buffer management unit 23 calculates for the relevant parameter information obtained according to stream protocol analytic unit 22 buffer size needing actual allocated, then applies for that size equals the internal memory of this buffer size as play buffer; Then, from this streaming media server reading data flow, and these data flow are saved to play buffer; Buffer management unit 23 specifically comprises computation subunit 231, cushioning control subelement 232 and buffering area adjustment subelement 233, wherein:
Computation subunit 231 calculates for the relevant parameter information obtained according to stream protocol analytic unit 22 buffer size needing actual allocated, and its computing formula is as follows:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters; As, the code stream that bit rate is 192Kbps, buffer time is 5s, buffering 20% starts broadcasting, actual buffer size=((192/8) * 8*2)/0.2=320Kbyte of its corresponding application.
Cushioning control subelement 232, for judging whether the buffered data in play buffer reaches default beginning play buffering percentage (as 20%), if not, then suspends the work of decoding broadcast unit 24;
Adjustment subelement 233 in buffering area is for judging whether the number of times of cushioning control subelement 232 time-out decoding broadcast unit work reaches default threshold value, if, then increase the preset value of described buffer time, execution cost computation subunit recalculates the size of described buffering area, and adjusts described play buffer according to the size of this buffering area.
Decoding broadcast unit 24 is decoded for the data flow in the play buffer that writes buffer management unit 23, is play;
User interactions control interface 25 for the control control command of user is passed to streaming medium playing device, and, feed back the state information of this streaming medium playing device.
Circulating memory administrative unit 26, for controlling write and the reading of play buffer, wherein: data flow be saved in the process of play buffer in buffer management unit 231, records buffer offset position offset; When buffer offset position offset equals buffer size size, represent that buffering area is full, this buffer offset position offset is reset to 0, again padding data stream from the starting position 0 of play buffer; Data flow in decoding broadcast unit 24 pairs of play buffer is decoded, in playing process, record and read buffer position pos; When this reading buffer position pos equals buffer size size, reading buffer position pos is reset to 0, again from the starting position reading data flow of play buffer.
Control information transfer unit 27, for creating a first two-way pipeline mcla and the second two-way pipeline mcld; When multimedia playing apparatus is started working, parsing broadcast unit 24 reads the operation control command from user interactions control interface from the second two-way pipeline mcld, and writes the state information of described device to the first two-way pipeline mcla according to aforesaid operations control command; User interactions control interface reads the state information of described device from the first two-way pipeline mcla, and to the second two-way pipeline mcla write operation control command; Wherein, operation control command comprises broadcasting, time-out, stops.
Audio-visual synchronization unit 28, for controlling the audio-visual synchronization of decoding broadcast unit 24: with the audio time stamp in video flowing for reference value, the difference of comparing audio timestamp, video time stamp and next reproduction time stamp, if the two equal or difference is within the offset error preset, then audio time stamp is adopted to be that reference value carries out audio-visual synchronization; Otherwise, adopt video time stamp to be that reference value carries out audio-visual synchronization.
It should be noted that, said apparatus embodiment belongs to preferred embodiment, and involved unit and module might not be that the present invention is necessary.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device embodiment of the present invention, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Above a kind of highly efficient stream media playing method and device provided by the present invention is described in detail, apply specific case herein to set forth principle of the present invention and execution mode, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.
Claims (10)
1. a highly efficient stream media player method, is characterized in that, comprising:
Set up and be connected with streaming media server;
Read the data of pre-sizing from described streaming media server, resolve the data of this pre-sizing according to the communications protocol of described streaming media server, obtain relevant parameter information; Wherein, described relevant parameter information comprises the type of Streaming Media, bit rate and/or file format;
Calculate the buffer size needing actual allocated according to described relevant parameter information, then apply for that size equals the internal memory of this buffer size as play buffer;
From described streaming media server reading data flow;
Described data flow is saved to described play buffer;
Judge whether the buffered data in described play buffer reaches default beginning play buffering percentage, if so, then decodes according to the type of described Streaming Media to the data flow in described play buffer, plays; Otherwise, suspend and play;
Judge whether the described number of times play that suspends reaches default threshold value, if so, then increases the preset value of described buffer time, recalculates the size of described buffering area, and adjust described play buffer according to the size of this buffering area.
2. the method for claim 1, is characterized in that, the described computing formula of the buffer size of actual allocated that needs is:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, described buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters.
3. the method for claim 1, is characterized in that:
Described data flow being saved in the process of described play buffer, record buffer offset position; When described buffer offset position equals buffer size, be 0 by described buffer offset position reset, again fill described data flow from the starting position of play buffer;
Decoding to the data flow in described play buffer, in playing process, record reading buffer position; When described reading buffer position equals buffer size, described reading buffer position is reset to 0, again reads described data flow from the starting position of play buffer.
4. the method for claim 1, is characterized in that, the described method connected with streaming media server specifically comprises:
Communications protocol title according to described streaming media server sends connection request;
If include connectivity port parameter in streaming media server address, then attempt successively connecting with other ports in the stream protocol connectivity port of presetting;
Attempt successively by other Streaming Media communications protocol not comprising this communications protocol title, repeat above-mentioned connection procedure; Wherein, described Streaming Media communications protocol comprises real time streaming transport protocol, HTML (Hypertext Markup Language) and Microsoft's Streaming Media transportation protocol;
Connect in step above-mentioned, as long as successful connection, then interrupt connection procedure and directly enter subsequent flows media play flow process.
5. the method for claim 1, is characterized in that, also comprises user interactions rate-determining steps, and concrete grammar is:
When player is started working, create a first two-way pipeline and a second two-way pipeline respectively; Described player reads the operation control command from user interactions control interface from the second two-way pipeline, and according to the state information of aforesaid operations control command to described first two-way pipeline write player; Described user interactions control interface reads the state information of described player from the first two-way pipeline, and to described second two-way pipeline write operation control command; Wherein, described operation control command comprise broadcasting, time-out, stopping.
6. the method for claim 1, is characterized in that, described Streaming Media is video flowing; Audio and video synchronization method when playing described video flowing is:
With the audio time stamp in described video flowing for reference value, the difference of comparing audio timestamp, video time stamp and next reproduction time stamp, if the two equal or difference is within the offset error preset, then audio time stamp is adopted to be that reference value carries out audio-visual synchronization; Otherwise, adopt video time stamp to be that reference value carries out audio-visual synchronization.
7. a highly efficient stream media playing device, is characterized in that, comprises linkage unit, stream protocol analytic unit, buffer management unit, decoding broadcast unit and user interactions control interface, wherein:
Described linkage unit is for setting up the connection of described device and streaming media server;
Described stream protocol analytic unit is used for the connection of setting up according to described linkage unit, the data of pre-sizing are read from described streaming media server, the data of this pre-sizing are resolved according to the communications protocol of described streaming media server, obtain relevant parameter information, wherein, described relevant parameter information comprises the type of Streaming Media, bit rate and/or file format;
The relevant parameter information that described buffer management unit is used for obtaining according to described stream protocol analytic unit calculates the buffer size needing actual allocated, then applies for that size equals the internal memory of this buffer size as play buffer; And, from described streaming media server reading data flow, and described data flow is saved to described play buffer;
Described decoding broadcast unit is used for the type of the Streaming Media obtained according to described stream protocol analytic unit, and the data flow in the play buffer write described buffer management unit is decoded, play;
Described user interactions control interface is used for the control control command of user to be passed to described device, and, feed back the state information of described device;
Described buffer management unit specifically comprises computation subunit, cushioning control subelement and buffering area adjustment subelement, wherein:
The relevant parameter information that described computation subunit is used for obtaining according to described stream protocol analytic unit calculates the buffer size needing actual allocated, and its computing formula is as follows:
Buffer size=((bit rate/8) * buffer time * audio sound number of channels)/beginning play buffering percentage
Wherein, described buffer time, audio sound number of channels, beginning play buffering percentage are default streaming media playing controling parameters;
Cushioning control subelement is for judging whether the buffered data in described play buffer reaches default beginning play buffering percentage, if not, then suspends the work of described decoding broadcast unit;
Whether adjustment subelement in described buffering area reaches default threshold value for the number of times judging described cushioning control subelement and suspend the work of described decoding broadcast unit, if, then increase the preset value of described buffer time, execution cost computation subunit recalculates the size of described buffering area, and adjusts described play buffer according to the size of this buffering area.
8. device as claimed in claim 7, is characterized in that, also comprise circulating memory administrative unit, for controlling write and the reading of described play buffer, wherein:
In described buffer management unit, data flow is saved in the process of described play buffer, records buffer offset position; When described buffer offset position equals buffer size, be 0 by described buffer offset position reset, again fill described data flow from the starting position of play buffer;
At described decoding broadcast unit, the data flow in described play buffer decoded, in playing process, record reading buffer position; When described reading buffer position equals buffer size, described reading buffer position is reset to 0, again reads described data flow from the starting position of play buffer.
9. device as claimed in claim 7, is characterized in that, also comprise control information transfer unit, for creating a first two-way pipeline and a second two-way pipeline; When described device is started working, described parsing broadcast unit reads the operation control command from user interactions control interface from the second two-way pipeline, and writes the state information of described device to described first two-way pipeline according to aforesaid operations control command; Described user interactions control interface reads the state information of described device from the first two-way pipeline, and to described second two-way pipeline write operation control command; Wherein, described operation control command comprise broadcasting, time-out, stopping.
10. device as claimed in claim 7, it is characterized in that, also comprise audio-visual synchronization unit, for controlling the audio-visual synchronization of described decoding broadcast unit: with the audio time stamp in described video flowing for reference value, the difference of comparing audio timestamp, video time stamp and next reproduction time stamp, if the two equal or difference is within the offset error preset, then audio time stamp is adopted to be that reference value carries out audio-visual synchronization; Otherwise, adopt video time stamp to be that reference value carries out audio-visual synchronization.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110184906.XA CN102868908B (en) | 2011-07-04 | 2011-07-04 | High-efficiency streaming media playing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110184906.XA CN102868908B (en) | 2011-07-04 | 2011-07-04 | High-efficiency streaming media playing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102868908A CN102868908A (en) | 2013-01-09 |
CN102868908B true CN102868908B (en) | 2015-05-20 |
Family
ID=47447468
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110184906.XA Expired - Fee Related CN102868908B (en) | 2011-07-04 | 2011-07-04 | High-efficiency streaming media playing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102868908B (en) |
Families Citing this family (31)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103294782B (en) * | 2013-05-15 | 2018-02-16 | 小米科技有限责任公司 | A kind of data exhibiting process and device |
CN104166452B (en) * | 2013-05-20 | 2017-08-11 | 深圳市快播科技有限公司 | Electricity saving method and its system for video play device |
CN103347212B (en) * | 2013-06-04 | 2016-04-27 | 青岛海信宽带多媒体技术有限公司 | The playing method and device of VOD program |
CN103501443A (en) * | 2013-09-13 | 2014-01-08 | 天脉聚源(北京)传媒科技有限公司 | Processing method and device of streaming media data |
EP3123335B1 (en) * | 2014-03-26 | 2018-08-29 | TiVo Solutions Inc. | Multimedia pipeline architecture |
CN103929608B (en) * | 2014-04-16 | 2017-06-16 | 浙江宇视科技有限公司 | The method and device of a kind of dynamically distributes buffer memory capacity |
CN105100172B (en) | 2014-05-22 | 2018-03-27 | 华为技术有限公司 | The buffer status update method and equipment of a kind of http protocol, processor |
CN104066000A (en) * | 2014-06-10 | 2014-09-24 | 百度在线网络技术(北京)有限公司 | Monitoring method and device for playing quality of streaming media file |
CN104133782B (en) * | 2014-07-04 | 2017-08-22 | 深圳英飞拓科技股份有限公司 | A kind of digital supervision platform internal memory adaptive management method and device |
CN104182355B (en) * | 2014-08-29 | 2017-06-23 | 广州华多网络科技有限公司 | A kind of memory allocation method and device |
CN104883626A (en) * | 2015-05-22 | 2015-09-02 | 深圳市九洲电器有限公司 | Method and system for streaming media management |
CN105979345A (en) * | 2015-12-03 | 2016-09-28 | 乐视致新电子科技(天津)有限公司 | Video data processing method and device |
CN105872722A (en) * | 2015-12-18 | 2016-08-17 | 乐视致新电子科技(天津)有限公司 | Online video start playing caching system and method |
CN105657540B (en) * | 2016-01-05 | 2019-02-22 | 珠海全志科技股份有限公司 | A kind of video encoding/decoding method and its device being adapted to Android system |
CN105657523B (en) | 2016-01-28 | 2019-11-08 | 腾讯科技(深圳)有限公司 | The method and apparatus that video preloads |
CN105979350B (en) * | 2016-05-05 | 2019-03-08 | 联发科技(新加坡)私人有限公司 | A kind of method and related device of play position that searching for played file |
CN106294827A (en) * | 2016-08-17 | 2017-01-04 | 合网络技术(北京)有限公司 | The caching method of multimedia resource and device |
CN107959659B (en) * | 2016-10-17 | 2021-01-29 | 杭州海康威视数字技术股份有限公司 | Streaming media playing control method and device and electronic equipment |
CN107222776B (en) * | 2017-05-19 | 2019-03-01 | 腾讯科技(深圳)有限公司 | Video playing control method, browser, storage equipment and terminal |
CN107396172A (en) * | 2017-08-29 | 2017-11-24 | 四川长虹电器股份有限公司 | The method that low latency throws screen |
CN108810656B (en) * | 2018-06-12 | 2021-10-26 | 深圳国微视安科技有限公司 | Real-time live broadcast TS (transport stream) jitter removal processing method and processing system |
CN110856028B (en) * | 2018-08-20 | 2021-12-14 | 上海途擎微电子有限公司 | Media data playing method, equipment and storage medium |
CN109168083B (en) * | 2018-10-23 | 2021-05-28 | 海信视像科技股份有限公司 | Streaming media real-time playing method and device |
CN111479160B (en) | 2019-01-23 | 2023-02-21 | 上海哔哩哔哩科技有限公司 | Web video intelligent buffering method and device based on browser and storage medium |
CN110740374B (en) * | 2019-10-31 | 2022-03-11 | 广州市网星信息技术有限公司 | Multimedia data processing method and device, computer equipment and storage medium |
CN112291607B (en) * | 2020-10-29 | 2022-11-29 | 成都极米科技股份有限公司 | Video and audio data synchronous output method and system thereof |
CN112616088A (en) * | 2020-11-26 | 2021-04-06 | 北京乐学帮网络技术有限公司 | Rendering method and device, electronic equipment and computer readable storage medium |
CN114629880B (en) * | 2020-12-10 | 2024-05-10 | 西安诺瓦星云科技股份有限公司 | Streaming media video source management method and device and plug-in card type video splicing processing equipment |
US11818189B2 (en) * | 2021-01-06 | 2023-11-14 | Tencent America LLC | Method and apparatus for media streaming |
CN114786056A (en) * | 2022-05-07 | 2022-07-22 | 中国第一汽车股份有限公司 | Cross-operating-system video projection display method, system and device based on Hypervisor and vehicle |
CN115242735B (en) * | 2022-09-22 | 2022-12-16 | 中邮消费金融有限公司 | Real-time voice stream slice analysis method, system and computer equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1669019A (en) * | 2002-07-16 | 2005-09-14 | 诺基亚有限公司 | Method for enabling packet transfer delay compensation in multimedia streaming |
CN1753503A (en) * | 2004-09-24 | 2006-03-29 | 微软公司 | Methods and systems for presentation of media obtained from a media stream |
CN1890736A (en) * | 2003-12-03 | 2007-01-03 | 皇家飞利浦电子股份有限公司 | Power saving methode and system |
CN101296158A (en) * | 2007-04-26 | 2008-10-29 | 深圳市同洲电子股份有限公司 | Stream media data transmission method and data transmission device thereof |
CN102447950A (en) * | 2010-09-30 | 2012-05-09 | 突触计算机***(上海)有限公司 | Method and equipment for video play |
-
2011
- 2011-07-04 CN CN201110184906.XA patent/CN102868908B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1669019A (en) * | 2002-07-16 | 2005-09-14 | 诺基亚有限公司 | Method for enabling packet transfer delay compensation in multimedia streaming |
CN1890736A (en) * | 2003-12-03 | 2007-01-03 | 皇家飞利浦电子股份有限公司 | Power saving methode and system |
CN1753503A (en) * | 2004-09-24 | 2006-03-29 | 微软公司 | Methods and systems for presentation of media obtained from a media stream |
CN101296158A (en) * | 2007-04-26 | 2008-10-29 | 深圳市同洲电子股份有限公司 | Stream media data transmission method and data transmission device thereof |
CN102447950A (en) * | 2010-09-30 | 2012-05-09 | 突触计算机***(上海)有限公司 | Method and equipment for video play |
Also Published As
Publication number | Publication date |
---|---|
CN102868908A (en) | 2013-01-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102868908B (en) | High-efficiency streaming media playing method and device | |
US10511646B2 (en) | System and method for delivering content | |
US9247276B2 (en) | System and method for progressive delivery of media content | |
CN104796796B (en) | Improve the fault-tolerant method of the HLS streaming players of Android platform | |
CN103765905B (en) | The method and apparatus of the self adaptation transcoding of media stream | |
JP6014870B2 (en) | Method and system for real-time transmax conversion of streaming media content | |
JP6308442B2 (en) | Method, device, and system for obtaining streaming media data | |
US8560729B2 (en) | Method and apparatus for the adaptation of multimedia content in telecommunications networks | |
CN100456284C (en) | Sparse caching for streaming media | |
US20120011267A1 (en) | Live streaming media delivery for mobile audiences | |
WO2016138844A1 (en) | Multimedia file live broadcast method, system and server | |
CN109168031A (en) | Streaming Media method for pushing and device, steaming media platform | |
JP2019193312A (en) | System and method for frame duplication and frame extension in live video encoding and streaming | |
CN109314784A (en) | System and method for video content | |
JP2013118678A (en) | Multi-user remote video editing | |
CN103281568A (en) | Method and system for realizing direct playing of dynamic code rate by streaming media | |
TW201249185A (en) | Method for dynamic adaptation of the reception bitrate and associated receiver | |
CN108063971A (en) | Multimedia playing apparatus and method | |
CN205230019U (en) | System for realize video seamless handover between many screens | |
CN105992049A (en) | RTMP live broadcast playback method and system | |
JP4283186B2 (en) | Bidirectional video communication quality control system, user terminal, quality management server and program | |
JP2002077857A (en) | Apparatus for sending multimedia data | |
JP2003143575A (en) | Multimedia reproducing method and device | |
CN101465861B (en) | System, method and computer programming product for transmitting and/or receiving medium current | |
Sendín‐Raña et al. | Emulating Access Grid features at Web endpoints: a developer's view |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
DD01 | Delivery of document by public notice |
Addressee: Harbin Rongzhida Network Technology Co., Ltd. Document name: Notification to Pay the Fees |
|
DD01 | Delivery of document by public notice | ||
DD01 | Delivery of document by public notice |
Addressee: Harbin Rongzhida Network Technology Co., Ltd. Document name: Notification of Termination of Patent Right |
|
DD01 | Delivery of document by public notice | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20150520 Termination date: 20180704 |
|
CF01 | Termination of patent right due to non-payment of annual fee |