CN113835672A - Linux-compatible Android audio control method, system and device - Google Patents

Linux-compatible Android audio control method, system and device Download PDF

Info

Publication number
CN113835672A
CN113835672A CN202111389949.1A CN202111389949A CN113835672A CN 113835672 A CN113835672 A CN 113835672A CN 202111389949 A CN202111389949 A CN 202111389949A CN 113835672 A CN113835672 A CN 113835672A
Authority
CN
China
Prior art keywords
audio
audio control
linux
android
control request
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
Application number
CN202111389949.1A
Other languages
Chinese (zh)
Inventor
杨锦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing Jingling Information System Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Jingling Information System Technology Co Ltd filed Critical Beijing Jingling Information System Technology Co Ltd
Priority to CN202111389949.1A priority Critical patent/CN113835672A/en
Publication of CN113835672A publication Critical patent/CN113835672A/en
Priority to PCT/CN2022/133414 priority patent/WO2023093699A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/16Sound input; Sound output
    • G06F3/162Interface to dedicated audio devices, e.g. audio drivers, interface to CODECs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention provides a Linux-compatible Android audio control method, system and device, wherein the method comprises the following steps: receiving an audio control request sent by an Android terminal and obtained through Socket; and calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket. The method and the device are used for solving the defect that the audio drive cannot be controlled by the Android audio application program in the Linux-compatible Android system in the prior art.

Description

