Summary of the invention
Fundamental purpose of the present invention is the audio data processing method and the device that provide a kind of dual operating systems, to solve the problem that in prior art, the hardware cost of dual operating systems is high.
For above-mentioned technical matters, the present invention solves by the following technical programs.
The invention provides a kind of audio data processing method of dual operating systems, comprising: in the high performance system and low performance systems of sharing audio hardware, for described high performance system arranges the access rights to described audio hardware; When described low performance systems outputting audio data being detected, described voice data is sent to described high performance system; Control described high performance system and described voice data is exported to described audio hardware.
Wherein, described voice data is sent to described high performance system, comprises: by described voice data by web socket socket, be sent to described high performance system.
Wherein, described voice data is sent to described high performance system, comprises: the described voice data of decoding without described low performance systems is sent to described high performance system.
Wherein, control described high performance system and described voice data is exported to described audio hardware, comprising: control described high performance system and to decode described voice data; Control described high performance system and decoded described voice data is exported to described audio hardware.
Wherein, control described high performance system and described voice data is exported to described audio hardware, comprising: control described high performance system, by audio hardware level of abstraction Hal, described voice data is exported to described audio hardware.
Present invention also offers a kind of audio-frequency data processing device of dual operating systems, comprising: module is set, in the high performance system and low performance systems of sharing audio hardware, for described high performance system arranges the access rights to described audio hardware; Sending module, for when described low performance systems outputting audio data being detected, is sent to described high performance system by described voice data; Control module, exports to described audio hardware for controlling described high performance system by described voice data.
Wherein, described sending module is used for: by described voice data by web socket socket, be sent to described high performance system.
Wherein, described sending module is used for: the described voice data of decoding without described low performance systems is sent to described high performance system.
Wherein, described control module is used for: control described high performance system and to decode described voice data; Control described high performance system and decoded described voice data is exported to described audio hardware.
Wherein, described control module specifically for: control described high performance system, by audio hardware level of abstraction Hal, described voice data exported to described audio hardware.
Beneficial effect of the present invention is as follows:
Dual operating systems sharing audio hardware of the present invention; For high performance system arranges the access rights to this audio hardware, when low performance systems needs to use audio hardware, voice data is sent to audio hardware by high performance system.By The present invention reduces hardware quantity, can hardware cost be reduced, and, by high performance system processing audio data, the treatment effeciency of voice data can be improved.
Embodiment
Main thought of the present invention is, arranges dual operating systems sharing audio hardware in the terminal; According to the performance of operating system, dual operating systems comprises high performance system and low performance systems; For high performance system arranges the access rights to this audio hardware; When low performance systems needs to use audio hardware, voice data is sent to audio hardware by high performance system.By The present invention reduces hardware quantity, can hardware cost be reduced, and, by high performance system processing audio data, the treatment effeciency of voice data can be improved.
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with drawings and the specific embodiments, the present invention is described in further detail.
According to embodiments of the invention, provide a kind of audio data processing method of dual operating systems.Fig. 1 is the process flow diagram of the audio data processing method of dual operating systems according to the embodiment of the present invention.
Step S110, in the high performance system and low performance systems of sharing audio hardware, for high performance system arranges the access rights to audio hardware.
Running of mobile terminal dual operating systems, according to the difference of these two operating system performances, can be divided into high performance system and low performance systems.The voice data processing power of high performance system and data transmission capabilities are better than low performance systems.Such as: the system configuration of high performance system higher than the system configuration of low performance systems,
High performance system and low performance systems sharing audio hardware.Audio hardware is such as: audio player (loudspeaker).
In high performance system and low performance systems, high performance system is only set and has access rights to audio hardware, and low performance systems does not possess the access rights of audio hardware, if low performance systems needs to use audio hardware playing audio-fequency data, then need to access audio hardware by high performance system, realize the broadcasting of voice data.By which, the hardware quantity in mobile terminal can be reduced, and by high performance system processing audio data, the treatment effeciency of voice data can be provided.
Step S120, when low performance systems outputting audio data being detected, is sent to high performance system by voice data.
When low performance systems needs to use audio hardware, export the voice data that it needs to play.If detect that low performance systems has voice data to export, then this voice data is sent to high performance system.Further, by voice data by web socket socket, high performance system is sent to.
In one embodiment, voice data in low performance systems is packed data, in order to reduce the time of decoding audio data, reduce the time of low performance systems to high performance system transmitting audio data, shorten the delay that voice data is play, the voice data of decoding without low performance systems can be sent to high performance system.Further, the voice data that can will decode without low performance systems, by web socket socket, is sent to high performance system.
Step S130, controls high performance system and described voice data is exported to audio hardware.
If send to the voice data of high performance system to be packed data, then control high performance system decoding audio data; Control high performance system and decoded voice data is exported to audio hardware.Decoded voice data is pulse code adjustment (PulseCodeModulation, PCM) coding.Because high performance system decoding speed is faster than the decoding speed of low performance systems, so, the present embodiment adopts the mode at high performance system decoding audio data, the data volume that low performance systems transmits to high performance system can be reduced, reduce decoding consuming time, improve decoding efficiency.
Such as: with 2 sound channels, 16, the MP3 data instance of 48KHz, the ratio of compression of MP3 is about 10:1, and namely the low performance systems data needing high performance system to transmit per second are 48000 × 2 × 16/10=153.6Kbps.
After voice data is sent to high performance system, controls high performance system, by audio hardware level of abstraction Hal, voice data is exported to audio hardware.Further, voice data, by system call, is exported to audio hardware by audio hardware level of abstraction Hal.
To the control of high performance system, can realize by performing high performance system configuration.In other words, by system configuration, high performance system is set and receives voice data and will send it to audio hardware, receive the voice data of not decoding and first to its decoding, audio hardware will sent it to.By system configuration, the mode that high performance system receives, sends voice data is set.
Provide a concrete example below and describe the present invention further.Fig. 2 is the schematic diagram of the audio data processing method of dual operating systems according to the embodiment of the present invention.
User clicks and plays music A in the voice applications APP of low performance systems Performance-Low-OS; This voice applications APP is positioned at the application layer of low performance systems Performance-Low-OS.
Low performance systems Performance-Low-OS, by the compacted voice file of music A, is sent to high performance system Performance-High-OS by Socket;
High performance system Performance-High-OS receives this without the compacted voice file of decoding, and in application layer, this compacted voice file is decoded, obtain audio file, by this audio file transmissions to audio frequency Hal layer, by audio frequency Hal by calling the related function of high performance system Performance-Low-OS, as write function, decoded audio file is outputted to audio hardware.Further, audio file is passed to audio hardware and drive in the audio hardware of high performance system Performance-Low-OS inner nuclear layer, then pass to audio hardware by the driving of this audio hardware.
Present invention also offers a kind of audio-frequency data processing device of dual operating systems.Fig. 3 is the structural drawing of the audio-frequency data processing device of dual operating systems according to the embodiment of the present invention.
This device comprises:
Module 310 is set, in the high performance system and low performance systems of sharing audio hardware, for described high performance system arranges the access rights to described audio hardware;
Sending module 320, for when described low performance systems outputting audio data being detected, is sent to described high performance system by described voice data;
Control module 330, exports to described audio hardware for controlling described high performance system by described voice data.
In one embodiment, described sending module 320, for described voice data is passed through web socket socket, is sent to described high performance system.
In another embodiment, described sending module 320 is for being sent to described high performance system by the described voice data of decoding without described low performance systems.Described control module 330 to be decoded described voice data for controlling described high performance system; Control described high performance system and decoded described voice data is exported to described audio hardware.
In another embodiment, described voice data is exported to described audio hardware specifically for controlling described high performance system by audio hardware level of abstraction Hal by described control module 330.
The function of the device described in the present embodiment is described in the embodiment of the method shown in Fig. 1-Fig. 2, therefore not detailed part in the description of the present embodiment, see the related description in previous embodiment, can not repeat at this.
The foregoing is only embodiments of the invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within right of the present invention.