The content of the invention
To overcome above-mentioned technical problem or solving above-mentioned technical problem at least in part, spy proposes following technical scheme:
One embodiment of the present of invention proposes a kind of method for adjusting multimedia decoding message buffer, including:
When monitoring multimedia messages decoding completion, based on the multimedia parameter got according to decoding data, judge
Whether need to redistribute buffering area, to cache decoding data;
When judging to need to redistribute buffering area, the buffering area redistributed is determined based on multimedia parameter;
Decoding data is cached in the buffering area redistributed.
Preferably, before the step of multimedia messages are decoded, in addition to:
Based on Buffer allocation parameter, the initial capacity of allocation buffer is initialized;
Wherein, based on multimedia parameter, the step of judging whether to need to redistribute buffering area, including:
Comparative result based on multimedia parameter with the initial capacity of initialization allocation buffer, judges whether to need again
Allocation buffer.
Preferably, when comparative result meets following any one, judgement needs to redistribute buffering area:
Comparative result is less than multimedia parameter for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
Based on predetermined operation mode by calculating obtained result of calculation;Or
Comparative result is more than multimedia parameter for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
Based on predetermined operation mode by calculating obtained result of calculation, and both differences are more than first threshold.
Wherein, multimedia parameter includes the instruction that the reference frame number of multimedia messages, multimedia messages whether there is B frames
Parameter value, preset relevant parameter.
Preferably, the step of the buffering area redistributed is determined based on multimedia parameter, including:
The instruction parameter value and preset phase of reference frame number, multimedia messages based on multimedia messages with the presence or absence of B frames
Related parameter, it is determined that redistributing the number of buffering area;
Based on the number for redistributing buffering area, open multimedia acceleration layer OpenMax releasing memory is notified and called
Function, the buffering area of release initialization distribution, and open multimedia acceleration layer OpenMax storage allocation function is called, again
Allocation buffer.
Preferably, this method also includes:
Based on the quantity for redistributing buffering area, Buffer allocation parameter is updated.
An alternative embodiment of the invention proposes a kind of device for adjusting multimedia decoding message buffer, including:
Monitoring modular, for when monitor multimedia messages decoding completion when, based on according to decoding data get it is many
Media parameter, judges whether to need to redistribute buffering area, to cache decoding data;
Distribute module, for needing to redistribute buffering area when judgement, determines that redistributes delays based on multimedia parameter
Rush area;
Cache module, for being cached to decoding data in the buffering area redistributed.
Preferably, the device also includes:Initialization module, for based on Buffer allocation parameter, initializing distributing buffer
The initial capacity in area;
Wherein, monitoring modular, for the comparison knot based on multimedia parameter with the initial capacity of initialization allocation buffer
Really, judge whether to need to redistribute buffering area.
Preferably, when comparative result meets following any one, judgement needs to redistribute buffering area:
Comparative result is less than multimedia parameter for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
Based on predetermined operation mode by calculating obtained result of calculation;Or
Comparative result is more than multimedia parameter for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
Based on predetermined operation mode by calculating obtained result of calculation, and both differences are more than first threshold.
Wherein, multimedia parameter includes the instruction that the reference frame number of multimedia messages, multimedia messages whether there is B frames
Parameter value, preset relevant parameter.
Preferably, buffer module includes:
Determining unit, joins for the reference frame number based on multimedia messages, multimedia messages with the presence or absence of the instruction of B frames
Numerical value and preset relevant parameter, it is determined that redistributing the number of buffering area;
Unit is redistributed, for based on the number for redistributing buffering area, notifying and calling open multimedia acceleration layer
OpenMax releasing memory function, the buffering area of release initialization distribution, and call open multimedia acceleration layer OpenMax's
Storage allocation function, redistributes buffering area.
Preferably, the device also includes:Update module, for based on the quantity for redistributing buffering area, updating buffering area
Allocation of parameters.
In technical scheme, when monitoring multimedia messages decoding completion, based on being obtained according to decoding data
The multimedia parameter arrived, judges whether to need to redistribute buffering area, to cache decoding data;When judging that it is slow that needs are redistributed
Area is rushed, the buffering area for determining to redistribute based on multimedia parameter;Decoding data is cached in the buffering area redistributed;From
And the purpose that the multimedia parameter based on multimedia messages to be played enters Mobile state adjustment to preset buffer area is realized,
Satisfaction smoothly plays multimedia messages to be played, it is to avoid the feelings of interim card or mistake occur when there are playing multimedia messages to be played
While condition, moreover it is possible to reduce to the occupancy of redundant system internal memory, thus avoid influenceing playback equipment system performance and its
The operation that he applies, improves the usage experience of user.
The additional aspect of the present invention and advantage will be set forth in part in the description, and these will become from the following description
Obtain substantially, or recognized by the practice of the present invention.
Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end
Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached
The embodiment of figure description is exemplary, is only used for explaining the present invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one
It is individual ", " described " and "the" may also comprise plural form.It is to be further understood that what is used in the specification of the present invention arranges
Diction " comprising " refer to there is the feature, integer, step, operation, element and/or component, but it is not excluded that in the presence of or addition
Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member
Part is " connected " or during " coupled " to another element, and it can be directly connected or coupled to other elements, or can also exist
Intermediary element.In addition, " connection " used herein or " coupling " can include wireless connection or wireless coupling.It is used herein to arrange
Taking leave "and/or" includes one or more associated wholes or any cell for listing item and all combines.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific terminology), with the general understanding identical meaning with the those of ordinary skill in art of the present invention.Should also
Understand, those terms defined in such as general dictionary, it should be understood that with the context with prior art
The consistent meaning of meaning, and unless by specific definitions as here, otherwise will not use idealization or excessively formal implication
To explain.
Fig. 1 is the schematic flow sheet of the method for the adjustment multimedia decoding message buffer of one embodiment of the invention.
It should be noted that the executive agent of the present embodiment is hardware vendor's decoding storehouse.Hardware vendor's decoding storehouse is embedded
The routine interface for a set of encapsulation that formula device core chip maker provides, can complete the encoding and decoding of multimedia messages, such as
The encoding and decoding and distribution of Voice & Video etc. and the buffering area for discharging the decoding data for buffer multimedia information;Simultaneously
Hardware vendor's decoding storehouse can also be communicated with gst-omx modules.
Step S101:When monitoring multimedia messages decoding completion, based on the multimedia got according to decoding data
Parameter, judges whether to need to redistribute buffering area, to cache decoding data;Step S102:When judging that it is slow that needs are redistributed
Area is rushed, the buffering area for determining to redistribute based on multimedia parameter;Step S103:Decoding data is cached to redistribute slow
Rush in area.
In technical scheme, when monitoring multimedia messages decoding completion, based on being obtained according to decoding data
The multimedia parameter arrived, judges whether to need to redistribute buffering area, to cache decoding data;When judging that it is slow that needs are redistributed
Area is rushed, the buffering area for determining to redistribute based on multimedia parameter;Decoding data is cached in the buffering area redistributed;From
And the purpose that the multimedia parameter based on multimedia messages to be played enters Mobile state adjustment to preset buffer area is realized,
Satisfaction smoothly plays multimedia messages to be played, it is to avoid the feelings of interim card or mistake occur when there are playing multimedia messages to be played
While condition, moreover it is possible to reduce to the occupancy of redundant system internal memory, thus avoid influenceing playback equipment system performance and its
The operation that he applies, improves the usage experience of user.
It is described further below for implementing for each step:
Step S101:When monitoring multimedia messages decoding completion, based on the multimedia got according to decoding data
Parameter, judges whether to need to redistribute buffering area, to cache decoding data.
Wherein, multimedia messages include but is not limited to:Video information, audio-frequency information.
Wherein, multimedia parameter includes the instruction that the reference frame number of multimedia messages, multimedia messages whether there is B frames
Parameter value, preset relevant parameter;Preset relevant parameter include avoiding output pause buffering area number, reconstruction frames number,
The reserved buffer number of SurfaceFlinger components.
Specifically, before the step of multimedia messages are decoded, in addition to:Based on Buffer allocation parameter, initialization distribution
The initial capacity of buffering area.
Wherein, Buffer allocation parameter is Buffer allocation number.
Specifically, based on multimedia parameter, the step of judging whether to need to redistribute buffering area, including:Based on many matchmakers
The comparative result of body parameter and the initial capacity of initialization allocation buffer, judges whether to need to redistribute buffering area.
Wherein, when comparative result meets following any one, judgement needs to redistribute buffering area:Comparative result is initial
The corresponding buffering area number of initial capacity for changing the buffering area of distribution passes through meter less than multimedia parameter based on predetermined operation mode
Obtained result of calculation;Or comparative result is more than for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
The result of calculation that multimedia parameter is obtained based on predetermined operation mode by calculating, and both differences are more than first threshold.The
One threshold value can be set to 1 or 2.
For example, hardware vendor's decoding storehouse is based on Buffer allocation number " 15 ", the initial capacity of allocation buffer is initialized
For the buffer memory capacity of 15 buffering areas, and each buffering area is prefixed capacity, such as 4M;Hardware vendor decodes storehouse to video information
Decoded;As shown in Fig. 2 when hardware vendor's decoding storehouse monitors that the video-information decoding is completed, believing according to from the video
The reference frame number and video information for the video information for obtaining or extracting in the decoding data of breath are joined with the presence or absence of the instruction of B frames
Numerical value, and preset relevant parameter, for example, the reference frame number " 2 " based on video information is individual, video information whether there is B frames
Instruction parameter value " 1 ", and preset relevant parameter numerical value " 6 ", and based on following formula 1) draw needed for allocation buffer number,
To cache the decoding data of the video information:
Formula 1) needed for allocation buffer number
=info->numRefFrames+info->has_b_frames+1+1+4
Wherein, info->NumRefFrames is the reference frame number of video information, and has_b_frames is video information
With the presence or absence of the instruction parameter of B frames, first " 1 ", to avoid output pause buffering area number, second " 1 " is reconstruction frames
Number, " 4 " are the reserved buffer number of SurfaceFlinger components.
By above-mentioned formula 1) calculate can determine that, it is necessary to distribute 9 buffering areas to cache the decoding data of the video information;So
Afterwards according to initial capacity 15 capacity with needing allocation buffer of corresponding buffering area number of the buffering area of initialization distribution
Corresponding buffering area number 9 compares, and show that comparative result is corresponding slow for the initial capacity of the buffering area of initialization distribution
Area's number " 15 " is rushed more than the result of calculation that multimedia parameter is obtained based on predetermined operation mode by calculating, i.e., above-mentioned formula 1)
The result of calculation " 9 " gone out, and both differences " 6 " are more than first threshold " 1 " or " 2 ".Then need to redistribute buffering area, with slow
Deposit the decoding data of video information.
It should be noted that when the video information has B frames, then the video information whether there is the instruction parameter of B frames
It is worth for 1;When B frames are not present in the video information, then the video information is 0 with the presence or absence of the instruction parameter value of B frames.And avoid defeated
Go out to suspend buffering area number be predisposed to 1, reconstruction frames number be predisposed to 1, the reserved buffer of SurfaceFlinger components
Number is predisposed to 4.
Step S102:When judging to need to redistribute buffering area, the buffering area redistributed is determined based on multimedia parameter.
Specifically, the step of determining to redistribute buffering area based on multimedia parameter, including:Based on multimedia messages
Reference frame number, multimedia messages whether there is the instruction parameter value and preset relevant parameter of B frames, it is determined that redistributing buffering area
Number;Based on the number for redistributing buffering area, open multimedia acceleration layer OpenMax releasing memory letter is notified and called
Number, the buffering area of release initialization distribution, and open multimedia acceleration layer OpenMax storage allocation function is called, divide again
With buffering area.
For example, as shown in Fig. 2 when hardware vendor's decoding storehouse judges to need to redistribute buffering area, then according to from the video
The reference frame number and video information for the video information for obtaining or extracting in the decoding data of information whether there is the instruction of B frames
Parameter value, and preset relevant parameter, for example, the reference frame number " 2 " based on video information is individual, video information whether there is B
The instruction parameter value " 1 " of frame, and preset relevant parameter numerical value " 6 ", and based on following formula 2) draw needed for allocation buffer
Number, to cache the decoding data of the video information:
Formula 2)
Redistribute number=info- of buffering area>numRefFrames+info->has_b_frames+1+1+4
Wherein, info->NumRefFrames is the reference frame number of video information, and has_b_frames is video information
With the presence or absence of the instruction parameter of B frames, first " 1 ", to avoid output pause buffering area number, second " 1 " is reconstruction frames
Number, " 4 " are the reserved buffer number of SurfaceFlinger components.
By above-mentioned formula 2) calculate can determine that, 9 buffering areas are redistributed to cache the decoding data of the video information;Firmly
Part manufacturer decoding storehouse is individual based on the number " 9 " for redistributing buffering area, and the plug-in unit gst-omx modules into Gstreamer are sent
Announcement information, notifies gst-omx modules redistribute buffering area and redistribute the number of buffering area to be 9, gst-omx modules
After the announcement information that hardware vendor's decoding storehouse is sent is received, the announcement information is confirmed, and call open multimedia
Acceleration layer OpenMax releasing memory function OMX_FreeBuffer, 15 buffering areas of release initialization distribution, is recalled out
The storage allocation function OMX_AllocateBuffer for putting multimedia acceleration layer OpenMax redistributes 9 buffering areas.
Step S103:Decoding data is cached in the buffering area redistributed.
Specifically, after gst-omx modules redistribute buffering area, by the decoding data of multimedia messages, e.g., video letter
The decoding data of breath, is cached into the buffering area redistributed.
Specifically, this method also includes:Based on the quantity for redistributing buffering area, Buffer allocation parameter is updated.
For example, as shown in Fig. 2 gst-omx modules complete to cache the decoding data of video information to redistributing
After in buffering area, announcement information is sent to hardware vendor's decoding storehouse, notifies hardware vendor to decode storehouse Buffer allocation number and repaiied
Change, and Buffer allocation number is revised as 9;Hardware vendor's decoding storehouse is receiving the notice that gst-omx modules are sent
After information, confirm that buffering area has been redistributed, and update Buffer allocation number.
Fig. 3 for the present invention in another embodiment adjustment multimedia decoding message buffer device structural framing
Schematic diagram.
Monitoring modular, when monitoring multimedia messages decoding completion, based on the multimedia got according to decoding data
Parameter, judges whether to need to redistribute buffering area, to cache decoding data;Distribute module, when judging that it is slow that needs are redistributed
Area is rushed, determines to redistribute buffering area based on multimedia parameter;Cache module, decoding data is cached to the buffering redistributed
Qu Zhong.
It is described further below for implementing for modules:
Monitoring modular, when monitoring multimedia messages decoding completion, based on the multimedia got according to decoding data
Parameter, judges whether to need to redistribute buffering area, to cache decoding data.
Wherein, multimedia messages include but is not limited to:Video information, audio-frequency information.
Wherein, multimedia parameter includes the instruction that the reference frame number of multimedia messages, multimedia messages whether there is B frames
Parameter value, preset relevant parameter;Preset relevant parameter include avoiding output pause buffering area number, reconstruction frames number,
The reserved buffer number of SurfaceFlinger components.
Specifically, the device also includes:Initialization module, based on Buffer allocation parameter, initialization allocation buffer
Initial capacity.
Wherein, Buffer allocation parameter is Buffer allocation number.
Specifically, monitoring modular, the comparative result based on multimedia parameter with the initial capacity of initialization allocation buffer,
Judge whether to need to redistribute buffering area.
Wherein, when comparative result meets following any one, judgement needs to redistribute buffering area:Comparative result is initial
The corresponding buffering area number of initial capacity for changing the buffering area of distribution passes through meter less than multimedia parameter based on predetermined operation mode
Obtained result of calculation;Or comparative result is more than for the corresponding buffering area number of initial capacity of the buffering area of initialization distribution
The result of calculation that multimedia parameter is obtained based on predetermined operation mode by calculating, and both differences are more than first threshold.The
One threshold value can be set to 1 or 2.
For example, initialization module is based on Buffer allocation number " 15 ", the initial capacity of initialization allocation buffer is 15
The buffer memory capacity of individual buffering area, and each buffering area is prefixed capacity, such as 4M;Hardware vendor decodes storehouse and video information is carried out
Decoding;When monitoring module monitors to the video-information decoding are completed, according to from the decoding data of the video information obtain or
The reference frame number and video information for the video information extracted whether there is the instruction parameter value of B frames, and preset related ginseng
Number, for example, the reference frame number " 2 " based on video information is individual, video information whether there is the instruction parameter value " 1 " of B frames, and in advance
Put the numerical value " 6 " of relevant parameter, and based on following formula 1) draw needed for allocation buffer number, to cache the solution of the video information
Code data:
Formula 1)
Number=info- of required allocation buffer>numRefFrames+info->has_b_frames+1+1+4
Wherein, info->NumRefFrames is the reference frame number of video information, and has_b_frames is video information
With the presence or absence of the instruction parameter of B frames, first " 1 ", to avoid output pause buffering area number, second " 1 " is reconstruction frames
Number, " 4 " are the reserved buffer number of SurfaceFlinger components.
By above-mentioned formula 1) calculate can determine that, it is necessary to distribute 9 buffering areas to cache the decoding data of the video information;So
The corresponding buffering area number of initial capacity for the buffering area that monitoring modular is distributed according to initialization 15 is with needing distributing buffer afterwards
The corresponding buffering area number of capacity 9 in area compares, and draws initial capacity of the comparative result for the buffering area of initialization distribution
Corresponding buffering area number " 15 " is more than multimedia parameter based on predetermined operation mode by calculating obtained result of calculation, i.e., on
State formula 1) result of calculation " 9 " that draws, and both differences " 6 " are more than first threshold " 1 " or " 2 ".Then need to redistribute slow
Area is rushed, with the decoding data of buffered video information.
It should be noted that when the video information has B frames, then the video information whether there is the instruction parameter of B frames
It is worth for 1;When B frames are not present in the video information, then the video information is 0 with the presence or absence of the instruction parameter value of B frames.And avoid defeated
Go out to suspend buffering area number be predisposed to 1, reconstruction frames number be predisposed to 1, the reserved buffer of SurfaceFlinger components
Number is predisposed to 4.Distribute module, when judging to need to redistribute buffering area, is redistributed slow based on multimedia parameter determination
Rush area.
Specifically, buffer module includes:Determining unit, the reference frame number based on multimedia messages, multimedia messages are
The no instruction parameter value and preset relevant parameter that there is B frames, it is determined that redistributing the number of buffering area;Redistribute unit, base
In the number for redistributing buffering area, open multimedia acceleration layer OpenMax releasing memory function is notified and calls, release is just
The buffering area of beginningization distribution, and open multimedia acceleration layer OpenMax storage allocation function is called, redistribute buffering area.
For example, when monitoring modular judges to need to redistribute buffering area, it is determined that unit is according to the solution from the video information
The reference frame number and video information of the video information for obtaining or extracting in code data whether there is the instruction parameter value of B frames,
And preset relevant parameter, for example, the reference frame number " 2 " based on video information is individual, video information whether there is the instruction of B frames
Parameter value " 1 ", and preset relevant parameter numerical value " 6 ", and based on following formula 2) draw needed for allocation buffer number, to cache
The decoding data of the video information:
Formula 2)
Redistribute number=info- of buffering area>numRefFrames+info->has_b_frames+1+1+4
Wherein, info->NumRefFrames is the reference frame number of video information, and has_b_frames is video information
With the presence or absence of the instruction parameter of B frames, first " 1 ", to avoid output pause buffering area number, second " 1 " is reconstruction frames
Number, " 4 " are the reserved buffer number of SurfaceFlinger components.
By above-mentioned formula 2) calculate can determine that, 9 buffering areas are redistributed to cache the decoding data of the video information;Weight
New allocation unit is individual based on the number " 9 " for redistributing buffering area, and the plug-in unit gst-omx modules into Gstreamer send logical
Know information, notify gst-omx modules to redistribute buffering area and redistribute the number of buffering area for 9, gst-omx modules exist
Receive after the announcement information for redistributing unit transmission, the announcement information is confirmed, and call open multimedia to accelerate
Layer OpenMax releasing memory function OMX_FreeBuffer, 15 buffering areas of release initialization distribution, recalls opening many
Media acceleration layer OpenMax storage allocation function OMX_AllocateBuffer redistributes 9 buffering areas.
Cache module, decoding data is cached in the buffering area redistributed.
Specifically, after gst-omx modules redistribute buffering area, cache module by the decoding data of multimedia messages,
Such as, the decoding data of video information, is cached into the buffering area redistributed.
Specifically, the device also includes:Update module, based on the quantity for redistributing buffering area, updates Buffer allocation
Parameter.
For example, gst-omx modules are after completing to cache the decoding data of video information into the buffering area redistributed,
Announcement information is sent to hardware vendor's decoding storehouse, notifies hardware vendor to decode storehouse Buffer allocation number and changed, and will buffering
Area's distribution number is revised as 9;Hardware vendor decodes storehouse after the announcement information that gst-omx modules are sent is received, and confirms
Buffering area has been redistributed, and updates Buffer allocation number by update module.
Those skilled in the art of the present technique are appreciated that the present invention includes being related to for performing in operation described herein
One or more of equipment.These equipment can be for needed for purpose and specially design and manufacture, or can also include general
Known device in computer.These equipment have the computer program being stored in it, and these computer programs are optionally
Activation is reconstructed.Such computer program can be stored in equipment (for example, computer) computer-readable recording medium or be stored in
E-command and it is coupled to respectively in any kind of medium of bus suitable for storage, the computer-readable medium is included but not
Be limited to any kind of disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, only
Read memory), RAM (Random Access Memory, immediately memory), EPROM (Erasable Programmable
Read-Only Memory, Erarable Programmable Read only Memory), EEPROM (Electrically Erasable
Programmable Read-Only Memory, EEPROM), flash memory, magnetic card or light card
Piece.It is, computer-readable recording medium includes storing or transmitting any Jie of information in the form of it can read by equipment (for example, computer)
Matter.
Those skilled in the art of the present technique be appreciated that can be realized with computer program instructions these structure charts and/or
The combination of each frame and these structure charts and/or the frame in block diagram and/or flow graph in block diagram and/or flow graph.This technology is led
Field technique personnel be appreciated that these computer program instructions can be supplied to all-purpose computer, special purpose computer or other
The processor of programmable data processing method is realized, so as to pass through the processing of computer or other programmable data processing methods
The scheme that device is specified in the frame or multiple frames to perform structure chart disclosed by the invention and/or block diagram and/or flow graph.
Those skilled in the art of the present technique are appreciated that in the various operations discussed in the present invention, method, flow
Step, measure, scheme can be replaced, changed, combined or deleted.Further, it is each with what is discussed in the present invention
Kind operation, method, other steps in flow, measure, scheme can also be replaced, changed, reset, decomposed, combined or deleted.
Further, it is of the prior art to have and the step in the various operations disclosed in the present invention, method, flow, measure, scheme
It can also be replaced, changed, reset, decomposed, combined or deleted.
Described above is only some embodiments of the present invention, it is noted that for the ordinary skill people of the art
For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should
It is considered as protection scope of the present invention.