Linux-compatible Android audio control method, system and device
Technical Field
The invention relates to the technical field of computers, in particular to a Linux-compatible Android audio control method, system and device.
Background
With the national emphasis on information network security, more and more operating systems are beginning to consider compatibility and security. Due to the security mechanism of the Linux system, the Linux system is often used as an operating system with high security performance, and in addition, the Android system is the operating system with the highest market share in the current mobile terminal market, and has an excellent ecological environment in the field of mobile terminals. Therefore, the compatibility of the Android application ecology on the Linux operating system becomes a recent research hotspot.
How to control audio drivers by a compatible Android application program on a Linux operating system is an important issue to be solved urgently in the industry at present.
Disclosure of Invention
The invention provides a Linux-compatible Android audio control method, system and device, which are used for solving the defect that an Android audio application program cannot control audio driving in a Linux-compatible Android system in the prior art, and realizing that the Android audio application program can control the audio driving.
The invention provides a Linux audio control method compatible with Android, which is applied to a Linux end, wherein the Linux end comprises the following steps: the method comprises the following steps that audio service is pre-established service capable of communicating with an Android terminal and is applied to the audio service, and the method comprises the following steps:
receiving an audio control request sent by the Android terminal and obtained through Socket;
and calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
According to the Linux-compatible Android audio control method provided by the invention, the audio control request carries an audio control type;
the calling audio service interface, before controlling an audio driver to execute an operation corresponding to the audio control request through the audio service interface, further includes:
analyzing and obtaining an audio control type corresponding to the audio control request, wherein the audio control type comprises: an audio recording type and an audio playing type;
the calling audio service interface controls an audio driver to execute an operation corresponding to the audio control request through the audio service interface, and the operation comprises the following steps:
when the audio control type is the audio recording type, calling the audio service interface, and controlling the audio driver to execute audio recording operation through the audio service interface;
and when the audio control type is the audio playing type, calling the audio service interface, and controlling the audio driver to execute audio playing operation through the audio service interface.
According to the Linux-compatible Android audio control method provided by the invention, the step of returning the execution result of the audio driver to the Android terminal through the Socket comprises the following steps:
when the audio control type is the audio recording type, receiving audio data returned by the audio driver through the audio service interface, and returning the audio data to the Android terminal through the Socket;
and when the audio control type is the audio playing type, receiving a success identifier returned by the audio driver through the audio service interface, and returning the success identifier to the Android terminal through the Socket.
According to the Linux-Android-compatible audio control method provided by the invention, before receiving the audio control request sent by the Android terminal obtained through Socket, the method further comprises the following steps:
and when the state of the pre-stored hardware parameter of the audio driver is determined to be effective, establishing the communication connection between the Android terminal and the Linux terminal.
The invention also provides a Linux-compatible Android audio control method, which is applied to an Android terminal: the method comprises the following steps of comprising an HAL layer, wherein the HAL layer is used for communicating with a Linux end, and the method comprises the following steps:
generating an audio control request, and sending the audio control request to a Linux end through a Socket by using the HAL layer;
and receiving an execution result corresponding to the audio control request, which is returned by the Linux end through the Socket.
According to the Linux-compatible Android audio control method provided by the invention, the audio control request carries an audio control type;
the generating an audio control request comprises:
determining an audio control type of the audio control request;
when the audio control type is the audio recording type, generating an audio control request carrying the audio recording type;
and when the audio control type is the audio playing type, generating an audio control request carrying the audio playing type.
According to the audio control method compatible with Android by Linux, the receiving of the execution result corresponding to the audio control request, which is returned by the Linux through the Socket, comprises the following steps:
when the audio control type is the audio recording type, receiving audio data returned by the Linux end through the Socket;
and when the audio control type is the audio playing type, receiving a success identifier returned by the Linux end through the Socket.
The invention also provides a Linux-compatible Android audio control system, which comprises: the system comprises a Linux end and an Android end, wherein the Linux end comprises: the audio service is a pre-established service capable of communicating with the Android terminal, and the Android terminal: the system comprises an HAL layer, a Linux end and a power supply, wherein the HAL layer is used for communicating with the Linux end;
the Android terminal is used for generating an audio control request, and sending the audio control request to the Linux terminal through a Socket by using an HAL layer;
the Linux end is used for receiving the audio control request by using the audio service, calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android end through the Socket;
and the Android end is further used for receiving an execution result corresponding to the audio control request returned by the Linux end.
The invention also provides a Linux-compatible Android audio control device, which comprises:
the receiving module is used for receiving the audio control request sent by the Android terminal and obtained through Socket;
and the control module is used for calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
The invention also provides a Linux-compatible Android audio control device, which comprises:
the generating module is used for generating an audio control request and sending the audio control request to a Linux end through a Socket by utilizing an HAL layer;
and the receiving module is used for receiving an execution result which is returned by the Linux end through the Socket and corresponds to the audio control request.
The audio control method, the system and the device are compatible with Android and used for Linux, the method is applied to audio service of a Linux end, and the audio control request sent by the Android end and obtained through Socket is received; and calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic flowchart illustrating a Linux-compatible Android audio control method according to an embodiment of the present invention;
FIG. 2 is a second flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 3 is a third schematic flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 4 is a fourth flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 5 is a fifth flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 6A is a sixth schematic flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 6B is a seventh flowchart illustrating a Linux-compatible Android audio control method according to the present invention;
FIG. 7 is a structural diagram of the Linux-compatible Android audio control system provided in the present invention;
FIG. 8 is a schematic structural diagram of a Linux-compatible Android audio control device according to the present invention;
FIG. 9 is a second schematic structural diagram of the Linux-compatible Android audio control device according to the present invention;
fig. 10 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The Linux-compatible Android audio control method of the present invention is described below with reference to fig. 1 to 6B.
The following exemplifies a usage scenario of the method.
Specifically, a Linux system is installed in the intelligent terminal, but an Android application program is installed in the Linux system. The intelligent terminal can be a mobile intelligent terminal, such as a laptop, a tablet, a mobile phone and the like, and can also be a non-mobile intelligent terminal, such as a desktop computer and the like. In the following, the smart terminal is taken as an example of a mobile phone, but it should be noted that the description is only an example and is not intended to limit the scope of the present invention. The other descriptions in the embodiments of the present invention are also for illustration purposes, and are not intended to limit the scope of the present invention.
The embodiment of the invention provides a Linux-compatible Android audio control method applied to a Linux end, wherein the Linux end comprises: the method is applied to the audio service, and the specific implementation of the method is as shown in fig. 1:
step 101, receiving an audio control request sent by an Android terminal, which is obtained through Socket.
Specifically, a service (AudioServer) capable of communicating with the Android terminal is created in advance on the Linux terminal, and the service is communicated with the Android terminal through the AudioServer. And the Audio Server receives the audio control request sent by the Android terminal and obtained through the Socket.
Specifically, before the Linux end and the Android end communicate, the AudioServer obtains hardware parameters of the audio driver through an audio service interface (PulseAudio API), where the hardware parameters include: support recording function, support broadcasting function, not support recording function and not support broadcasting function, etc. The audioservice sets the state of the hardware parameter of the audio driver supporting the recording function and the broadcasting function to be valid, and sets the state of the hardware parameter of the audio driver not supporting the recording function and the broadcasting function to be invalid, and stores the state, which can be specifically shown in fig. 2.
S201, the AudioServer is successfully established.
S202, the audioServer sends a hardware parameter acquisition request to the audio driver.
S203, the audio driver returns the hardware parameters.
And S204, the AudioServer stores and manages the hardware parameters.
The PulseAudio is an Interface library of a third party, and a plurality of Application Programming Interfaces (APIs) are defined in the PulseAudio. The invention transfers the audio control request to the PulseAudio API by calling the PulseAudio API in the interface library, and then calls the audio driver by the PulseAudio API to execute the operation corresponding to the audio control request.
Wherein, the AudioServer operates as a service under a common user in the Linux end.
In a specific embodiment, when the audioserver receives an audio control request sent by an Android terminal, whether a communication connection between the Android terminal and a Linux terminal is established is judged based on a pre-stored state of a hardware parameter of an audio driver, when the state of the hardware parameter of the audio driver is valid, the communication connection between the Android terminal and the Linux terminal is established, and when the state of the hardware parameter of the audio driver is invalid, the communication connection between the Android terminal and the Linux terminal is not established.
And step 102, calling an audio service interface, controlling an audio driver to execute an operation corresponding to the audio control request through the audio service interface, and returning an execution result of the audio driver to an Android terminal through Socket.
In one embodiment, the audio control request carries an audio control type, and therefore, before controlling the audio driver to execute an operation corresponding to the audio control request, the audio control request needs to be parsed to obtain the audio control type corresponding to the audio control request, where the audio control type includes: an audio recording type and an audio playing type. Further, after the audio control type is obtained, the audio driver is controlled to perform an operation corresponding to the audio control type based on the audio control type. The method comprises the following specific steps:
when the audio control type is an audio recording type, calling an audio service interface, and controlling an audio driver to execute an audio recording operation through the audio service interface; and when the audio control type is an audio playing type, calling an audio service interface, and controlling an audio driver to execute audio playing operation through the audio service interface.
In one embodiment, the data returned by the audio driver received by the AudioServer is different for different audio control types. When the audio control type is an audio recording type, receiving audio data returned by an audio driver through an audio service interface, and returning the audio data to the Android terminal through a Socket; and when the audio control type is an audio playing type, receiving a success identifier returned by the audio driver through the audio service interface, and returning the success identifier to the Android terminal through the Socket.
The audio data is in a Pulse Code Modulation (PCM) format, and the PCM audio data is a bare stream of uncompressed audio sample data, which is standard digital audio data converted from analog signals through sampling, quantization and encoding.
Specifically, all the data received by the AudioServer are valid data returned by the audio driver, and of course, the audio driver may also return invalid data, for example, when the audio control type is an audio recording type, and the audio recorded by the audio driver is null, the null audio data is returned to the AudioServer; for another example, when the audio control type is an audio play type, the audio driver returns a failure flag to the AudioServer.
The audio control method, the system and the device are compatible with Android and used for Linux, the method is applied to audio service of a Linux end, and the audio control request sent by the Android end and obtained through Socket is received; and calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
The embodiment of the invention provides a Linux-compatible Android audio control method applied to an Android terminal, which comprises the following steps: the method comprises an HAL layer and an HAL layer, wherein the HAL layer is used for communicating with a Linux end, and the specific implementation of the method is shown in FIG. 3:
step 301, generating an audio control request, and sending the audio control request to a Linux end through a Socket by using an HAL layer.
Specifically, the HAL layer and the audio-related codes are modified in advance, so that the Android end can be connected to the audioServer of the Linux end through the modified HAL layer. Therefore, the HAL layer of the Android side is modified to be able to communicate with the AudioServer of the Linux side.
Specifically, the Android terminal further includes an audio application program, and the audio application program is used for generating an audio control request by operating the audio application program of the Android terminal. For example, the audio application includes a record button and an announcement button, and the user generates the audio control request by clicking the record button or the announcement button.
In a specific embodiment, the audio control request carries an audio control type, the audio control type corresponding to the audio control request generated by triggering the recording button is preset to be an audio recording type, and the audio control type corresponding to the audio control request generated by triggering the broadcasting button is a request type relation table of the audio broadcasting type. Therefore, the audio control type of the audio control request is determined based on the request type relation table; when the audio control type is an audio recording type, generating an audio control request carrying the audio recording type; and when the audio control type is the audio playing type, generating an audio control request carrying the audio playing type.
And step 302, receiving an execution result corresponding to the audio control request, which is returned by the Linux end through the Socket.
In a specific embodiment, the data returned by the Linux terminal received by the Android terminal is different for different audio control types.
When the audio control type is an audio recording type, receiving audio data returned by the Linux end through a Socket; and when the audio control type is the audio playing type, receiving a success identifier returned by the Linux end through the Socket.
Specifically, the Android end receives valid data returned by the Linux end, and of course, the Linux end may also return invalid data, for example, when the audio control type is an audio recording type, and the audio data returned by the Linux end is null, the null audio data is returned to the Android end; for another example, when the audio control type is an audio play type, the Linux end returns a failure identifier to the Android end.
The audio control method, the audio control system and the audio control device are compatible with the Android and are applied to an Android terminal, the audio control request is generated, and the audio control request is sent to the Linux terminal through a Socket by utilizing an HAL layer; the method and the device have the advantages that the Socket is utilized to realize the communication between the Linux end and the Android end, so that the audio control request generated by the Android end can be sent to the Linux end, the Linux end controls the audio driver to execute corresponding operation based on the audio control request, the execution result is returned to the Android end, and the purpose that the audio application program of the Android can control the audio driver is achieved.
The Android, Linux, and audio driver process interaction is described below with reference to fig. 4:
firstly, an audio control request is generated by an audio application program of an Android terminal, and the audio control request is sent to a HAL layer of the Android terminal.
And moreover, the HAL layer sends the audio control request to the audioServer of the Linux end through the Socket.
Furthermore, the AudioServer calls a PulseAudio API based on the audio control request, and controls the audio driver to execute an operation corresponding to the audio control request through the PulseAudio API.
And finally, returning the execution result to the audioServer through the audio driver, returning the execution result to the HAL layer by the audioServer, and returning the execution result to the audio application program by the HAL layer.
The following describes the flow interaction between the Android end and the Linux end with reference to fig. 5:
wherein the HAL layer comprises: an audio module, the audio module comprising: broadcast module, recording module, write function and read function.
When broadcasting, the broadcasting module receives audio data carried by an audio application program through an audio control request, calls a write function, writes the audio data into a Socket, and sends the audio data to the AudioServer through the Socket. At this time, AudioServer calls a read function to read audio data.
When recording, the audio driver sends audio data to the AudioServer, the AudioServer calls a write function, the audio data is written into a Socket, the audio data is sent to a recording module on the HAL layer through the Socket, and the recording module calls a read function to obtain the audio data and record the audio data.
In the following, the data interaction of the audio application, the HAL layer, the AudioServer and the audio driver is specifically described with reference to fig. 6A and 6B:
in the following embodiments, a video control request corresponding to an audio control type being an audio recording type is defined as a recording control request, and a video control request corresponding to an audio control type being an audio playing type is defined as a broadcast control request.
Fig. 6A is a detailed description of the broadcast control request.
S611, the audio application generates a broadcast control request.
S612, the audio application sends the broadcast control request to the HAL layer.
And S613, the HAL layer sends the broadcast control request to the AudioServer, wherein the broadcast control request carries the audio control type.
And S614, the AudioServer judges whether to accept the broadcast control request, if so, S615 is executed, and otherwise, the communication connection is disconnected.
S615, the AudioServer returns the request for receiving broadcast control to the HAL layer, so as to establish a communication connection.
And S616, the HAL layer calls a write function, writes the audio data and sends the audio data to the AudioServer.
S617, the Audio Server calls the read function, reads the audio data, calls the pulseAudio API, and sends the audio data to the audio driver through the pulseAudio API.
S618, the audio driver plays the audio data.
Fig. 6B is a specific illustration corresponding to the recording control request.
S621, the audio application generates a recording control request.
S622, the audio application sends the recording control request to the HAL layer.
And S623, the HAL layer sends the recording control request to the AudioServer, wherein the recording control request carries the audio control type.
And S624, the AudioServer judges whether to accept the recording control request, if so, S625 is executed, and otherwise, the communication connection is disconnected.
S625, the AudioServer returns the request of receiving the recording control to the HAL layer to establish the communication connection.
And S626, the AudioServer sends the recording control request to the audio driver.
And S627, recording by the audio driver, and sending audio data generated by recording to the AudioServer.
And S628, the AudioServer calls a write function, writes the audio data and returns the audio data to the HAL layer.
S629, the HAL layer sends the audio data to the audio application.
Wherein, the communication between the AudioServer and the HAL layer can also adopt UNIX-domain Socket to carry out communication. The embodiment of the invention also provides a Linux-Android-compatible audio control system, and the Linux-Android-compatible audio control system and the Linux-Android-compatible audio control method which are described below can be correspondingly referred to each other, and repeated parts are not repeated. As shown in fig. 7: the system comprises: linux 701 and Android end 702, Linux 701 includes: audio service, the audio service is a service which is created in advance and can communicate with the Android terminal 702, and the Android terminal 702: the system comprises an HAL layer and an HAL layer, wherein the HAL layer is used for communicating with a Linux end 701;
the Android terminal 702 is configured to generate an audio control request, and send the audio control request to the Linux terminal 701 through a Socket by using an HAL layer;
the Linux terminal 701 is configured to receive an audio control request by using an audio service, call an audio service interface, control an audio driver to execute an operation corresponding to the audio control request through the audio service interface, and return an execution result of the audio driver to the Android terminal 702 through a Socket;
the Android end 702 is further configured to receive an execution result corresponding to the audio control request, which is returned by the Linux end 701.
The Linux-compatible Android audio control device and the Linux-compatible Android audio control method described below can be referred to in a corresponding manner, and repeated parts are not repeated. As shown in fig. 8, the apparatus includes:
the receiving module 801 is used for receiving an audio control request sent by an Android terminal, which is obtained through Socket;
and the control module 802 is configured to call an audio service interface, control the audio driver to execute an operation corresponding to the audio control request through the audio service interface, and return an execution result of the audio driver to the Android terminal through the Socket.
In one embodiment, the audio control request carries an audio control type; the control module 802 is further configured to analyze and obtain an audio control type corresponding to the audio control request, where the audio control type includes: an audio recording type and an audio playing type; the control module 802 is specifically configured to, when the audio control type is an audio recording type, invoke an audio service interface, and control the audio driver to execute an audio recording operation through the audio service interface; and when the audio control type is an audio playing type, calling an audio service interface, and controlling an audio driver to execute audio playing operation through the audio service interface.
The control module 802 is specifically configured to receive audio data returned by the audio driver through the audio service interface when the audio control type is an audio recording type, and return the audio data to the Android terminal through the Socket; and when the audio control type is an audio playing type, receiving a success identifier returned by the audio driver through the audio service interface, and returning the success identifier to the Android terminal through the Socket.
In an embodiment, the receiving module 801 is further configured to establish a communication connection between the Android end and the Linux end when it is determined that the state of the pre-stored hardware parameter of the audio driver is valid.
The Linux-compatible Android audio control device and the Linux-compatible Android audio control method described below can be referred to in a corresponding manner, and repeated parts are not repeated. As shown in fig. 9, the apparatus includes:
a generating module 901, configured to generate an audio control request, and send the audio control request to a Linux end through a Socket by using an HAL layer;
the receiving module 902 is configured to receive an execution result corresponding to the audio control request, where the execution result is returned by the Linux end through the Socket.
In one embodiment, the audio control request carries an audio control type; a generating module 901, specifically configured to determine an audio control type of the audio control request; when the audio control type is an audio recording type, generating an audio control request carrying the audio recording type; and when the audio control type is the audio playing type, generating an audio control request carrying the audio playing type.
In a specific embodiment, the receiving module 902 is specifically configured to receive, when the audio control type is an audio recording type, audio data returned by a Socket from a Linux end; and when the audio control type is the audio playing type, receiving a success identifier returned by the Linux end through the Socket.
Fig. 10 illustrates a physical structure diagram of an electronic device, and as shown in fig. 10, the electronic device may include: a processor (processor)1001, a communication Interface (communication Interface)1002, a memory (memory)1003 and a communication bus 1004, wherein the processor 1001, the communication Interface 1002 and the memory 1003 complete communication with each other through the communication bus 1004. The processor 1001 may call the logic instruction in the memory 1003 to execute the Linux-compatible Android audio control method applied to the Linux side, where the Linux side includes: the method comprises the following steps that audio service is pre-established service capable of communicating with an Android terminal, and the method comprises the following steps: receiving an audio control request sent by an Android terminal and obtained through Socket; calling an audio service interface, controlling an audio driver to execute an operation corresponding to an audio control request through the audio service interface, and returning an execution result of the audio driver to an Android terminal through Socket, or executing a Linux-compatible Android audio control method applied to the Android terminal, wherein the Android terminal comprises: an HAL layer, the HAL layer, for communicating with a Linux end, the method comprising: generating an audio control request, and sending the audio control request to a Linux end through a Socket by utilizing an HAL layer; and receiving an execution result corresponding to the audio control request returned by the Linux through the Socket.
In addition, the logic instructions in the memory 1003 may be implemented in the form of software functional units and may be stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer being capable of executing the Linux-compatible Android audio control method applied to a Linux peer provided by the above methods, the Linux peer comprising: the method comprises the following steps that audio service is pre-established service capable of communicating with an Android terminal, and the method comprises the following steps: receiving an audio control request sent by an Android terminal and obtained through Socket; calling an audio service interface, controlling an audio driver to execute an operation corresponding to an audio control request through the audio service interface, and returning an execution result of the audio driver to an Android terminal through Socket, or applying the audio driver to an Android terminal, wherein the Android terminal is compatible with the Android audio control method of Linux, and comprises the following steps: an HAL layer, the HAL layer, for communicating with a Linux end, the method comprising: generating an audio control request, and sending the audio control request to a Linux end through a Socket by utilizing an HAL layer; and receiving an execution result corresponding to the audio control request returned by the Linux through the Socket.
The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, where the computer program is implemented by a processor to execute the above Linux-compatible Android audio control methods applied to a Linux peer, where the Linux peer includes: the method comprises the following steps that audio service is pre-established service capable of communicating with an Android terminal, and the method comprises the following steps: receiving an audio control request sent by an Android terminal and obtained through Socket; calling an audio service interface, controlling an audio driver to execute an operation corresponding to an audio control request through the audio service interface, and returning an execution result of the audio driver to an Android terminal through Socket, or applying the audio driver to an Android terminal, wherein the Android terminal is compatible with the Android audio control method of Linux, and comprises the following steps: an HAL layer, the HAL layer, for communicating with a Linux end, the method comprising: generating an audio control request, and sending the audio control request to a Linux end through a Socket by utilizing an HAL layer; and receiving an execution result corresponding to the audio control request returned by the Linux through the Socket.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. The audio control method compatible with Android is applied to a Linux end, and the Linux end comprises the following steps: the method comprises the following steps that audio service is pre-established service capable of communicating with an Android terminal and is applied to the audio service, and the method comprises the following steps:
receiving an audio control request sent by the Android terminal and obtained through Socket;
and calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
2. The Linux-compatible Android audio control method of claim 1, wherein the audio control request carries an audio control type;
the calling audio service interface, before controlling an audio driver to execute an operation corresponding to the audio control request through the audio service interface, further includes:
analyzing and obtaining an audio control type corresponding to the audio control request, wherein the audio control type comprises: an audio recording type and an audio playing type;
the calling audio service interface controls an audio driver to execute an operation corresponding to the audio control request through the audio service interface, and the operation comprises the following steps:
when the audio control type is the audio recording type, calling the audio service interface, and controlling the audio driver to execute audio recording operation through the audio service interface;
and when the audio control type is the audio playing type, calling the audio service interface, and controlling the audio driver to execute audio playing operation through the audio service interface.
3. The Linux-compatible Android audio control method of claim 2, wherein the returning the execution result of the audio driver to the Android terminal through the Socket comprises:
when the audio control type is the audio recording type, receiving audio data returned by the audio driver through the audio service interface, and returning the audio data to the Android terminal through the Socket;
and when the audio control type is the audio playing type, receiving a success identifier returned by the audio driver through the audio service interface, and returning the success identifier to the Android terminal through the Socket.
4. The audio control method according to any one of claims 1 to 3, wherein before receiving the audio control request sent by the Android client via Socket, the audio control method further comprises:
and when the state of the pre-stored hardware parameter of the audio driver is determined to be effective, establishing the communication connection between the Android terminal and the Linux terminal.
5. The Linux-compatible Android audio control method is applied to an Android terminal, and the Android terminal comprises the following steps: the method comprises the following steps of comprising an HAL layer, wherein the HAL layer is used for communicating with a Linux end, and the method comprises the following steps:
generating an audio control request, and sending the audio control request to a Linux end through a Socket by using the HAL layer;
and receiving an execution result corresponding to the audio control request, which is returned by the Linux end through the Socket.
6. The Linux-compatible Android audio control method of claim 5, wherein the audio control request carries an audio control type;
the generating an audio control request comprises:
determining an audio control type of the audio control request;
when the audio control type is the audio recording type, generating an audio control request carrying the audio recording type;
and when the audio control type is the audio playing type, generating an audio control request carrying the audio playing type.
7. The Linux-compatible Android audio control method of claim 6, wherein the receiving the execution result corresponding to the audio control request returned by the Linux terminal through the Socket comprises:
when the audio control type is the audio recording type, receiving audio data returned by the Linux end through the Socket;
and when the audio control type is the audio playing type, receiving a success identifier returned by the Linux end through the Socket.
8. A Linux-compatible Android audio control system, comprising: the system comprises a Linux end and an Android end, wherein the Linux end comprises: the audio service is a pre-established service capable of communicating with the Android terminal, and the Android terminal: the system comprises an HAL layer, a Linux end and a power supply, wherein the HAL layer is used for communicating with the Linux end;
the Android terminal is used for generating an audio control request, and the HAL layer is used for sending the audio control request to the Linux terminal through Socket;
the Linux end is used for receiving the audio control request by using the audio service, calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android end through the Socket;
and the Android end is further used for receiving an execution result corresponding to the audio control request returned by the Linux end.
9. The Linux-compatible Android audio control device is characterized by comprising:
the receiving module is used for receiving the audio control request sent by the Android terminal and obtained through Socket;
and the control module is used for calling an audio service interface, controlling an audio driver to execute the operation corresponding to the audio control request through the audio service interface, and returning the execution result of the audio driver to the Android terminal through the Socket.
10. The Linux-compatible Android audio control device is characterized by comprising:
the generating module is used for generating an audio control request and sending the audio control request to a Linux end through a Socket by utilizing an HAL layer;
and the receiving module is used for receiving an execution result which is returned by the Linux end through the Socket and corresponds to the audio control request.
CN202111389949.1A 2021-11-23 2021-11-23 Linux-compatible Android audio control method, system and device Pending CN113835672A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111389949.1A CN113835672A (en) 2021-11-23 2021-11-23 Linux-compatible Android audio control method, system and device
PCT/CN2022/133414 WO2023093699A1 (en) 2021-11-23 2022-11-22 Audio control method, system and apparatus for linux-compatible android

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111389949.1A CN113835672A (en) 2021-11-23 2021-11-23 Linux-compatible Android audio control method, system and device

