Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to justOnly the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Fig. 1 is a kind of flow chart of the coding method of audio data provided in an embodiment of the present invention, and the embodiment of the present invention canThe case where sending audio data suitable for voice communication sound intermediate frequency sending device, this method can be by the code device of audio dataIt executes, which can be realized by way of software and/or hardware, and is integrated in the equipment for executing this method, toolBody, as shown in Figure 1, this method may include steps of:
S101, the Netowrk tape width values for obtaining audio data transmission network.
In embodiments of the present invention, audio sending device can be grasped in response to user in the voice communication of Internet phone-calling APPMake, acquire audio data and to being sent to after audio data coding by network and audio reception device, in transmission audio dataDuring, audio sending device can calculate the Netowrk tape width values of network in real time, wherein Netowrk tape width values can be finger in soundOn the transmission link of frequency evidence, the data volume that can be transmitted in regular time.
Specifically, audio sending device can estimate Netowrk tape width values according to network state, wherein network stateCan be indicated with network quality parameters, for example, can include but is not limited to the transmission rate of network, receiving velocity, network delay andPacket loss etc., audio sending device can in real time be monitored network quality parameters, with according to network quality parameters to networkBandwidth value is estimated.
S102, the raw tone encoder bit rate for determining the audio data current setting and original packet header encoder code rate.
In the embodiment of the present invention, pcm encoder, WMA coding, MP3 coding, AAC coding etc. can be carried out to audio data,When audio data is sent to audio reception device by audio sending device, first audio data is carried out according to certain encoder bit rateCoding, to generate data packet, then sends data packets to audio reception device.Audio data coding can wrap for data packetIt includes and audio data encode and encode to header packet information, wherein header packet information may include ip information, udp letterAbove-mentioned header packet information can be correspondingly encoded to the packet header ip, the packet header udp, language by breath, voice package informatin (such as rtp information) etc.Sound packet packet header (such as the packet header rtp).Therefore, can using the encoder bit rate of current audio data as raw tone encoder bit rate,Using the encoder bit rate of current header packet information as original packet header encoder code rate.
S103, according to the Netowrk tape width values respectively to the raw tone encoder bit rate and the packet header encoder bit rate intoRow adjustment, obtains target voice encoder bit rate and target packet header encoder bit rate.
Specifically, raw tone encoder bit rate and packet header encoder bit rate can be adjusted respectively according to Netowrk tape width valuesIt is whole, target voice encoder bit rate and target packet header encoder bit rate are obtained, for example, when Netowrk tape width values improve, it is preferential to improve originalThen beginning voice coding code rate improves original packet header encoder code rate, to promote speech quality;Or it is lower in Netowrk tape width valuesWhen, original packet header encoder code rate can be preferentially reduced, so that total coding code rate declines to be adapted to lower Netowrk tape width values, so thatThe lower Netowrk tape width values of total coding rate adaption are obtained, thus the speech quality under guaranteeing low network band width.
S104, the audio data is carried out using the target voice encoder bit rate and target packet header encoder bit rateCoding, obtains target audio data.
After determining target voice encoder bit rate and target packet header encoder bit rate, audio sending device can use target languageSound coding and target packet header encoder bit rate encode audio data, obtain the target sound comprising audio data and header dataFrequency evidence, for example, may include a header packet information and at least one audio frame, also can wrap in a packets of audio dataInclude multiple audio frames.
The coding method of audio data provided in an embodiment of the present invention, by the Netowrk tape for obtaining audio data transmission networkWidth values determine the raw tone encoder bit rate and original packet header encoder code rate of audio data current setting;And according to network bandwidthValue is respectively adjusted raw tone encoder bit rate and packet header encoder bit rate, obtains target voice encoder bit rate and target packet headerEncoder bit rate obtains mesh to encode using target voice encoder bit rate and target packet header encoder bit rate to audio dataMark audio data.The embodiment of the present invention respectively compiles raw tone encoder bit rate and original packet header according to the Netowrk tape width values of networkCode code rate is adjusted, and packet header encoder bit rate can be reduced under low network band width to reduce total coding code rate, so that editor-in-chiefCode rate adaption low network band width, ensure that the speech quality under low network band width.
Fig. 2 be another embodiment of the present invention provides a kind of audio data coding method flow chart, the present embodiment isIt optimizes on the basis of the above embodiments.Specifically, as shown in Fig. 2, method provided in an embodiment of the present invention may includeFollowing steps:
S201, according to scheduled rate calculating cycle, obtain the transmission that the audio sending device sends the audio dataRate and receiving velocity.
Wherein, transmission rate is the ratio that total bytes and transmission time interval are sent in scheduled rate calculating cycle, is connectReceiving rate is the ratio for receiving total bytes and receiving interval time, for example, scheduled rate calculating cycle can be a RTT(Round-Trip Time, round trip delay time), round trip delay time are since audio sending device sends data packet, to receiving soundThe time that the confirmation message of frequency receiving device feedback is undergone in total.Specifically, audio sending device records the hair of each data packetSend time and receiving time, the difference of sending time and receiving time is round trip delay time, wherein receiving time is that audio is sentEquipment receives the time of the confirmation message of audio reception device feedback.
In a RTT, audio sending device can send multiple data packets and receive multiple data packets, then can countThe total bytes of the data packet sent in a RTT and the ratio of RTT are calculated, transmission rate is obtained, and, pass through the number receivedAccording to the total bytes of packet and the ratio of RTT, receiving velocity is obtained.
S202, it is based on the transmission rate and the receiving velocity, determines that the reference of the scheduled rate calculating cycle passesDefeated rate.
It specifically, can be by the transmission rate and the lesser conduct reference of receiving velocity in scheduled rate calculating cycleTransmission rate optionally can also be using the average value of transmission rate and receiving velocity as reference transmission rate, or sends speedThe certain proportion of smaller value receives speed for example, transmission rate is 150Mbps as reference transmission rate in rate and receiving velocityRate is 100Mbps, then it is lesser be receiving velocity be 100Mbps, then reference transmission rate can be 90Mbps.
S203, in preset bandwidth value calculating cycle, obtain multiple reference transmission rates.
In the embodiment of the present invention, Netowrk tape width values can be calculated according to preset bandwidth value calculating cycle, optionally, preset bandWidth values calculating cycle includes multiple scheduled rate calculating cycles, the then ginseng that available multiple scheduled rate calculating cycles are determinedExamine transmission rate.It, can be with for example, it is a RTT that a preset bandwidth value calculating cycle, which is 10 RTT scheduled rate calculating cycles,It obtains and determines reference transmission rate in each RTT.
S204, the Netowrk tape width values that the preset bandwidth value calculating cycle is determined using the multiple reference transmission rate.
Specifically, can be using multiple reference transmission velocity maximums as Netowrk tape width values, such as it can be to multiple referencesTransmission rate is ranked up from big to small, and the most preceding reference transmission rate that will sort is as Netowrk tape width values, it is of course also possible to willThe average value of multiple reference transmission rates is as Netowrk tape width values etc., and the embodiment of the present invention is to true using multiple reference transmission ratesThe mode for determining Netowrk tape width values is without restriction.
The embodiment of the present invention determines reference transmission rate according to transmission rate and receiving velocity, and according to multiple scheduled ratesThe reference transmission rate of calculating cycle determines Netowrk tape width values, and the accuracy for the Netowrk tape width values being calculated can be improved.
S205, the target total coding code rate that the audio data is determined according to the Netowrk tape width values.
Specifically, the corresponding code rate of Netowrk tape width values can be determined according to Netowrk tape width values-code rate linked list, by the codeRate is as target total coding code rate.For example, the encoder bit rate range of audio sending device is 8kbps-32kbs, then can incite somebody to action8kbps-32kbs points are several code rate sections, and the Netowrk tape width values of the corresponding adaptation of each code rate section then can be according to Netowrk tape width valuesDetermine the target total coding code rate of audio sending device.
S206, original total coding code is determined based on the raw tone encoder bit rate and the original packet header encoder code rateRate.
After determining raw tone encoder bit rate and original packet header encoder code rate, it can be calculated according to default calculation formulaOriginal total coding code rate, it is, of course, also possible to original total coding code rate is directly read from the coding module of audio sending device, thisInventive embodiments are without restriction to the mode of the original total coding code rate of determination.
If S207, the target total coding code rate are greater than the original total coding code rate, the raw tone is improvedEncoder bit rate and the original packet header encoder code rate, obtain target voice encoder bit rate and target packet header encoder bit rate.
In the embodiment of the present invention, if being greater than original total coding code according to the target total coding code rate that Netowrk tape width values determineVoice coding code rate and original packet header encoder code rate then can be improved in rate.Specifically, target total coding code rate and original can be calculatedThe ratio of beginning total coding code rate improves raw tone coding code if the ratio is greater than first threshold and is less than second thresholdRate obtains target voice encoder bit rate, and sets target packet header encoder bit rate for original packet header encoder code rate;And if thanValue is greater than second threshold, then raw tone encoder bit rate and original packet header encoder code rate is respectively increased, and obtains target voice codingCode rate and target packet header encoder bit rate.
For example, first threshold is 1.0, and second threshold 1.5, the ratio of target total coding code rate and original total coding code rateIt is 1.3, illustrates that current network bandwidth value is promoted, then preferentially raw tone encoder bit rate can be promoted to obtain targetVoice coding code rate, while target packet header encoder bit rate is set by original packet header encoder code rate, to improve the clear of voice communicationClear degree;And if the ratio of target total coding code rate and original total coding code rate is 2.0, illustrate that current network bandwidth value substantially mentionsHeight, then can simultaneously promote raw tone encoder bit rate and original packet header encoder code rate, use Netowrk tape to maximizeWidth, to improve voice call quality.
Above-mentioned threshold value and ratio setting are merely possible to illustrate, in implementing the embodiments of the present invention, art technologyDifferent threshold value and ratio can be arranged in personnel according to the actual situation, and the embodiments of the present invention are not limited thereto.
If S208, the target total coding code rate are less than the original total coding code rate, the raw tone is reducedEncoder bit rate and original packet header encoder code rate, obtain target voice encoder bit rate and target packet header encoder bit rate.
In the embodiment of the present invention, if being less than original total coding code according to the target total coding code rate that Netowrk tape width values determineRate can then reduce voice coding code rate and original packet header encoder code rate, so that total coding code rate is adapted to Netowrk tape width values.
Specifically, available network delay calculates the ratio of target total coding code rate and original total coding code rate, ifRatio is greater than third threshold value and less than the 4th threshold value, and network delay is less than delay threshold, then reduces original packet header encoder codeRate obtains target packet header encoder bit rate, and, target voice encoder bit rate is set by raw tone encoder bit rate, and ifRatio is less than third threshold value, then reduces raw tone encoder bit rate and obtain target voice encoder bit rate, and, reduce original packet headerEncoder bit rate obtains target packet header encoder bit rate.
For example, third threshold value is 0.5, the 4th threshold value is 1, and target total coding code rate and the ratio of original total coding code rate are0.4, network delay is less than delay threshold, illustrates that current network bandwidth value is declined, then can preferentially reduce original packet header and compileCode code rate obtains target packet header encoder bit rate, so that the decline of total coding code rate to be to be adapted to current network bandwidth, while by original languageSound encoder bit rate is set as target voice encoder bit rate, to guarantee speech quality within the scope of the network delay of permission;And ifThe ratio of target total coding code rate and original total coding code rate is 0.2, illustrates that current network bandwidth value is greatly reduced, then can be sameWhen reduce raw tone encoder bit rate and original packet header encoder code rate so that total coding code rate is reduced to be adapted to current low networkBandwidth guarantees to may be implemented to converse under current low network band width.
In practical applications, a data packet includes a header packet information and several audio frames, by adjusting a dataThe adjustment to packet header encoder bit rate may be implemented in the number of packet sound intermediate frequency frame, for example, including a packet header for a data packetInformation and an audio frame, another data packet includes a header packet information and two audio frames, relative to only comprising a soundFrequency frame can reduce the packet header encoder bit rate of half.
The embodiment of the present invention respectively can encode raw tone encoder bit rate and packet header according to the Netowrk tape width values of networkCode rate is adjusted, and packet header encoder bit rate can be reduced under low network band width to reduce total coding code rate, so that total codingRate adaption low network band width ensure that the speech quality under low network band width.
Fig. 3 is a kind of structural schematic diagram of the code device of audio data of the embodiment of the present invention, as shown in figure 3, the dressIt sets and specifically includes:
Netowrk tape width values obtain module 301, for obtaining the Netowrk tape width values of audio data transmission network;
Original code rate determines mould 302, for determining the raw tone encoder bit rate and original of the audio data current settingBeginning packet header encoder bit rate;
Code rate adjusts module 303, is used for according to the Netowrk tape width values respectively to the raw tone encoder bit rate and instituteIt states packet header encoder bit rate to be adjusted, obtains target voice encoder bit rate and target packet header encoder bit rate;
Audio data coding module 304, for encoding code using the target voice encoder bit rate and the target packet headerRate encodes the audio data, obtains target audio data.
Optionally, the Netowrk tape width values acquisition module 301 includes:
Transmission rate and receiving velocity acquisition submodule, for obtaining the audio hair according to scheduled rate calculating cycleThe transmission rate and receiving velocity for sending equipment to send the audio data;
Reference transmission quantity determines submodule, for being based on the transmission rate and the receiving velocity, determines described pre-If the reference transmission rate in rate calculations period;
Reference transmission rate acquisition submodule, in preset bandwidth value calculating cycle, obtaining multiple reference transmission speedRate;
Netowrk tape width values computational submodule, by being determined based on the preset bandwidth value using the multiple reference transmission rateCalculate the Netowrk tape width values in period.
Optionally, the code rate adjustment module 303 includes:
Target total coding code rate determines submodule, for determining the target of the audio data according to the Netowrk tape width valuesTotal coding code rate;
Original total coding code rate determines submodule, for being compiled based on the raw tone encoder bit rate and the original packet headerCode code rate determines original total coding code rate;
First code rate adjusting submodule, if being greater than the original total coding code rate for the target total coding code rate,The raw tone encoder bit rate and the original packet header encoder code rate are then improved, target voice encoder bit rate and target packet are obtainedHeader encoder code rate;
Second code rate adjusting submodule, if being less than the original total coding code rate for the target total coding code rate,The raw tone encoder bit rate and original packet header encoder code rate are then reduced, target voice encoder bit rate is obtained and target packet header is compiledCode code rate.
Optionally, the first code rate adjusting submodule includes:
Ratio acquiring unit, for obtaining the ratio of the target total coding code rate Yu the original total coding code rate;
First code rate adjustment unit improves institute if being greater than first threshold for the ratio and being less than second thresholdIt states raw tone encoder bit rate and obtains the target voice encoder bit rate, and, it sets the original packet header encoder code rate toTarget packet header encoder bit rate;
The raw tone is respectively increased if being greater than second threshold for the ratio in second code rate adjustment unitEncoder bit rate and original packet header encoder code rate, obtain target voice encoder bit rate and target packet header encoder bit rate.
Optionally, the second code rate adjusting submodule includes:
Network delay acquiring unit, for obtaining network delay;
Ratio calculation unit, for calculating the ratio of the target total coding code rate Yu the original total coding code rate;
Third code rate adjustment unit, if being greater than third threshold value for the ratio and less than the 4th threshold value, and it is describedNetwork delay is less than delay threshold, then reduces the original packet header encoder code rate, obtain target packet header encoder bit rate, and, it willThe raw tone encoder bit rate is set as target voice encoder bit rate;
4th code rate adjustment unit reduces the raw tone coding if being less than third threshold value for the ratioCode rate obtains target voice encoder bit rate, and, it reduces the original packet header encoder code rate and obtains target packet header encoder bit rate.
The code device of audio data provided by the embodiment of the present invention can be performed provided by any embodiment of the inventionThe coding method of audio data has the corresponding functional module of execution method and beneficial effect.
Referring to Fig. 4, the structural schematic diagram of one of an example of the present invention equipment is shown.As shown in figure 4, the equipmentCan specifically include: processor 40, memory 41, the display screen 42 with touch function, input unit 43, output device 44 withAnd communication device 45.The quantity of processor 40 can be one or more in the equipment, be with a processor 40 in Fig. 4Example.The quantity of memory 41 can be one or more in the equipment, in Fig. 4 by taking a memory 41 as an example.The equipmentProcessor 40, memory 41, display screen 42, input unit 43, output device 44 and communication device 45 can by bus orPerson's other modes connect, in Fig. 4 for being connected by bus.
Memory 41 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computerSequence and module, the corresponding program instruction of the coding method of the audio data as described in any embodiment of that present invention/module (exampleSuch as, the Netowrk tape width values in the code device of above-mentioned audio data obtain module 301, original code rate determines mould 302, code rate adjustmentModule 303 and audio data coding module 304 etc.).Memory 41 can mainly include storing program area and storage data area,In, application program needed for storing program area can store operating device, at least one function;Storage data area can store basis and setStandby uses created data etc..In addition, memory 41 may include high-speed random access memory, it can also include non-easyThe property lost memory, a for example, at least disk memory, flush memory device or other non-volatile solid state memory parts.OneIn a little examples, memory 41 can further comprise the memory remotely located relative to processor 40, these remote memories canTo pass through network connection to equipment.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, movementCommunication network and combinations thereof.
Display screen 42 is the display screen 42 with touch function, can be capacitance plate, electromagnetic screen or infrared screen.GenerallyFor, display screen 42 is used to show data according to the instruction of processor 40, is also used to receive the touch behaviour for acting on display screen 42Make, and corresponding signal is sent to processor 40 or other devices.Optionally, it when display screen 42 is infrared screen, also wrapsInfrared touch frame is included, which is arranged in the surrounding of display screen 42, can be also used for receiving infrared signal, and shouldInfrared signal is sent to processor 40 or other equipment.
Communication device 45 communicates to connect for establishing with other equipment, can be wire communication device and/or channel radioT unit.
Input unit 43 can be used for receiving the number or character information of input, and generate with the user setting of equipment withAnd the related key signals input of function control, it can also be the camera for obtaining image and obtain the pickup of audio dataEquipment.Output device 44 may include the audio frequency apparatuses such as loudspeaker.It should be noted that input unit 43 and output device 44Concrete composition may be set according to actual conditions.
Software program, instruction and the module that processor 40 is stored in memory 41 by operation, thereby executing equipmentVarious function application and data processing, that is, realize the coding method of above-mentioned audio data.
Specifically, in embodiment, when processor 40 executes the one or more programs stored in memory 41, specific implementationFollowing operation: the Netowrk tape width values of audio data transmission network are obtained;Determine the raw tone of the audio data current settingEncoder bit rate and original packet header encoder code rate;According to the Netowrk tape width values respectively to the raw tone encoder bit rate and describedPacket header encoder bit rate is adjusted, and obtains target voice encoder bit rate and target packet header encoder bit rate;Using the target voiceEncoder bit rate and target packet header encoder bit rate encode the audio data, obtain target audio data.
The embodiment of the present invention also provides a kind of computer readable storage medium, and the instruction in the storage medium is by equipmentWhen processor executes, enable a device to execute the coding method of the audio data as described in above method embodiment.It is exemplary, the coding method of the audio data includes: to obtain the Netowrk tape width values of audio data transmission network;Determine the audio dataThe raw tone encoder bit rate and original packet header encoder code rate of current setting;According to the Netowrk tape width values respectively to described originalVoice coding code rate and the packet header encoder bit rate are adjusted, and obtain target voice encoder bit rate and target packet header coding codeRate;The audio data is encoded using the target voice encoder bit rate and target packet header encoder bit rate, is obtainedTarget audio data.
It should be noted that for device, equipment, storage medium embodiment, since it is basic with embodiment of the methodSimilar, so being described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present inventionIt can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is moreGood embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior artPart can be embodied in the form of software products, which can store in computer readable storage mediumIn, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computerAccess Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is setStandby (can be robot, personal computer, server or the network equipment etc.) executes sound described in any embodiment of that present inventionThe coding method of frequency evidence.
It is worth noting that, in the code device of above-mentioned audio data, included each unit and module only according toWhat function logic was divided, but be not limited to the above division, as long as corresponding functions can be realized;In addition, eachThe specific name of functional unit is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
It should be appreciated that each section of the invention can be realized with hardware, software, firmware or their combination.Above-mentionedIn embodiment, software that multiple steps or method can be executed in memory and by suitable instruction executing device with storageOr firmware is realized.It, and in another embodiment, can be under well known in the art for example, if realized with hardwareAny one of column technology or their combination are realized: having a logic gates for realizing logic function to data-signalDiscrete logic, with suitable combinational logic gate circuit specific integrated circuit, programmable gate array (PGA), sceneProgrammable gate array (FPGA) etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically showThe description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or examplePoint is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are notCentainly refer to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be anyOne or more embodiment or examples in can be combined in any suitable manner.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art thatThe invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present inventionIt is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, alsoIt may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.