CN106897146A - The data processing method and the terminal with microphone of a kind of microphone of terminal - Google Patents
The data processing method and the terminal with microphone of a kind of microphone of terminal Download PDFInfo
- Publication number
- CN106897146A CN106897146A CN201710071670.6A CN201710071670A CN106897146A CN 106897146 A CN106897146 A CN 106897146A CN 201710071670 A CN201710071670 A CN 201710071670A CN 106897146 A CN106897146 A CN 106897146A
- Authority
- CN
- China
- Prior art keywords
- recording
- thread
- service end
- application
- client
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/16—Sound input; Sound output
- G06F3/162—Interface to dedicated audio devices, e.g. audio drivers, interface to CODECs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5018—Thread allocation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/541—Client-server
Abstract
The embodiment of the invention discloses a kind of data processing method of microphone of terminal and the terminal with microphone, it is related to technical field of mobile terminals, is used to solve the problems, such as that multiple applications cannot be while open sound-recording function in the prior art.The method includes:When sound-recording function is opened in the first application, recording open command is obtained, create first and apply corresponding first client thread;Whether detection service end line journey has created, wherein, service end thread and mi crophone communication, also with multiple client thread communication, one application of unlatching sound-recording function of each client thread correspondence;If having created, recording open command is then sent to by service end thread by the first client thread, the recording data collected by microphone is obtained by service end thread, the recording data that will be gathered is distributed to the first client thread, and the recording data of distribution is returned into the first application by the first client thread.
Description
Technical field
The present invention relates to technical field of mobile terminals, more particularly to a kind of microphone of terminal data processing method and tool
There is the terminal of microphone.
Background technology
In the mobile Internet epoch, with popularizing for intelligent terminal, the sound-recording function of terminal is more and more intelligent.
For example in android system, recorder, speech recognition, phonetic search, the application such as video calling can all use the record of microphone
Sound function.
With reference to shown in Fig. 1, application in the prior art obtains the process of recording mainly including following module:Using
(Application), the recording module of operating system, hardware abstraction layer (HAL), recording hardware components (Hardware) (including
Microphone and DSP etc., are all briefly described for the ease of description is following with microphone replacement recording hardware components).Wherein, should
With the application for needing including recorder, phonetic entry, phonetic search etc. recorded voice, using opening sound-recording function;Operating system
Recording module belong to Android operation system, including Framework application frameworks, for transmit recording open command and record
Sound data;HAL is to be located at interface layer of the operating system nucleus (linux kernel driving) and the recording module of upper strata between, its purpose
It is by hardware abstraction;Microphone is used for according to recording open command collection recording data.Specific operating system includes:
Java interfaces, JNI interfaces (interface between C++ and Java), AudioRecord.cpp (Android recording code), C++ records
Sound framework (AudioRecordThread) etc..
The mode that prior art application obtains recording has two kinds, and a kind of is the MediaRecorder by Java interfaces
(class in Android frameworks) mode gets encoded data (application such as such as recorder, video recording), and another kind is to pass through
The AudioRecord (class in Android frameworks) of Java interfaces obtains original data (such as speech recognition, phonetic order, language
Sound is searched for, video calling, the application such as phonitic entry method).The difference of two ways above-mentioned Recording Process Java interfaces->
JNI (interface between C++ and Java)->Recording frame part.
Mode one is MediaRecorder modes, specially:Using->MediaRecorder(java)->
MediaRecorder(JNI)->Coded portion (StagefrightRecorder)->AudioRecord.cpp->
AudioRecordThread->HAL->Microphone.
Mode two is AudioRecord modes, specially:Using->AudioRecord(java)->AudioRecord
(JNI)->AudioRecord.cpp->AudioRecordThread->HAL->Microphone.
Application program is of all kinds, and each application might have different demands, thus can set different recording parameters
Deng.Corresponding recording parameter can pass to microphone by said process, after microphone receives recording open command, can be by
Correlate and opened with the recording parameter assigned, the recording data that then will be collected is according to the order opposite with said sequence from Mike
Hearsay transports to application.During the fixed recording parameter operation collection recording data that microphone is just being set with an application, such as
Really having second application will open sound-recording function, at this moment to prevent parameter conflict, second application can be prevented to open sound-recording function,
Operating system will report an error, and second application cannot open sound-recording function, so that it cannot obtain the recording data of microphone.
The content of the invention
Embodiments of the invention provide the data processing method and the terminal with microphone of a kind of microphone of terminal, use
To solve the problems, such as that multiple applications cannot be while open sound-recording function in the prior art.
To reach above-mentioned purpose, embodiments of the invention are adopted the following technical scheme that:
In a first aspect, the embodiment of the invention provides a kind of data processing method of the microphone of terminal, methods described bag
Include:
When sound-recording function is opened in the first application, recording open command is obtained, create described first and apply corresponding first
Client thread;
Whether detection service end line journey has created, wherein, the service end thread and mi crophone communication, also with multiple clients
End thread communication, one application of unlatching sound-recording function of each client thread correspondence;
If having created, the recording open command is sent to by the service end thread by the first client thread,
The recording data that is collected by the microphone is obtained by the service end thread, the recording data that will be gathered is distributed to the
One client thread, first application is returned to by first client thread by the recording data of distribution.
Second aspect, the embodiment of the invention provides a kind of terminal with microphone, and the terminal includes:
Recording module, the recording module is connected with microphone, for when sound-recording function is opened in the first application, obtaining record
Sound open command, creates described first and applies corresponding first client thread;Whether detection service end line journey has created, its
In, the service end thread and mi crophone communication, also with multiple client thread communication, each client thread correspondence one is opened
Open the application of sound-recording function;If having created, the recording open command is sent to by institute by first client thread
Service end thread is stated, the recording data collected by the microphone, the record that will be gathered are obtained by the service end thread
The recording data of distribution is returned to described by sound data distribution to the first client thread by first client thread
One application.
The data processing method and the terminal with microphone of a kind of microphone of terminal are the embodiment of the invention provides, when
When sound-recording function is opened in first application, terminal obtains recording open command, creates first and applies corresponding first client thread;
Whether detection service end line journey has created;If having created, service end thread is not being created.Then the first client thread is passed through
Recording open command is sent to service end thread;The recording data collected by microphone is obtained by service end thread, will
Recording data is distributed to the first client thread;Recording data is returned to by the first application by the first client thread.So
By increasing service end thread corresponding with the one-to-one client thread of application and all applications in the terminal, and by clothes
Business end line journey and the communication of multiple client thread, multiple threads are converted to by the single thread of prior art, support multiple answering
With can simultaneously obtain recording data, so as to realize that many applications can be while open sound-recording function.
Brief description of the drawings
Technical scheme in order to illustrate more clearly the embodiments of the present invention, below will be in embodiment or description of the prior art
The required accompanying drawing for using is briefly described, it should be apparent that, drawings in the following description are only some realities of the invention
Example is applied, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to these accompanying drawings
Obtain other accompanying drawings.
Fig. 1 is for sound-recording function is opened in a kind of application that prior art is provided and obtains the frame diagram of recording data;
Fig. 2 is that a kind of application provided in an embodiment of the present invention is opened sound-recording function and obtains the frame diagram of recording data;
Fig. 3 is a kind of flow chart of the data processing method of the microphone of terminal provided in an embodiment of the present invention;
Fig. 4 is a kind of block diagram of terminal with microphone provided in an embodiment of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made
Embodiment, belongs to the scope of protection of the invention.
Term "and/or" in the embodiment of the present invention, a kind of only incidence relation for describing affiliated partner, expression can deposit
In three kinds of relations, for example, A and/or B, can represent:Individualism A, while there is A and B, individualism B these three situations.
In addition, character "/" in the embodiment of the present invention, typicallys represent forward-backward correlation pair as if a kind of relation of "or".
For the ease of clearly describing the technical scheme of the embodiment of the present invention, in an embodiment of the present invention, employ " the
One ", the printed words such as " second " make a distinction to function and the essentially identical identical entry of effect or similar item, and those skilled in the art can
To understand that the printed words such as " first ", " second " are not defined to quantity and execution order.In the description of the invention, unless separately
It is described, " multiple " is meant that two or more.
The implication of " sound-recording function is opened in multiple application simultaneously " can be multiple application same times in the embodiment of the present invention
Open sound-recording function, or before sound-recording function is opened at least one application and is not turned off sound-recording function, there are other again
Using opening sound-recording function.Application call microphone refers to just using unlatching sound-recording function.
The operation principle of the embodiment of the present invention is to change the code that JNI is interfaced between HAL layers, i.e., record in the prior art
Android recording codes and C++ recording framework this two parts in sound module.And do not changing application software, Java interfaces, JNI
Interface (interface section also makes no modifications to ensure existing and the compatibling problem of software newly occur in the future), hardware are taken out
On the premise of as layer, recording hardware components, Android recording codes and C++ recording frameworks are only changed, by original single thread
Multiple threads are converted to, support that multiple applications can simultaneously obtain recording data, so as to realize that multiple applications can be while open
Sound-recording function.That is, the embodiment of the present invention is not on the premise of application software and hardware components is changed, only by software portion
The modification for dividing, realizes that the multiple applications in terminal can be while open sound-recording function.
The embodiment of the present invention to be recorded and increased client between framework this two parts by record code and C++ of Android
End line journey (RecordClientThread) and service end line journey (RecordServerThread), with reference to shown in Fig. 2 (in figure with
Three applications are opened as a example by sound-recording function simultaneously.).When sound-recording function is opened in an application, recording module can be created and the application
Corresponding client thread.Then whether detection service end line journey has created, if service end thread is not created, creates service end
Thread;If service end thread has been created, service end thread need not be created.In a word, in Recording Process, all clients thread
Same service end thread is all correspond to, the recording open command that all clients thread is obtained all passes to service end thread,
And the recording data of acquisition is replicated and is distributed to all clients thread, the record that all clients thread will be received by service end thread
Sound data return to corresponding application.
Embodiment one
The embodiment of the invention provides a kind of data processing method of the microphone of terminal, the executive agent of the method can be with
It is the software or hardware in terminal, or terminal, example, can be the recording module in terminal.With reference to shown in Fig. 3,
The method is comprised the following steps:
S101, when first application open sound-recording function when, terminal obtain recording open command.
When sound-recording function is opened in the first application, recording open command can be sent to terminal, the recording open command includes
Recording parameter, the instruction of unlatching microphone and return recording data needed for first application.Wherein, recording parameter includes following one
Plant or various:Sample rate, channel number, and recording format.Preferably, recording parameter includes sample rate, channel number, and recording format
Deng the parameter of other setting recording effects, the optimal recording data needed for can so obtaining the first application.
It should be noted that:First application refers to any one application for opening sound-recording function.
Terminal obtains the recording open command, and opens microphone according to the recording open command.
S102, terminal create first and apply corresponding first client thread.
When first application open sound-recording function when, terminal by call successively Java interfaces, JNI interfaces,
AudioRecord.cpp, after AudioRecord.cpp obtains recording open command, creates corresponding with first application
The first client thread.It is one-to-one using with client thread.
When sound-recording function is closed in the first application, terminal is closed first and applies corresponding client thread.Specifically, terminal
Recording out code is got, by AudioRecord.cpp according to the recording out code, corresponding visitor will be applied with first
Family end line journey is closed, while sending recording out code to service end thread.All applications can certainly be waited all to close
During sound-recording function, then all of client thread is closed, or when waiting mobile phone shutdown, all of client thread is closed.
Whether S103, terminal detection service end line journey have created.
Wherein, service end thread and mi crophone communication, also with multiple client thread communication, each client thread correspondence
One application of unlatching sound-recording function.
All of client thread and same service end thread communication.After service end thread creation, meeting in system
Relative information is preserved, such terminal is created with after the corresponding client thread of application, can first judged whether
The information of presence service end line journey, if there is, that is to say, that created by client thread corresponding with other application
Service end thread, then be just not required to create service end thread again, if there is no, that is to say, that there is presently no with application
Corresponding client thread creates service end thread, and that is accomplished by creating service end thread.
If service end thread is not created, step S104 (optional)-S107 (optional) is performed;If service end thread is
Create, then S108-S110.
S104 (optional), terminal create service end thread.
Terminal is not created also by detecting service end thread using corresponding first client thread with first, by
One client thread creates service end thread.
Recording open command is sent to service end thread by S105 (optional), terminal by the first client thread.
Recording parameter in open command of recording, unlatching microphone are instructed and returned recording by terminal by client thread
Data etc. are all sent to service end thread.
S106 (optional), terminal open microphone by service end thread according to recording open command, and obtain by wheat
The recording data that gram wind is collected, the recording data that will be gathered is distributed to the first client thread.
Step one opens microphone.
Specifically, pass sequentially through service end thread, AudioRecordThread passes to HAL by recording open command, lead to
HAL is crossed to open microphone.
Step 2 obtains the recording data that microphone is collected.
Service end thread obtains recording data by AudioRecordThread from microphone.
Optionally, the recording data for being collected by microphone is microphone according to the recording parameter collection needed for the first application
The recording data for arriving.
Preferably, the recording that the recording data for being collected by microphone is collected for microphone according to default recording parameter
Data.
In a word, in whole Recording Process, microphone gathers recording data with a fixed recording parameter all the time.This
The recording parameter of individual fixation can be the recording parameter needed for first application of unlatching sound-recording function, i.e., needed for other application
Recording parameter will not be applied on microphone;Preferred this recording parameter fixed is the recording parameter of systemic presupposition, i.e. institute
Recording parameter needed for having application is all without being applied on microphone.
It should be noted that in the prior art, microphone is that the recording parameter of the fixation set when being dispatched from the factory according to it is adopted
Collection recording data, conversion process then is carried out to the recording data for collecting by other hardware components such as DSP, to be answered
With required recording data, then the recording data needed for application is returned to by C++ by hardware abstraction layer record framework, finally exist
Application is returned to step by step.Microphone in embodiments of the present invention is to represent recording hardware components (including DSP, microphone
Deng), and not exclusively refer to actual microphone, therefore the recording parameter of microphone can be setting.
The recording data that step 3 will be gathered is distributed to the first client thread.
The recording data that service end thread will be gathered is replicated and is sent respectively to each client thread.
S107 (optional), terminal return to the first application by the recording data that the first client thread will be distributed.
The content for returning to the recording data of application must apply needs, but recording effect is not necessarily using needs
, that is, return to the recording parameter needed for the recording data of application may not meet application.Specifically, passing sequentially through the first client
Recording data is returned to the first application by end line journey, (StagefrightRecorder), JNI interfaces, Java interfaces etc..
First application is first application of unlatching sound-recording function.
Optionally, if the recording data collected by microphone is adopted for microphone according to the recording parameter needed for the first application
The recording data for collecting, the then recording effect for returning to the recording parameter of the first application is that the first application is required.
Preferably, if the record collected according to default recording parameter for microphone by the recording data that microphone is collected
Sound data, terminal passes sequentially through service end thread, the first client thread, JNI interfaces, Java interfaces etc. directly by recording data
The first application is returned to, the recording effect of the recording data that the first application is obtained is not then that the first application is required.
Preferably, if the record collected according to default recording parameter for microphone by the recording data that microphone is collected
Sound data, then terminal will divide before the recording data that will be distributed by the first client thread returns to the first application
The recording data of hair carries out conversion process according to the recording parameter needed for the first application.Here conversion method can use existing
Any one in technology, as long as recording data can be converted into needed for the first application, example, can be by number of recording
Resampling is carried out according to according to the recording parameter needed for the first application, to obtain the recording data needed for the first application.
Specifically, after recording data is carried out conversion process by terminal according to the recording parameter needed for the first application, then return
Back to the first application, such first application can obtain the recording data gathered according to its recording parameter.It should be noted that:If needing
The recording data that will be collected by microphone carries out conversion process, and carrying out the process of conversion process can occur in service end line
Between journey and client thread, it is also possible to occur after client thread obtains the recording data, or other are reasonable
Position, will not be repeated here.
Recording open command is sent to service end thread by S108, terminal by the first client thread.
First client thread is by the recording parameter in open command of recording, the instruction of unlatching microphone and returns to recording data
Deng being all sent to service end thread.
S109, terminal obtain the recording data collected by microphone, the recording number that will be gathered by service end thread
According to being distributed to the first client thread.
Service end thread obtains recording data by AudioRecordThread from microphone.
Optionally, the recording data for being collected by microphone is microphone according to the recording parameter collection needed for the first application
The recording data for arriving.
Preferably, the recording that the recording data for being collected by microphone is collected for microphone according to default recording parameter
Data.
In a word, in whole Recording Process, microphone gathers recording data with a fixed recording parameter all the time.This
The recording parameter of individual fixation can be the recording parameter needed for first application of unlatching sound-recording function, i.e., needed for other application
Recording parameter will not be applied on microphone;Preferred this recording parameter fixed is the recording parameter of systemic presupposition, i.e. institute
Recording parameter needed for having application is all without being applied on microphone.
The recording data of acquisition is replicated portion and is sent to the first client thread by service end thread.
The recording data of distribution is returned to the first application by S110, terminal by the first client thread.
The content for returning to the recording data of application must apply needs, but recording effect is not necessarily using needs
, that is, return to the recording parameter needed for the recording data of application may not meet application.Specifically, passing sequentially through the first client
Recording data is returned to the first application by end line journey, (StagefrightRecorder), JNI interfaces, Java interfaces etc..
First application be not first unlatching sound-recording function application, therefore no matter the recording data collected by microphone
For the recording data that microphone is collected according to the recording parameter needed for first application of unlatching sound-recording function, also according to pre-
If the recording data that collects of recording parameter, needed for the effect of the recording data is not the application.
Optionally, directly the recording data collected by microphone can be sent to and first the corresponding first visitor of application
Family end line journey, simply at this time the content of the recording data is first to apply needs, but the effect of the recording data is not the
What one application needed, that is to say, that the first application can obtain a recording data not gathered according to its recording parameter.
Preferably, the recording data that will be collected by microphone carries out conversion according to the recording parameter needed for the first application
After reason, the first client thread is then forwarded to, such first application can obtain the recording data gathered according to its recording parameter.
It should be noted that:If desired the recording data that will be collected by microphone carries out conversion process, carries out the process of conversion process
Can occur between service end thread and client thread, it is also possible to occur client thread obtain the recording data it
Afterwards, or other rational positions, will not be repeated here.
In embodiments of the present invention, also count that how many application is using recording work(simultaneously by opening timer count
Energy.
Optionally, after service end thread is created, counter is opened by service end thread, counter initial value is 0;
When service end thread receives recording open command, counter is added 1 by service end thread;When service end thread receives recording
During out code, counter is subtracted 1 by service end thread;When counter is 0, by service end thread mute microphone (MIC),
And exit.
Specifically, after terminal creates service end thread in step S104 (optional), terminal passes through service end
Thread opens counter immediately, and counter initial value is 0.When service end thread is received once record open command, will count
Device adds 1, illustrates that the application for opening sound-recording function adds 1, and service end thread replicating portion the recording data of acquisition more and being sent to
Corresponding client thread;When service end thread is received once record out code, counter is subtracted 1, illustrated that one is answered
With sound-recording function is closed, the application for opening sound-recording function subtracts 1, and the recording data of acquisition is replicated portion by service end thread less
It is sent to corresponding client thread;When counter is 0, illustrate that all applications all close sound-recording function, service end thread
Need not reentry recording data and duplication be sent to each client thread, service end thread mute microphone (MIC) is simultaneously exited, so
Can economize on resources.
Optionally, when detecting service end thread and not creating, counter is opened, counter initial value is 0;Taken when creating
After business end line journey, counter adds 1;When detecting service end thread and having created, counter plus 1;Closed when recording is got
When closing instruction, counter is subtracted 1;When counter is 0, service end thread, and mute microphone (MIC) are closed.
Specifically, when detecting service end thread in step s 103 and not creating, terminal opens counter immediately, count
Device initial value is 0, and after service end thread is created, counter adds 1, illustrates that first application opens sound-recording function;Work as inspection
When measuring service end thread and having created, counter plus 1, illustrate and have an application to open sound-recording function;When getting record
During sound out code, counter is subtracted 1, illustrated that an application closes sound-recording function;When counter is 0, illustrate all
Using sound-recording function is all closed, terminal closes service end thread, and mute microphone (MIC), to economize on resources.
A kind of data processing method of the microphone of terminal is the embodiment of the invention provides, by increase and mi crophone communication
Service end thread and correspondence one unlatching sound-recording function application client thread, and service end thread also with multiple visitor
Family end thread communication, multiple threads are converted to by the single thread of prior art recording module, support that multiple applications can be simultaneously
Recording data is obtained, so as to realize that many applications can be while open sound-recording function.
Embodiment two
A kind of terminal with microphone is the embodiment of the invention provides, the realization of wherein each functional module may be referred to
Above-described embodiment, will not be repeated here.With reference to shown in Fig. 4, the terminal includes:
Recording module 11, the recording module 11 is connected with microphone 12, for when first application open sound-recording function when,
Recording open command is obtained, described first is created and is applied corresponding first client thread 111;Detection service end line journey 112 is
It is no to have created, wherein, the service end thread 112 communicates with microphone 12, is also communicated with multiple client thread 111, each
One application of unlatching sound-recording function of the correspondence of client thread 111;If having created, by first client thread 111
The recording open command is sent to the service end thread 112, is obtained by the Mike by the service end thread 112
The recording data that wind 12 is collected, the recording data that will be gathered is distributed to the first client thread 111, by the described first visitor
The recording data of distribution is returned to first application by family end line journey 111.
Optionally, the recording module 11 is additionally operable to:If not creating the service end thread 112, the service is created
End line journey 112, the service end thread 112 is sent to by first client thread 111 by the recording open command,
Microphone 12 is opened according to the recording open command by the service end thread 112, and acquisition is adopted by the microphone 12
The recording data for collecting, the recording data that will be gathered is distributed to first client thread 111, by first client
The recording data that end line journey 111 will be distributed returns to first application.
Optionally, the recording parameter needed for the recording open command includes the described first application, the recording parameter bag
Include following one or more:Sample rate, channel number, and recording format;The recording module 11, is additionally operable to by described
Before the recording data that one client thread 111 will be distributed returns to first application, the recording data that will be distributed is pressed
Conversion process is carried out according to the recording parameter needed for the described first application.
Optionally, the recording module 11 is additionally operable to:When sound-recording function is closed in the described first application, described first is closed
Client thread 111.
Optionally, the recording module 11, is additionally operable to after the service end thread 112 is created, by the service
End line journey 112 opens counter, and the counter initial value is 0;When the service end thread 112 receives recording open command
When, the counter is added 1 by the service end thread 112;When the service end thread 112 receives recording out code
When, counter described in 112 is subtracted 1 by the service end thread;When the counter is 0, by the service end thread
112 close the microphone, and exit.
It should be noted that the module in the present embodiment can be the processor individually set up, it is also possible to be integrated in terminal
Some processor in realize, in addition it is also possible in the memory for being stored in terminal in the form of the program code, by terminal
Some processor is called and performs the function of above unit.Processor described here can be a central processing unit
(English full name:Central Processing Unit, English abbreviation:), or specific integrated circuit (English full name CPU:
Application Specific Integrated Circuit, English abbreviation:ASIC), or be arranged to implement this hair
One or more integrated circuits of bright embodiment.
A kind of terminal with microphone is the embodiment of the invention provides, by increasing the service end line with mi crophone communication
One client thread of the application of unlatching sound-recording function of journey and correspondence, and service end thread is also logical with multiple client thread
Letter, multiple threads are converted to by the single thread of prior art recording module, support that multiple applications can simultaneously obtain recording number
According to so as to realize that many applications can be while open sound-recording function.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method can be with
Realize by another way.For example, device embodiment described above is only schematical, for example, the unit
Divide, only a kind of division of logic function there can be other dividing mode when actually realizing, for example multiple units or component
Can combine or be desirably integrated into another system, or some features can be ignored, or do not perform.It is another, it is shown or
The coupling each other for discussing or direct-coupling or communication connection can be the indirect couplings of device or unit by some interfaces
Close or communicate to connect, can be electrical, mechanical or other forms.
The unit that is illustrated as separating component can be or may not be it is physically separate, it is aobvious as unit
The part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be according to the actual needs selected to realize the mesh of this embodiment scheme
's.
In addition, during each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to
It is that the independent physics of unit includes, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list
Unit can both be realized in the form of hardware, it would however also be possible to employ hardware adds the form of SFU software functional unit to realize.
The above-mentioned integrated unit realized in the form of SFU software functional unit, can store and be deposited in an embodied on computer readable
In storage media.Above-mentioned SFU software functional unit storage is in a storage medium, including some instructions are used to so that a computer
Equipment (can be personal computer, server, or network equipment etc.) performs the portion of each embodiment methods described of the invention
Step by step.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (Read-Only Memory, abbreviation
ROM), random access memory (Random Access Memory, abbreviation RAM), magnetic disc or CD etc. are various can store
The medium of program code.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
The present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used
Modified with to the technical scheme described in foregoing embodiments, or equivalent is carried out to which part technical characteristic;
And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit and
Scope.
Claims (10)
1. a kind of data processing method of the microphone of terminal, it is characterised in that methods described includes:
When sound-recording function is opened in the first application, recording open command is obtained, create described first and apply corresponding first client
End line journey;
Whether detection service end line journey has created, wherein, the service end thread and mi crophone communication, also with multiple client line
Cheng Tongxin, one application of unlatching sound-recording function of each client thread correspondence;
If having created, the recording open command is sent to by the service end thread by the first client thread, passed through
The service end thread obtains the recording data collected by the microphone, and the recording data that will be gathered is distributed to the first visitor
Family end line journey, first application is returned to by first client thread by the recording data of distribution.
2. method according to claim 1, it is characterised in that methods described also includes:
If not creating the service end thread, the service end thread is created, will be described by first client thread
Recording open command is sent to the service end thread, and wheat is opened according to the recording open command by the service end thread
Gram wind, and the recording data collected by the microphone is obtained, the recording data that will be gathered is distributed to first client
End line journey, the recording data that will be distributed by first client thread returns to first application.
3. method according to claim 1 and 2, it is characterised in that the recording open command includes the described first application
Required recording parameter, the recording parameter includes following one or more:Sample rate, channel number, and recording format;
Methods described also includes:
Before the recording data that will be distributed by first client thread returns to first application, by what is distributed
Recording data carries out conversion process according to the recording parameter needed for the described first application.
4. method according to claim 1, it is characterised in that methods described also includes:
When sound-recording function is closed in the described first application, first client thread is closed.
5. method according to claim 2, it is characterised in that methods described also includes:
After the service end thread is created, counter is opened by the service end thread, the counter initial value is
0;
When the service end thread receives recording open command, the counter is added 1 by the service end thread;
When the service end thread receives recording out code, the counter is subtracted 1 by the service end thread;
When the counter is 0, the microphone is closed by the service end thread, and exit.
6. a kind of terminal with microphone, it is characterised in that the terminal includes:
Recording module, the recording module is connected with microphone, for when sound-recording function is opened in the first application, obtaining recording and opening
Instruction is opened, described first is created and is applied corresponding first client thread;Whether detection service end line journey has created, wherein, institute
Service end thread and mi crophone communication are stated, also with multiple client thread communication, each client thread correspondence one opens record
The application of sound function;If having created, the recording open command is sent to by the clothes by first client thread
Business end line journey, the recording data collected by the microphone, the recording number that will be gathered are obtained by the service end thread
According to the first client thread is distributed to, the recording data of distribution is returned into described first by first client thread should
With.
7. terminal according to claim 6, it is characterised in that the recording module is additionally operable to:
If not creating the service end thread, the service end thread is created, will be described by first client thread
Recording open command is sent to the service end thread, and wheat is opened according to the recording open command by the service end thread
Gram wind, and the recording data collected by the microphone is obtained, the recording data that will be gathered is distributed to first client
End line journey, the recording data that will be distributed by first client thread returns to first application.
8. the terminal according to claim 6 or 7, it is characterised in that the recording open command includes the described first application
Required recording parameter, the recording parameter includes following one or more:Sample rate, channel number, and recording format;
The recording module, is additionally operable to return to described in the recording data that will be distributed by first client thread
Before one application, the recording data that will be distributed carries out conversion process according to the recording parameter needed for the described first application.
9. terminal according to claim 6, it is characterised in that the recording module is additionally operable to:
When sound-recording function is closed in the described first application, first client thread is closed.
10. terminal according to claim 7, it is characterised in that the recording module, is additionally operable to creating the service end
After thread, counter is opened by the service end thread, the counter initial value is 0;
When the service end thread receives recording open command, the counter is added 1 by the service end thread;
When the service end thread receives recording out code, the counter is subtracted 1 by the service end thread;
When the counter is 0, the microphone is closed by the service end thread, and exit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710071670.6A CN106897146A (en) | 2017-02-09 | 2017-02-09 | The data processing method and the terminal with microphone of a kind of microphone of terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710071670.6A CN106897146A (en) | 2017-02-09 | 2017-02-09 | The data processing method and the terminal with microphone of a kind of microphone of terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106897146A true CN106897146A (en) | 2017-06-27 |
Family
ID=59198770
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710071670.6A Pending CN106897146A (en) | 2017-02-09 | 2017-02-09 | The data processing method and the terminal with microphone of a kind of microphone of terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106897146A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107957908A (en) * | 2017-11-20 | 2018-04-24 | 深圳创维数字技术有限公司 | A kind of microphone sharing method, device, computer equipment and storage medium |
CN109471680A (en) * | 2018-11-29 | 2019-03-15 | 深圳市车联天下信息科技有限公司 | The multimode way of recording, device and vehicle-mounted ancillary equipment |
CN109471606A (en) * | 2018-10-12 | 2019-03-15 | 深圳市小畅科技有限公司 | A kind of method of Android platform real-time recording concurrent processing |
CN109508230A (en) * | 2018-09-29 | 2019-03-22 | 百度在线网络技术(北京)有限公司 | Acquisition method, device and the storage medium of audio data |
CN109976697A (en) * | 2017-12-28 | 2019-07-05 | 深圳市优必选科技有限公司 | Obtain method and device, the equipment, computer readable storage medium of audio data |
CN109976696A (en) * | 2017-12-28 | 2019-07-05 | 深圳市优必选科技有限公司 | Obtain method and device, the equipment, computer readable storage medium of audio data |
CN110781014A (en) * | 2019-10-28 | 2020-02-11 | 苏州思必驰信息科技有限公司 | Recording data multi-process distribution method and system based on Android device |
CN111209121A (en) * | 2018-11-22 | 2020-05-29 | 深圳市优必选科技有限公司 | Recording method of application program, terminal device and medium |
CN111540385A (en) * | 2020-04-26 | 2020-08-14 | 西安广和通无线软件有限公司 | Recording data sharing method and device, computer equipment and storage medium |
CN111638966A (en) * | 2020-05-28 | 2020-09-08 | 维沃移动通信有限公司 | Resource acquisition method and device and electronic equipment |
CN112071337A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Recording control method and device, server and display equipment |
CN112071338A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Recording control method and device and display equipment |
CN115134452A (en) * | 2021-03-26 | 2022-09-30 | 成都鼎桥通信技术有限公司 | Calling method and device of microphone resources |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101299677A (en) * | 2008-04-30 | 2008-11-05 | 中兴通讯股份有限公司 | Method for sharing unity service course by multiple courses |
WO2009152731A1 (en) * | 2008-06-16 | 2009-12-23 | 腾讯科技(深圳)有限公司 | Game virtual machine and game development system and method for realizing the same |
CN102469064A (en) * | 2010-11-03 | 2012-05-23 | 中兴通讯股份有限公司 | Method for implementing communication and communication equipment |
CN102821340A (en) * | 2012-06-07 | 2012-12-12 | 惠州Tcl移动通信有限公司 | Method and device for dynamically tuning full-audio channel as well as intelligent terminal thereof |
CN103280232A (en) * | 2013-04-08 | 2013-09-04 | 北京小米科技有限责任公司 | Method and device for audio recording and terminal equipment |
CN106027487A (en) * | 2016-04-28 | 2016-10-12 | 广州广电运通金融电子股份有限公司 | Hardware equipment access management method and system |
-
2017
- 2017-02-09 CN CN201710071670.6A patent/CN106897146A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101299677A (en) * | 2008-04-30 | 2008-11-05 | 中兴通讯股份有限公司 | Method for sharing unity service course by multiple courses |
WO2009152731A1 (en) * | 2008-06-16 | 2009-12-23 | 腾讯科技(深圳)有限公司 | Game virtual machine and game development system and method for realizing the same |
CN102469064A (en) * | 2010-11-03 | 2012-05-23 | 中兴通讯股份有限公司 | Method for implementing communication and communication equipment |
CN102821340A (en) * | 2012-06-07 | 2012-12-12 | 惠州Tcl移动通信有限公司 | Method and device for dynamically tuning full-audio channel as well as intelligent terminal thereof |
CN103280232A (en) * | 2013-04-08 | 2013-09-04 | 北京小米科技有限责任公司 | Method and device for audio recording and terminal equipment |
CN106027487A (en) * | 2016-04-28 | 2016-10-12 | 广州广电运通金融电子股份有限公司 | Hardware equipment access management method and system |
Non-Patent Citations (1)
Title |
---|
SIGRLAMI: "Use microphone in multiple app simultaneously in Android", 《HTTPS://STACKOVERFLOW.COM/QUESTIONS/25402434/USE-MICROPHONE-IN-MULTIPLE-APP-SIMULTANEOUSLY-IN-ANDROID》 * |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107957908A (en) * | 2017-11-20 | 2018-04-24 | 深圳创维数字技术有限公司 | A kind of microphone sharing method, device, computer equipment and storage medium |
CN109976696A (en) * | 2017-12-28 | 2019-07-05 | 深圳市优必选科技有限公司 | Obtain method and device, the equipment, computer readable storage medium of audio data |
CN109976696B (en) * | 2017-12-28 | 2022-05-10 | 深圳市优必选科技有限公司 | Method and device for acquiring audio data, equipment and computer-readable storage medium |
CN109976697A (en) * | 2017-12-28 | 2019-07-05 | 深圳市优必选科技有限公司 | Obtain method and device, the equipment, computer readable storage medium of audio data |
CN109508230A (en) * | 2018-09-29 | 2019-03-22 | 百度在线网络技术(北京)有限公司 | Acquisition method, device and the storage medium of audio data |
CN109471606B (en) * | 2018-10-12 | 2021-10-08 | 深圳市小畅科技有限公司 | Method for concurrently processing real-time recording of android platform |
CN109471606A (en) * | 2018-10-12 | 2019-03-15 | 深圳市小畅科技有限公司 | A kind of method of Android platform real-time recording concurrent processing |
CN111209121A (en) * | 2018-11-22 | 2020-05-29 | 深圳市优必选科技有限公司 | Recording method of application program, terminal device and medium |
CN111209121B (en) * | 2018-11-22 | 2023-05-23 | 深圳市优必选科技有限公司 | Recording method of application program, terminal equipment and medium |
CN109471680A (en) * | 2018-11-29 | 2019-03-15 | 深圳市车联天下信息科技有限公司 | The multimode way of recording, device and vehicle-mounted ancillary equipment |
CN112071337A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Recording control method and device, server and display equipment |
CN112071338A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Recording control method and device and display equipment |
CN110781014A (en) * | 2019-10-28 | 2020-02-11 | 苏州思必驰信息科技有限公司 | Recording data multi-process distribution method and system based on Android device |
CN110781014B (en) * | 2019-10-28 | 2022-11-01 | 思必驰科技股份有限公司 | Recording data multi-process distribution method and system based on Android device |
CN111540385A (en) * | 2020-04-26 | 2020-08-14 | 西安广和通无线软件有限公司 | Recording data sharing method and device, computer equipment and storage medium |
CN111638966A (en) * | 2020-05-28 | 2020-09-08 | 维沃移动通信有限公司 | Resource acquisition method and device and electronic equipment |
CN115134452A (en) * | 2021-03-26 | 2022-09-30 | 成都鼎桥通信技术有限公司 | Calling method and device of microphone resources |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106897146A (en) | The data processing method and the terminal with microphone of a kind of microphone of terminal | |
CN106911831A (en) | The data processing method and the terminal with microphone of a kind of microphone of terminal | |
CN101313482B (en) | Determination of audio device quality | |
CN100579261C (en) | Method for simulating AT command report | |
CN108446341A (en) | Service condition querying method, device, computer equipment and storage medium | |
CN101930399A (en) | Method for recording software test | |
CN108600045A (en) | A kind of service link monitoring method and device | |
CN106375458A (en) | Service call system, method and device | |
CN113422794A (en) | Traffic recording and playback processing method and device and electronic equipment | |
CN108391020A (en) | A kind of call control method, device, equipment and storage medium | |
CN102427465A (en) | Voice service proxy method and device and system for integrating voice application through proxy | |
CN110232553A (en) | Meeting support system and computer-readable recording medium | |
CN106708632A (en) | Information editing method and information editing device | |
CN111627446A (en) | Communication conference system based on intelligent voice recognition technology | |
CN107958059A (en) | Intelligent answer method, apparatus, terminal and computer-readable recording medium | |
CN103839547A (en) | System for loading corresponding instruction elements by comparing voice operation signals and method thereof | |
MXPA01012606A (en) | A system and method for call record creation and processing. | |
CN108595412A (en) | Correction processing method and device, computer equipment and readable medium | |
CN106953962A (en) | A kind of call recording method and device | |
CN106997313A (en) | A kind of signal processing method of application program, system and terminal device | |
CN110286991A (en) | A kind of information processing method and device | |
CN107437165A (en) | Smart machine event management method, device and system | |
US20030050789A1 (en) | Method and apparatus for monitoring execution of a business process managed using a state machine | |
CN108173740A (en) | A kind of method and apparatus of voice communication | |
CN106897172A (en) | System method to set up, device and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170627 |