Publications (1)

Publication Number Publication Date
CN113835672A true CN113835672A (en) 2021-12-24

Family

ID=78971477

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111389949.1A Pending CN113835672A (en) 2021-11-23 2021-11-23 Linux-compatible Android audio control method, system and device

Country Status (2)

Country Link
CN (1) CN113835672A (en)
WO (1) WO2023093699A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113990354A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux
CN114168211A (en) * 2022-02-14 2022-03-11 麒麟软件有限公司 Method for associating Android application with Linux screen locking mechanism during system compatibility
CN114242105A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 Method and system for implementing recording and noise reduction on Android application
WO2023093699A1 (en) * 2021-11-23 2023-06-01 北京字节跳动网络技术有限公司 Audio control method, system and apparatus for linux-compatible android
WO2023124007A1 (en) * 2021-12-29 2023-07-06 北京字节跳动网络技术有限公司 Linux-based camera control method and apparatus, and device and storage medium
CN116860201A (en) * 2023-09-05 2023-10-10 麒麟软件有限公司 Independent volume adjustment control method and device for android application in Linux system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017177873A1 (en) * 2016-04-15 2017-10-19 中兴通讯股份有限公司 System and method for synchronous audio recording and playing, and storage medium
CN111930340A (en) * 2020-09-21 2020-11-13 北京技德系统技术有限公司 Virtual audio device and method based on Linux and Android compatible technology

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9626284B2 (en) * 2012-02-09 2017-04-18 Vmware, Inc. Systems and methods to test programs
CN113572954B (en) * 2021-06-15 2022-10-04 荣耀终端有限公司 Video recording method, electronic device and medium
CN113593567B (en) * 2021-06-23 2022-09-09 荣耀终端有限公司 Method for converting video and sound into text and related equipment
CN113835672A (en) * 2021-11-23 2021-12-24 北京鲸鲮信息系统技术有限公司 Linux-compatible Android audio control method, system and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017177873A1 (en) * 2016-04-15 2017-10-19 中兴通讯股份有限公司 System and method for synchronous audio recording and playing, and storage medium
CN111930340A (en) * 2020-09-21 2020-11-13 北京技德系统技术有限公司 Virtual audio device and method based on Linux and Android compatible technology

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023093699A1 (en) * 2021-11-23 2023-06-01 北京字节跳动网络技术有限公司 Audio control method, system and apparatus for linux-compatible android
CN113990354A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux
WO2023124002A1 (en) * 2021-12-29 2023-07-06 北京字节跳动网络技术有限公司 Linux-based audio control method and apparatus, device, and storage medium
WO2023124007A1 (en) * 2021-12-29 2023-07-06 北京字节跳动网络技术有限公司 Linux-based camera control method and apparatus, and device and storage medium
CN114168211A (en) * 2022-02-14 2022-03-11 麒麟软件有限公司 Method for associating Android application with Linux screen locking mechanism during system compatibility
CN114242105A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 Method and system for implementing recording and noise reduction on Android application
CN116860201A (en) * 2023-09-05 2023-10-10 麒麟软件有限公司 Independent volume adjustment control method and device for android application in Linux system
CN116860201B (en) * 2023-09-05 2023-11-28 麒麟软件有限公司 Independent volume adjustment control method and device for android application in Linux system

Also Published As

Publication number Publication date
WO2023093699A1 (en) 2023-06-01

Similar Documents

Publication Publication Date Title
CN113835672A (en) Linux-compatible Android audio control method, system and device
CN108521608B (en) Video file processing method and device, terminal and storage medium
CN104980788A (en) Video decoding method and device
CN113990354B (en) Audio control method, device, equipment and storage medium based on Linux
CN103812755A (en) Message synchronization method and device in instant messaging application
KR101528367B1 (en) Sound control system and method as the same
CN111510755A (en) Audio and video switching method and device, computer equipment and readable storage medium
JP2021028819A (en) Smart service method, apparatus, and device
CN112286904A (en) Cluster migration method and device and storage medium
CN111445331A (en) Transaction matching method and device
CN112953908A (en) Network isolation configuration method, device and system
CN111949614A (en) Bank system file conversion method and device
CN110908739B (en) Method, device and equipment for realizing data docking with third-party Launcher
CN110442416B (en) Method, electronic device and computer-readable medium for presenting information
CN112328413A (en) Application service calling method, device and system
CN111338905A (en) Application node data processing method and device
CN104125478A (en) Cross-platform video playing method, device and system
CN104978398A (en) Method for music playing and terminal device
CN111147359B (en) Message conversion method, device and storage medium suitable for multiple channels
CN102857407B (en) Multimedia information service mms processing method and mobile terminal
CN110795388B (en) Binary file processing method, system, equipment and readable storage medium
CN108650544B (en) Media playing method, device and system
CN115033139B (en) Method and related device for starting application program interface
CN102077190A (en) Media foundation source reader
CN113950043A (en) Communication method, communication apparatus, storage medium, and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220425

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address before: 2005, floor 2, No. 39, West Street, Haidian District, Beijing 100082

Applicant before: Beijing jingling Information System Technology Co.,Ltd.