WO2022233237A1 - Audio playing method and apparatus, and device - Google Patents

Audio playing method and apparatus, and device Download PDF

Info

Publication number
WO2022233237A1
WO2022233237A1 PCT/CN2022/088205 CN2022088205W WO2022233237A1 WO 2022233237 A1 WO2022233237 A1 WO 2022233237A1 CN 2022088205 W CN2022088205 W CN 2022088205W WO 2022233237 A1 WO2022233237 A1 WO 2022233237A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
management module
virtual
application
virtual display
Prior art date
Application number
PCT/CN2022/088205
Other languages
French (fr)
Chinese (zh)
Inventor
陈全全
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022233237A1 publication Critical patent/WO2022233237A1/en

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/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • 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
    • 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
    • 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/165Management of the audio stream, e.g. setting of volume, audio stream path
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72409User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72409User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories
    • H04M1/72412User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories using two-way short-range wireless interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/7243User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72442User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for playing music files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • H04N21/43632Adapting the video stream to a specific local network, e.g. a Bluetooth® network involving a wired protocol, e.g. IEEE 1394
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • H04N21/43637Adapting the video stream to a specific local network, e.g. a Bluetooth® network involving a wireless protocol, e.g. Bluetooth, RF or wireless LAN [IEEE 802.11]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams

Definitions

  • the present application relates to the field of media playback, and in particular, to an audio playback method, apparatus and device.
  • Android (Android) mobile phone terminals can realize the screen projection of the mobile phone to different terminals through a universal serial bus (universal serial bus, USB) cable or wireless fidelity (WiFi).
  • the mobile phone projects the audio/video content displayed on the mobile phone to other terminal devices through the USB DisplayPort (DP) interface, or realizes the mobile phone-to-tablet computer, personal computer (personal computer, personal computer) through Miracast or the multi-screen collaboration function of the manufacturer. PC), large-screen monitors and other devices to cast the screen.
  • USB universal serial bus
  • WiFi wireless fidelity
  • the screen projection business of Android terminals mostly adopts the Android Virtual Display technology, and the mobile terminal has the ability to build multiple virtual displays.
  • mobile terminals can be used as multi-device screen projection servers to implement one-to-many device projection services, and each device in different devices corresponds to a virtual display.
  • the mobile phone projects the screen to a display terminal through the USB DP interface, and the mobile phone also projects the screen to another terminal device, such as a smart screen, through the multi-screen collaboration function, so that user A can use the display terminal to work through the mobile phone, and at the same time
  • the mobile phone can also be projected to the smart screen to meet the entertainment needs of home user B.
  • the user holds a mobile phone, and the mobile phone is connected to a display screen with a speaker through a USB DP cable.
  • a laptop computer enters the office mode.
  • the mobile phone can also cast the screen to the smart screen to play video or voice calls.
  • the audio system is a competitive resource.
  • the application follows the Android audio focus calling mechanism. Before playing audio, you need to apply for the focus on the system side. Only the application that applies for the focus can play audio. , pauses playback once it loses focus. If the calling mechanism of the audio focus is followed, in the scenario shown in Figure 1, the sound of the mobile phone can only be sounded on one screen-casting device.
  • the system cannot provide simultaneous sound on audio playback APPs running on different displays, that is, the current Android audio system only supports sound playback on one screen-casting device at the same time, and only corresponds to one playback application. In many screencasting scenarios, users have different audio and video demands.
  • the present application provides an audio playback method, device, and device, which are used to solve the problem that audio multi-channel concurrent control input and output cannot be supported in the scenario of virtual display one-to-multi-channel screen projection. Specifically, the application discloses the following technical solutions:
  • the present application provides an audio playback method, which can be applied to a first management module.
  • the method includes: when a terminal device starts a screencasting service, the first management module receives the first information sent by the screencasting service module. a request, the first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user wishes to screen; the first management module sends the first device to the hardware abstraction layer HAL a request, receiving the device identifier of the first virtual audio device sent by the HAL, the first virtual audio device is created according to the relevant information of the first device; the first management module sends the screen casting service module The device identifier of the first virtual audio device, so that the screen projection service module establishes a binding relationship between the virtual display screen display and the first virtual audio device.
  • the first management module is a module in the application framework layer, such as a multi-screen audio management module, or a vendor audio expansion module.
  • the method provided in this aspect enhances the audio input and output capability of the existing screen projection scene.
  • the first management module establishes a virtual display for each device requesting screen projection, configures an independent virtual audio input and output device based on the virtual display, and establishes a virtual display and a virtual display.
  • the binding relationship between audio devices enables the audio stream to follow the input and output of the audio device on the screen-casting end when the virtual display runs the application.
  • the display audio of each screen-casting device is independent of each other and does not interfere with each other.
  • each screencasting device runs the application to play the sound, and makes a sound on the current screencasting device.
  • the recording of each screencasting device running the application can be recorded by using the recording function of the current screencasting device, so as to realize the simultaneous sound and sound of the multitasking audio device. pickup.
  • the method further includes: the first management module receives a first binding relationship sent by the screen projection service module, where the first binding relationship includes The correspondence between the first virtual display screen display and the device identifier of the first virtual audio device; when the first application requests to play an audio stream, the first management module determines the first virtual display; according to the first The virtual display searches for the device identification of the first virtual audio device in the first binding relationship; sends the device identification of the first virtual audio device to the native audio framework, so that the native audio framework passes the corresponding audio stream through The first virtual audio device is output to the first device.
  • the first binding relationship between the first virtual display screen display and the device identifier of the first virtual audio device is obtained in advance, so that when the first virtual display is obtained, the first binding relationship can be found according to the first binding relationship.
  • the device identifier of the corresponding first virtual audio device so as to transmit the audio stream to the first device through the first virtual audio device, so as to realize the playback of the audio stream on the first device.
  • determining the first virtual display by the first management module includes: the first management module acquires the identifier of the first application, and sends the identifier to the second management module The identifier of the first application; the first management module receives the first virtual display determined by the second management module according to the identifier of the first application.
  • the method further includes: the first management module determines the first virtual display according to the first virtual display. an audio focus, the first audio focus corresponds to the first virtual display; the first management module queries whether the state of the first audio focus is available; if so, sends the information to the native audio framework the first audio focus.
  • This mode implements the distribution of audio focus, and is used to provide audio focus for the device requesting to play the audio stream.
  • the method further includes: if the state of the first audio focus is unavailable for querying, determining that the application occupying the first audio focus is the second application ; the first management module sends first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be occupied by the first application; when receiving When the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that the first application acquires the first audio focus.
  • a corresponding first audio focus is allocated to the second application according to the virtual display audio focus mechanism, so as to optimize the audio focus preemption mechanism of applications running on different virtual displays, and support based on the virtual display audio focus mechanism. Multitasking audio concurrency control for virtual displays.
  • the method further includes: acquiring, by the first management module, the first The first focus management record associated with the virtual display, the first focus management record includes the state of the first audio focus, wherein the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the the first audio focus.
  • the first management module inquiring whether the state of the first audio focus is available includes: the first management module inquiring, in the first focus management record, whether the state of the first audio focus is idle.
  • the method further includes: the first management module maintains the first focus management record according to a virtual display audio focus mechanism; the virtual display audio focus mechanism Including: when there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, the application of the high-priority service preempts the application of the low-priority service, and, equal Priority business applications follow the rules of applying for applications later and preempting applications first.
  • the state of each audio focus is managed and recorded by the first management module, so that when a terminal device applies for a focus, the focus can be allocated to different terminal devices, thereby realizing the rational allocation and use of the audio focus and improving the audio frequency. Focus on resource distribution efficiency.
  • the present application also provides an audio playback method, the method is applied to the second management module, and the method includes:
  • the second management module receives a second request sent by the screen projection service module, where the second request is used to create a virtual display for screen projection, wherein the second request includes: specifying the name, size and resolution information of the virtual display;
  • the second management module creates a first virtual display according to the specified virtual display name, size and resolution information; the second management module sends the first virtual display to the screen projection service module, so that the virtual display
  • the screen projection service module establishes a first binding relationship between the first virtual display and the first virtual audio device.
  • the second management module is a module in the application framework layer, such as a multi-screen management module.
  • the method further includes: the second management module receives the first binding relationship sent by the screen projection service module; the second management module Send the first binding relationship to the first management module.
  • the method further includes: when the first application requests to play an audio stream, the second management module acquires the identifier of the first application; the second management module The module searches for the first virtual display to which the first application belongs according to the identifier of the first application; the second management module sends the first virtual display to the first management module.
  • the second management module acquiring the identifier of the first application includes: the second management module requests the first application to apply for audio focus When the audio focus request is sent by the first management module, the audio focus request includes the identifier of the first application.
  • the second management module acquiring the identifier of the first application includes: the second management module acquiring the first application in the native audio framework When playing the audio stream, the identifier of the first application sent by the first management module is received.
  • the present application further provides an audio playback method, which can be applied to a screencasting service module, the method comprising: when the screencasting service module acquires an operation of a user initiating a screencasting service, acquiring the first file created by the second management module.
  • a virtual display screen display the screen projection service module sends a first request to the first management module after establishing a virtual audio link with the first device that expects screen projection, and the first request is used to request the creation of a virtual display Audio equipment, the first request includes the relevant information of the first equipment that the user wishes to screen;
  • the screen casting service module receives the device identification of the first virtual audio equipment sent by the first management module; establishes a first binding
  • the first binding relationship includes the corresponding relationship between the device identifiers of the first virtual display and the first virtual audio device; the screen projection service module sends the first management module the The first binding relationship.
  • the screen projection service module establishes a binding relationship between the first virtual display screen display and the first virtual audio device according to the received device identifiers, so as to provide subsequent selection of virtual audio devices and distribution of audio streams.
  • the audio stream follows the input and output of the audio device on the screen-casting end, so that in the one-to-many screen-casting scenario, the audio displayed by each screen-casting device is independent of each other and does not interfere with each other.
  • the screen projection service module may be a functional module located at the application layer.
  • the screencasting service APP or the screencasting service APK package.
  • the acquiring the first virtual display screen display created by the second management module includes: the screen projection service module sends a message to the second management module A second request, where the second request is used to request the second management module to create a virtual display; the screen projection service module receives the first virtual display created by the second management module according to the second request.
  • the method further includes: when the user's operation of disconnecting the screen-casting service is obtained, releasing the first virtual display and the first virtual audio device.
  • the first binding relationship between device identifiers; the screen projection service module sends a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relation.
  • the present application further provides a management device, which can be applied to a first management module
  • the first management module includes: a first receiving unit, configured to receive a screen projection when a terminal device starts a screen projection service
  • the first request sent by the service module, the first request is used to request the creation of a virtual audio device, and the first request includes the relevant information of the first device that the user expects to screen
  • the first sending unit is used to abstract from the hardware
  • the layer HAL sends the first request
  • the first receiving unit is further configured to receive the device identifier of the first virtual audio device sent by the HAL, and the first virtual audio device is based on the relevant information of the first device.
  • Create the first sending unit is further configured to send the device identification of the first virtual audio device to the screen projection service module, so that the virtual screen projection service module establishes a virtual display screen display and the first Binding relationship between virtual audio devices.
  • the first receiving unit is further configured to receive a first binding relationship sent by the screen projection service module, the first binding relationship including the correspondence between the first virtual display screen display and the device identifier of the first virtual audio device; the first processing unit is used to determine the first virtual display when the first application requests to play the audio stream, according to the first processing unit A virtual display searches for the device identifier of the first virtual audio device in the first binding relationship; the first sending unit is further configured to send the device identifier of the first virtual audio device to the native audio framework, so that the The native audio framework outputs the corresponding audio stream to the first device through the first virtual audio device.
  • the first receiving unit is further configured to acquire the identifier of the first application; the first sending unit is further configured to send the second management The module sends the identifier of the first application; the first receiving unit is further configured to receive the first virtual display determined by the second management module according to the identifier of the first application.
  • the first processing unit is further configured to determine a first audio focus according to the first virtual display, where the first audio focus is related to the Corresponding to the first virtual display, query whether the state of the first audio focus is available; the first sending unit is further configured to, when the first processing unit queries the availability of the first audio focus, to the The native audio framework sends the first audio focus.
  • the first processing unit is further configured to determine that the first audio focus is occupied when the state of the first audio focus is inquired to be unavailable
  • the application in question is the second application
  • the first sending unit is further configured to send first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be being occupied by the first application
  • the first receiving unit receives an indication that the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that the first application acquires the first audio focus.
  • the method further includes: the first processing unit, further using obtaining the first focus management record associated with the first virtual Display, and querying the first focus management record whether the state of the first audio focus is idle.
  • the first focus management record includes the state of the first audio focus, the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
  • the first processing unit is further configured to maintain the first focus management record according to a virtual display audio focus mechanism; the virtual display audio focus The mechanism includes: when there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, the application of the high-priority service preempts the application of the low-priority service, and, Business applications with the same priority follow the rules of applying for applications later and preempting applications first.
  • the present application further provides another management device, which can be applied to a second management module
  • the second management module includes: a second receiving unit configured to receive a second request sent by the screen projection service module, the The second request is used to create a screen-casting virtual display, wherein the second request includes: specifying the name, size, and resolution information of the virtual display; and a second processing unit, configured to specify the name, size, and resolution of the virtual display according to the specified rate information to create a first virtual display; a second sending unit, configured to send the first virtual display to the screen-casting service module, so that the virtual screen-casting service module establishes the first virtual display and the first virtual display The first binding relationship between audio devices.
  • the second receiving unit is further configured to receive the first binding relationship sent by the screen projection service module; the second sending The unit is further configured to send the first binding relationship to the first management module.
  • the second receiving unit is further configured to, when the first application requests to play an audio stream, the second management module to obtain the first application's identifier; the second processing unit is further configured to search for the first virtual display to which the first application belongs according to the identifier of the first application; the second sending unit is further configured to send the information to the first management module Describe the first virtual display.
  • the second receiving unit is further configured to receive the data sent by the first management module when the first application requests to apply for audio focus An audio focus request, where the audio focus request includes the identifier of the first application.
  • the second receiving unit is further configured to receive the first audio stream when the native audio framework acquires the audio stream played by the first application The identifier of the first application sent by the management module.
  • the present application further provides an application device, the application device can be a screen projection service module, and the screen projection service module includes: a third receiving unit for acquiring the operation of the user to start the screen projection service , obtains the first virtual display screen display created by the second management module; the third sending unit is configured to send a first request to the first management module after establishing a virtual audio link with the first device that expects screen projection, The first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user expects to screen; the third receiving unit is further configured to receive a message sent by the first management module The device identifier of the first virtual audio device; the third processing unit is used for the screen projection service module to establish a first binding relationship, and the first binding relationship includes the first virtual display and the first virtual Correspondence between device identifiers of audio devices; the third sending unit is further configured to send the first binding relationship to the first management module.
  • the application device can be a screen projection service module
  • the screen projection service module includes: a
  • the third sending unit is further configured to send a second request to the second management module, where the second request is used to request the The second management module creates a virtual display; the third receiving unit is further configured to receive the first virtual display created by the second management module according to the second request.
  • the third processing unit is further configured to release the first virtual display and all the the first binding relationship between the device identifiers of the first virtual audio device; the third receiving unit is further configured to send a first message to the first management module, where the first message is used to notify the The first management module deletes the first binding relationship.
  • the present application further provides a terminal device, comprising: at least one processor and a memory, wherein the memory is used to store computer program instructions and/or data; the at least one processor is used to execute the The above-mentioned instructions are used to implement the methods in the various implementation manners of the first aspect to the third aspect.
  • the terminal device further includes an interface circuit, where the interface circuit is configured to acquire computer program instructions and/or data in the memory.
  • the at least one processor, the memory and the interface circuit may be integrated into one processing chip or chip circuit.
  • the apparatus is a terminal device, and the terminal device includes but is not limited to a mobile phone, a PC, and a tablet computer.
  • the present application further provides an audio playback system, the system includes a source device and at least one screen projection device, wherein the source device is the terminal device of the aforementioned seventh aspect, which is used to implement the aforementioned first aspect Methods in various implementations to the third aspect.
  • the at least one screen projection device may also be the terminal device in the foregoing seventh aspect.
  • system may further include other devices, such as cloud servers, network devices, and the like.
  • devices such as cloud servers, network devices, and the like.
  • the present application also provides a computer-readable storage medium, where instructions are stored in the storage medium, so that when the instructions are executed on a computer or a processor, they can be used to execute the foregoing first aspect and each of the first aspects.
  • the method in one implementation manner, and the aforementioned second aspect and the method in various implementation manners of the second aspect, and the foregoing third aspect and the method in various implementation manners of the third aspect.
  • the present application also provides a computer program product, the computer program product includes computer instructions, when the instructions are executed by a computer or a processor, the aforementioned first aspect and the method in various implementation manners of the first aspect can be implemented, And, the aforementioned second aspect and methods in various implementations of the second aspect, and the aforementioned third aspect and methods in various implementations of the third aspect.
  • beneficial effects corresponding to the technical solutions of the various implementation manners of the second aspect to the ninth aspect are the same as the beneficial effects of the foregoing first aspect and various implementation manners of the first aspect.
  • beneficial effects please refer to the foregoing first aspect. Aspects and descriptions of beneficial effects in various implementation manners of the first aspect will not be repeated.
  • Fig. 1 is a scene schematic diagram of a mobile phone terminal screen projection provided by the present application
  • FIG. 2 is a schematic diagram of a scenario of a mobile phone terminal screen projection service provided by an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a software structure of a terminal device according to an embodiment of the present application.
  • FIG. 5 is a flowchart of an audio playback method provided by an embodiment of the present application.
  • FIG. 6 is a flowchart of another audio playback method provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a source device projecting a screen to two screen projection devices according to an embodiment of the present application.
  • FIG. 8 is a signaling flowchart of an audio playback method provided by an embodiment of the present application.
  • FIG. 9 is a signaling diagram for starting a screen projection process according to an embodiment of the present application.
  • FIG. 10 is a signaling diagram of a process of disconnecting screen projection provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of requesting audio focus according to an embodiment of the present application.
  • FIG. 12 is a signaling flow chart of an application acquiring audio focus according to an embodiment of the present application.
  • FIG. 13 is a signaling flowchart of an audio focus preemption mechanism provided by an embodiment of the present application.
  • 14a is a schematic diagram of an audio stream distribution provided by an embodiment of the present application.
  • FIG. 14b is a signaling flow chart of playing an audio stream provided by an embodiment of the application.
  • FIG. 15 is a schematic structural diagram of a management apparatus provided by an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of another management apparatus provided by an embodiment of the present application.
  • FIG. 17 is a schematic structural diagram of an application device provided by an embodiment of the present application.
  • FIG. 18 is a schematic structural diagram of a chip system provided by an embodiment of the present application.
  • the technical solution of the present application can be applied to the one-to-many screen projection business scenario of mobile phone devices.
  • the virtualized technology is used to construct distributed audio, so as to realize multi-terminal screen projection display and independent audio input and output, and support audio Simultaneous vocalization and pickup.
  • the mobile phone projects the screen to the smart screen, tablet and display screen through the Android Virtual Display (Android Virtual Display) technology.
  • Android Virtual Display Each device sets up virtual displays, and assigns independent virtual audio devices to each virtual display.
  • the virtual audio devices include speakers, microphones (MIC), and other input devices, etc., as well as multi-screen audio concurrent Management control, so that users can get an independent audio and video experience when using the screen projection display, so that the audio and video of each display are independent of each other and do not interfere with each other.
  • the mobile phone may also be other terminal equipment, and the terminal equipment may be a portable device, such as a smart phone, a tablet computer, a notebook computer, a personal computer (PC), a foldable terminal, a wireless communication function Wearable devices (such as smart watches or bracelets), user devices (user devices) or user equipment (UE), and augmented reality (AR) or virtual reality (VR) devices, headsets, etc. .
  • the device to which the screen is projected may also be any one or more of the above-mentioned terminal devices, and the specific device form of the terminal device is not limited in this embodiment.
  • the above-mentioned various terminal devices are equipped with an Android (Android) operating system and/or an Android-compatible system.
  • Android Android
  • the device that projects the screen is called the source device, and the device that the user desires to project the screen is called the device that projects the screen.
  • the source device is a mobile phone terminal
  • the screen projection device includes any terminal device such as a smart screen, a tablet, and a display screen.
  • the above application scenarios may also include cloud side or cloud network devices, such as cloud servers, data centers, etc., and the source device and the screen projection device are connected through a wireless network, such as a wireless local area network (Wireless Local Area Networks, WLAN). ) or WiFi, etc.
  • a wireless network such as a wireless local area network (Wireless Local Area Networks, WLAN). ) or WiFi, etc.
  • the above-mentioned terminal device may include the following structure, as shown in FIG. 3 , which is a schematic structural diagram of a terminal device provided in this embodiment.
  • the terminal device may include a processor 110 and a memory 120, and further include: a USB interface 130, a power management module 140, a battery 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, and a speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 191, indicator 192, camera 193, display screen 194, and subscriber identification module (Subscriber Identification Module, SIM) card interface 195 and the like.
  • SIM Subscriber Identification Module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an acceleration sensor 180C, a gravity sensor 180D, and a touch sensor 180E.
  • the sensor module 180 may also include a fingerprint sensor, a temperature sensor, an ambient light sensor, and the like.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the communication device.
  • the communication device may include more or less components than shown, or some components are combined, or some components are separated, or different components are arranged.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • baseband processor baseband processor
  • neural-network processing unit neural-network processing unit
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be directly called from the memory, which avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or USB interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the communication device, and can also be used to transmit data between the communication device and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the power management module 140 is used for connecting the battery 141 and the processor 110 .
  • the power management module 140 supplies power to the processor 110 , the memory 120 , the display screen 194 , the camera 193 , the wireless communication module 160 and the like.
  • the power management module 140 may be provided in the processor 110 .
  • the wireless communication function of the terminal device may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the communication device may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G etc. applied on the communication device.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • LNA low noise amplifier
  • the wireless communication module 160 can provide applications on communication devices including WLAN (such as WiFi network), Bluetooth (bluetooth), global navigation satellite system (GNSS), frequency modulation (frequency modulation, FM), short-range wireless communication Technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal device can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • CDMA code division multiple access
  • WCDMA broadband Code Division Multiple Access
  • TD-SCDMA Time Division Code Division Multiple Access
  • LTE Long Term Evolution
  • BT Long Term Evolution
  • GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), and a Beidou navigation satellite system (BDS).
  • the display screen 194 is used to display conversation windows, display interfaces, images, and the like.
  • the terminal device may include 1 or N display screens, where N is a positive integer greater than 1.
  • Memory 120 may be used to store computer-executable program code, which includes instructions.
  • data/information generated by the terminal device or interacted with other devices can also be stored.
  • the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the processor 110 executes various functional applications and data processing of the terminal device by executing the instructions stored in the internal memory 120 and/or the instructions stored in the memory provided in the processor.
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the gyroscope sensor 180B can be used to determine the motion attitude of the terminal device, such as measuring the rotation angle of the terminal device.
  • the acceleration sensor 180C can detect the magnitude of the acceleration of the terminal device in various directions (generally three axes).
  • the acceleration sensor 180C further includes a linear acceleration sensor for obtaining the linear acceleration of the terminal device.
  • the gravity sensor 180D is used to measure the acceleration components of the terminal device in the x-axis, y-axis and z-axis directions.
  • the touch sensor 180E is also called "touch device".
  • the touch sensor 180E may be disposed on the display screen 194 , and the touch sensor 180E and the display screen 194 form a touch screen, also referred to as a "touch screen".
  • the touch sensor 180E is used to detect a touch operation on or near it, such as a double-tap operation.
  • the keys 191 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the communication device.
  • the structure of the above-mentioned cloud side or cloud network device may be the same as or different from that of the terminal device, which is not limited in this embodiment.
  • this embodiment also provides a software structure of a terminal device.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system in the software structure of the terminal device is an application layer (APP), an application framework layer and a hardware abstraction layer (HAL) from top to bottom, and in addition , Android runtime (Android Runtime) and system library (not shown in FIG. 4 ) are also included between the program framework layer and the HAL layer.
  • APP application layer
  • HAL hardware abstraction layer
  • Android runtime Android Runtime
  • system library not shown in FIG. 4
  • the application layer may include a series of application packages, such as APP1, APP2, . . .
  • This embodiment includes a screen projection service APP, and the screen projection service APP is used to implement the screen projection function of different terminal devices.
  • the application framework layer is referred to as a "framework layer (Framework)" for short.
  • the framework layer provides an application programming interface (Application Programming Interface, API) and a programming framework for applications in the application layer.
  • API Application Programming Interface
  • the framework layer includes some predefined functions.
  • the framework layer includes: Android open source platform (Android open source platform, AOSP) native audio framework, multi-screen management (Multi-screen management) module and vendor (Vendor) audio extension function module.
  • Android open source platform Android open source platform, AOSP
  • Multi-screen management Multi-screen management
  • vendor Vendor audio extension function module
  • the Vendor audio extension function module is a newly added function module.
  • the multi-screen management module for the main screen and the virtual screen management module, maintains and manages the display information used by the screen projection business.
  • the multi-screen management module is also associated with the audio framework to realize functions such as creation and destruction of virtual display screens (Display) and configuration management of virtual audio devices.
  • Audio framework including AOSP native audio framework and Vendor audio extension function, wherein the Vendor audio extension function is a new function module, used to extend audio policy (AudoPolicy), media focus control (MediaFocusControl) and audio scheduling service (AudioFlinger) modules function to establish audio focus management and audio streaming channel policy control centered on virtual Display.
  • VendoPolicy Audio policy
  • MediaFocusControl media focus control
  • Audio scheduling service Audio scheduling service
  • the functions of the Vendor audio extension include at least the following new functions:
  • AudioPolicyImp which is used to implement virtual audio device policy control based on virtual Display
  • AudioFlingerImpl used to realize the audio stream path control based on virtual Display
  • Multi-screen audio management module responsible for virtual Display docking virtual audio equipment management, the virtual audio equipment includes virtual Speaker equipment and virtual Mic equipment, is also used to establish the mapping relationship between the virtual Display and the audio equipment HAL, provides based on Virtual Display focus management.
  • a window manager may also be included in the framework layer, such as a window manager, a content provider, a view system, a telephony manager, a notification manager, and the like.
  • the Android Runtime includes a core library and a virtual machine.
  • Android Runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the system library may include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files and the like.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the hardware abstraction layer HAL is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on a variety of platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, which makes it possible to perform parallel testing of software and hardware.
  • the HAL includes a USB/DP Audio HAL, a primary audio (Primary Audio) HAL, and a virtual audio (Virtual Audio) HAL.
  • the Virtual Audio HAL is a newly added functional module, and the Virtual Audio HAL can be used for docking with distributed virtual audio devices, and for docking with remote screen projection audio input and output devices.
  • the functions of each HAL module are shown in Table 2.
  • the embodiment of the present application provides an audio stream playback method, which is used to realize the screen projection display of multi-terminal devices, and the simultaneous sounding and pickup of audio in the scenario of a one-to-multiple screen projection service of a mobile phone device.
  • an audio playback method provided by this embodiment includes:
  • the first management module receives a first request sent by the screencasting service module, where the first request is used to request the creation of a virtual audio device, and the first request includes the user's desired screencasting related information of the first device, such as the identifier of the first device, the device name of the first device, and the like.
  • the first management module is a multi-screen audio management module, located in the framework layer, or a new function module in the Vendor audio extension function.
  • the first management module sends the first request to the hardware abstraction layer HAL.
  • the first management module receives the device identifier of the first virtual audio device sent by the HAL, where the first virtual audio device is created according to the related information of the first device.
  • the first management module sends the device identification of the first virtual audio device to the screen projection service module, so that the screen projection service module establishes a connection between the virtual display screen display and the first virtual audio device. binding relationship.
  • the screen projection service module receives the device identifier of the first virtual audio device, and then establishes a first binding relationship according to the acquired first virtual display, where the first binding relationship is the first virtual audio device The corresponding relationship between the device identifier and the first virtual display.
  • the first virtual display is Virtual display0
  • the device identifier of the first virtual audio device is Virtual Audio 0
  • the first binding relationship is established as ⁇ Virtual display0, Virtual Audio 0>.
  • the first management module receives the device identifiers requesting multiple virtual audio devices from the HAL, and establishes multiple binding relationships, each of which includes a virtual audio device. The correspondence between display and a virtual audio device.
  • the first management module receives the first binding relationship sent by the screen projection service module.
  • the first management module determines the first virtual display.
  • the first application has a music playback function, such as APP.
  • the first management module acquires the identifier of the first application, such as the package name, pid, etc. of the first application, and then sends the identifier of the first application to the second management module.
  • the second management module searches for the first virtual display to which the first application belongs according to the identifier of the first application, and sends the first virtual display to the first management module.
  • the first management module receives the first virtual display determined by the second management module according to the identifier of the first application.
  • step 106 the method further includes:
  • the first management module determines a first audio focus according to the first virtual display, and the first audio focus corresponds to the first virtual display; inquires whether the state of the first audio focus is available; if so, The first audio focus is then sent to the native audio framework.
  • the first management module sends first indication information to the native audio framework, and the first An indication message is used to notify the native audio framework that the first audio focus needs to be occupied by the first application; when receiving an indication that the second application stops using the first audio focus, send a notification to the native audio framework.
  • the audio framework sends the first audio focus so that the first application acquires the first audio focus.
  • the method further includes: acquiring, by the first management module, a first focus management record associated with the first virtual display, the first focus
  • the management record includes the state of the first audio focus, wherein the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
  • the first management module inquiring whether the state of the first audio focus is available includes: the first management module inquiring, in the first focus management record, whether the state of the first audio focus is idle.
  • the first management module searches for the device identifier of the first virtual audio device in the first binding relationship according to the first virtual display.
  • the first management module sends the device identifier of the first virtual audio device to the native audio framework, so that the native audio framework outputs the corresponding audio stream to the first device through the first virtual audio device.
  • the above method further includes: the first management module maintains the first focus management record according to the virtual display audio focus mechanism;
  • the virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority according to the high priority service application Business applications, and business applications with the same priority follow the rule of applying for applications first and preempting applications later.
  • each virtual display has an independent audio focus, and the audio focuses corresponding to different virtual displays are independent of each other and interfere with each other.
  • the method provided by this embodiment enhances the audio input and output capability of the existing screen projection scene.
  • the first management module establishes a virtual display for each device requesting screen projection, configures an independent virtual audio input and output device based on the virtual display, and establishes the virtual display and the virtual display.
  • the binding relationship between the virtual audio devices enables the audio stream to follow the input and output of the audio device on the screen-casting end when the virtual display runs the application.
  • the display audio of each screen-casting device is independent of each other and does not interfere with each other. .
  • each screencasting device runs the application to play the sound, and makes a sound on the current screencasting device.
  • the recording of each screencasting device running the application can be recorded by using the recording function of the current screencasting device, so as to realize the simultaneous sound and sound of the multitasking audio device. pickup.
  • this embodiment also provides another audio playback method, which can be applied to a second management module, where the second management module is a multi-screen management module.
  • the method includes:
  • the second management module receives a second request sent by the screen projection service module, where the second request is used to create a virtual display for screen projection, wherein the second request includes: specifying the name, size and resolution information of the virtual display;
  • the second management module creates a first virtual display according to the specified virtual display name, size and resolution information; and sends the first virtual display to the screen projection service module, so that the virtual screen projection service module A first binding relationship between the first virtual display and the first virtual audio device is established.
  • the above method further includes: the second management module receives the first binding relationship sent by the screen projection service module, and sends the first binding relationship to the first management module.
  • acquiring the identifier of the first application by the second management module includes: the second management module receives the first management module when the first application requests to apply for audio focus The audio focus request sent by the module includes the identifier of the first application.
  • This embodiment builds an audio focus control mechanism centered on a virtual display, assigns a focus to each virtual display, performs audio focus preemption management based on the virtual display where the application is located, and supports coexistence of audio focus and concurrent management of audio playback for different virtual display applications.
  • the second management module acquiring the identifier of the first application includes: when the second management module acquires the audio stream played by the first application when the native audio framework acquires , receiving the identifier of the first application sent by the first management module.
  • the audio playback method provided by this embodiment includes:
  • the screen projection service module acquires the first virtual display screen display created by the second management module when acquiring the user's operation of starting the screen projection service; the screen projection service module establishes a virtual audio link with the first device that expects screen projection After the route is completed, a first request is sent to the first management module, where the first request is used to request the creation of a virtual audio device, and the first request includes relevant information of the first device on which the user wishes to project the screen.
  • the screen projection service module receives the device identifier of the first virtual audio device sent by the first management module; the screen projection service module establishes a first binding relationship, and the first binding relationship includes the first virtual audio device. display the corresponding relationship between the device identifier of the first virtual audio device; and send the first binding relationship to the first management module.
  • the acquiring the first virtual display screen display created by the second management module includes: the screen projection service module sends a second request to the second management module, where the second request is used to request the second
  • the management module creates a virtual display; the screen projection service module receives the first virtual display created by the second management module according to the second request.
  • the method further includes: when the user's operation of disconnecting the screen-casting service is obtained, releasing the first binding relationship between the device identifiers of the first virtual display and the first virtual audio device;
  • the screen projection service module sends a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship.
  • the first virtual audio device is deleted through the first management module, and the first virtual audio device is deleted through the HAL.
  • the audio playback system includes one source device and two screen projection devices, wherein the source device is a mobile phone 100 , and the screen projection device includes a first device and a second device.
  • the first device is the smart screen 200 and the second device is the tablet 300.
  • the following takes the mobile phone 100 and the smart screen 200 as examples to introduce the screen casting process from the source device to the screen casting device, and the establishment of the screen casting connection.
  • the method flow of the post audio stream is transmitted from the mobile phone 100 to the smart screen 200 .
  • the method includes the following three parts of the process.
  • start the screen projection process which is a preparation stage before playing audio, including steps S1 to S4, the main purpose is to establish virtual display and virtual display. A one-to-one binding relationship between audio devices.
  • the second part of the process is: application and preemption of audio focus. Including steps S5 to S6, because before the source device plays the audio stream, it needs to obtain an audio focus, and each virtual display can provide an audio focus. When two or more applications apply for the audio focus of the same virtual display When the audio focus is preempted, the audio focus can be provided for the requested application by following the virtual display audio focus mechanism.
  • the third part of the process is: according to the streaming strategy, the audio stream is transmitted to the virtual audio device corresponding to the application, so as to realize the audio transmission and playback from the source device to the screen projection device, which mainly includes steps S7 and S8.
  • the three parts of the process may be executed in sequence, or the first part of the process and the second part of the process may be executed simultaneously, which is not limited in this embodiment.
  • the involved functional modules include: the screen projection service module 10 of the mobile phone 100 , the first management module 21 , the second management module 22 and the virtual audio HAL 30 .
  • the screen projection service module 10 is located in the application layer
  • the first management module 21 is located in the native audio framework 20
  • the second management module is located in the multi-screen management module
  • the native audio framework 20 and the multi-screen management module are located in the framework layer.
  • the virtual audio HAL 30 is located at the hardware layer.
  • the screen projection service module 10 is an Android application package (Android application package, APK).
  • Android application package Android application package, APK
  • other applications such as the first application 11 and the second application 12 may also be included, and the first application 11 and the second application 12 have an audio playback function.
  • the screen projection service module 10 may also be located in the framework layer, is associated with the screen projection service application of the application layer, and is used for executing the relevant process of the screen projection service application.
  • the first management module 21 is a multi-screen audio management module
  • the second management module 22 is a multi-screen management module.
  • the user starts the screencasting through the corresponding portal of the screencasting.
  • the user clicks on the screen casting service application on the mobile phone 100 to start the screen casting operation on the first device, where the first device is the smart screen 200 .
  • S2 Establish a first communication link between the terminal device and the first device.
  • the first communication link may be established between the terminal device and the first device by means of USB or WiFi.
  • the mobile phone 100 After receiving the user's operation of starting the screen projection service, the mobile phone 100 establishes a first communication link with the smart screen 200 .
  • a first communication link is,
  • the screen projection service module 10 sends a first message to the smart screen 200, where the first message is used to establish a first communication link with the mobile phone 100. Specifically, the screen projection service module 10 sends the first message to the smart screen 200 through radio resource control (Radio Resource Control, RRC) signaling.
  • the first message includes information such as the identification of the mobile phone 100, the name of the mobile phone device, and the connection request.
  • the first response message includes: mobile phone 100 identification, mobile phone device name, related capabilities of the smart screen 200 (size, resolution, support for video coding), audio related capabilities, such as whether to support Speaker or Mic capabilities, support sampling rate, bit width, etc., and related connection authentication information.
  • the first response message is an RRC message.
  • the smart screen 200 sends the RRC message to the application layer of the mobile phone 100 .
  • the application layer of the mobile phone 100 receives the first response message, determines that the terminal device sending the first response message is the smart screen 200 , and establishes the first response message with the smart screen 200 . communication link.
  • the screen projection service module 10 selects to connect to the smart screen 200 by means of USB or WiFi according to the scenario, and establishes the first communication link.
  • S3 A virtual audio device link is established between the mobile phone 100 and the first device.
  • the mobile phone 100 establishes a first binding relationship between the first virtual display and the device identifier of the first virtual audio device.
  • step S2 the method includes:
  • the screen projection service module 10 requests the second management module 22 to create a screen projection virtual display.
  • the screen projection service module 10 of the mobile phone 100 sends a second request to the second management module 22, and the second request is used for creating and casting The virtual display associated with the screen.
  • the second request includes: virtual display name, size, and resolution information.
  • One embodiment includes: the screen-casting service module 10 calls the interface of the second management module 22, and sends the virtual display name, size and resolution information, creates a virtual display associated with screencasting, and uses the virtual display as the screencasting display source. .
  • the second management module 22 receives the second request, and creates a first virtual display, such as virtual display 0, according to the information carried in the second request. And, the first virtual display is sent to the screen projection service module 10 .
  • the screen projection service module 10 receives the first virtual display sent by the second management module 22, and uses the first virtual display to create a second communication link with the smart screen 200.
  • the second communication link is a virtual audio device link.
  • an implementation manner includes: the screen projection service module 10 sends a request message to the smart screen 200 for requesting to establish a second communication link with the smart screen 200 .
  • the smart screen 200 After receiving the request message sent by the screen projection service module 10, the smart screen 200 sends a feedback result to the screen projection service module 10, where the feedback result indicates whether the second communication link is successfully created.
  • the feedback result includes: specified audio device type, device ID and audio channel access information.
  • the screen projection service module 10 receives the feedback result, and when the feedback result indicates that the creation is successful, the mobile phone 100 and the smart screen 200 establish the second communication link.
  • step S4 specifically includes:
  • the screen projection service module 10 After successfully establishing the second communication link with the smart screen 200, the screen projection service module 10 sends a first request to the first management module 21, where the first request is used to request the creation of a virtual audio device.
  • the first management module 21 receives the first request sent by the screen projection service module 10 .
  • the first request includes the specified audio device type, the device ID of the mobile phone 100, and audio channel access information, where the access information includes USB or WiFi.
  • S4-2 After receiving the first request, the first management module 21 sends the first request to the virtual audio HAL 30. Correspondingly, the virtual audio HAL 30 receives the first request forwarded by the first management module 21.
  • the virtual audio HAL 30 creates an associated virtual audio device (audio device) through the virtual audio device link between the mobile phone 100 and the smart screen 200, and determines the device identifier of the virtual audio device, such as determining the virtual audio device If the device is the first virtual audio device, the device identifier of the device identifier of the virtual audio device is the device identifier of the first virtual audio device, such as audio device 0.
  • the virtual audio HAL 30 creates an associated virtual audio device for the session link between the mobile phone 100 and the smart screen 200, and generates a virtual audio device identifier.
  • the virtual audio device object includes the virtual audio type, device ID and audio path access information Wait.
  • the virtual audio HAL 30 sends to the first management module 21 a device identifier for creating a virtual audio device (VirtualAudio), that is, the device identifier of the first virtual audio device.
  • a device identifier for creating a virtual audio device VirtualAudio
  • the first management module 21 After receiving the device identifier of the virtual audio device, the first management module 21 sends the device identifier of the virtual audio device to the screen projection service module 10.
  • the first management module 21 sends the device identifier of the virtual audio device through an instruction or a message.
  • the screen projection service module 10 receives the device identifier of the virtual audio device, and establishes a binding relationship between the device identifier of the virtual audio device (Virtual Audio) and the first virtual display. Wherein, the first virtual display is obtained from the aforementioned S2'.
  • the screen projection service module 10 binds the first virtual display with the device identifier of the newly created virtual audio device, that is, configures a virtual audio device for the virtual display, and establishes a one-to-one binding between the virtual display and the virtual audio device established relationship.
  • Table 3 it is the first binding relationship between the established first virtual display screen (Virtual display 0) and the device identifier of the first virtual audio device (Virtual Audio 0).
  • the screen projection service module 10 sends the binding relationship to the second management module 22, and the second management module 22 sends the binding relationship to the first management module 21 after receiving the binding relationship.
  • the first management module 21 receives the binding relationship, and maintains and stores it.
  • the mobile phone 100 mirrors the smart screen 200
  • the mirroring service module 10 creates a virtual display for the smart screen 200
  • the mirroring service module 10 notifies the first management module of the binding relationship between the virtual display and the virtual audio device 21 , enabling the first management module 21 to maintain the binding relationship between the virtual display and the virtual audio device, so as to provide a basis for subsequent multi-screen audio focus management and selection of audio devices corresponding to audio streams.
  • this embodiment also provides a method for disconnecting the screencasting connection.
  • the screencasting service module needs to release the binding between the virtual display and the created virtual audio device. relationship, as shown in Figure 10, the specific process is as follows:
  • the user initiates and disconnects the screencasting service through the screencasting service application.
  • the user clicks the screen projection service interface on the mobile phone 100 to disconnect the screen projection connection with the smart screen 200 .
  • the screen projection service module 10 sends a first instruction to the multi-screen management module after receiving the user's disconnection of the screen projection operation, where the first instruction is used to request to disconnect the virtual display associated with the smart screen 200, and the first instruction includes: Including smart screen 200 identification information.
  • the multi-screen management module is the aforementioned multi-screen management module shown in FIG. 4 , or the second management module 22 shown in FIG. 7 , and the second management module 22 is used as an example in this embodiment.
  • the second management module 22 receives the first instruction, and searches for the corresponding virtual display according to the identification information of the smart screen 200 carried in the first instruction.
  • the virtual display found by the second management module 22 is the first virtual display.
  • the second management module 22 releases the first binding relationship after finding the first virtual display, where the first binding relationship is a corresponding relationship between the first virtual display and the device identifiers of the first virtual audio device.
  • the second management module 22 sends a second instruction to the first management module 21, where the second instruction includes: the display screen 200 corresponds to the virtual display identifier (ie the first virtual display), the smart screen 200 identifier and other information.
  • the first management module 21 receives the second instruction sent by the second management module 22 .
  • the first management module 21 searches the binding relationship record between the virtual display and the virtual audio device according to the virtual display identifier carried in the second instruction, and after finding the binding relationship record, the first management module 21 Clear the binding relationship in the binding relationship record.
  • the first management module 21 finds a first binding relationship according to the first virtual display, and then releases the device identification between the first virtual display and the first virtual audio device in the first binding relationship. Correspondence.
  • the screen projection service module 10 sends a third instruction to the first management module 21, where the third instruction is used to notify the first management module 21 to delete the virtual audio device corresponding to the smart screen 200.
  • the third instruction includes information such as the identification information of the smart screen 200, the device identification of the first virtual audio device, and the like.
  • the first management module 21 After receiving the third instruction, the first management module 21 sends the third instruction to the virtual audio HAL 30 to notify the virtual audio HAL 30 to delete the first virtual audio device corresponding to the smart screen 200.
  • the virtual audio HAL 30 receives the third instruction, disconnects the relationship between the smart screen 200 and the first virtual audio equipment according to the information such as the device identification of the first virtual audio equipment carried in the third instruction, and Delete the information of the first virtual audio device.
  • the screen projection service module 10 disconnects the communication link with the smart screen 200.
  • the screen projection service module 10 sends a disconnection request to the smart screen 200 , where the disconnection request is used to disconnect the first communication link with the mobile phone 100 and the smart screen 200 . After receiving the disconnection request, the smart screen 200 disconnects the first communication link.
  • the above method further includes that the first management module 21 and the second management module 22 update the binding relationship shown in Table 3 above, and release the first virtual display.
  • This embodiment provides a method for disconnecting the screen projection connection.
  • the first management module and the second management module contact the virtual display and the virtual audio device. The binding relationship between them, thereby releasing the virtual display and providing convenience for the subsequent establishment of connections with other screen projection devices,
  • the multi-screen audio management module will internally maintain multiple virtual displays and virtual audios for multiple device scenarios of mobile phone screen projection.
  • the binding relationship between devices, and the audio playback function of applications of different virtual displays will be designed and developed based on the Android audio focus mechanism.
  • This embodiment provides an audio focus mechanism based on virtual display, which is unaware of the application, and the application APP does not need code modification.
  • the multi-screen audio management module also provides a focus management record for each virtual display on the basis of Table 3, which is used to record the current virtual display audio focus state (Audio Focus State), occupation Audio focus application (Owner) and apply for audio focus application stack (APP Stack).
  • the virtual display audio focus state includes two states: used (Used) and idle (Idle). Specifically, as shown in Table 4,
  • the status and occupants of the virtual audio focus are recorded in Table 4, which provides a basis for subsequent audio focus preemption and audio stream allocation.
  • the second part of the process is executed, and the second part of the process is: a virtual display-based audio focus preemption process.
  • the second part of the process is summarized as:
  • S5 The user starts the first application to play an audio operation, and the first application has an audio playing function, such as QQ Music.
  • the mobile terminal applies for the audio focus according to the user's operation, and acquires the first audio focus.
  • the first audio focus uniquely corresponds to the first virtual display.
  • This process provides a preemption mechanism for the application to play audio focus in the scenario where the mobile phone is connected to multiple devices.
  • This mechanism maintains a focus management record for each virtual display to record whether the current virtual display has audio focus that can be used by the application. , and the audio focus information currently applied by each application.
  • an application in the application layer applies to the AudioManager of the framework layer for audio focus
  • MediaFocusControl searches the multi-screen audio management module according to the virtual display that the application application belongs to, and determines whether the focus applied by the application running on the corresponding virtual display is available. , it returns to apply for the audio focus of the application; if it is unavailable, that is, the focus is used by other applications, it will preempt the audio focus of the application currently in use, return the audio focus available to the application application, and notify the preempted application of losing the audio focus.
  • the audio focus mechanism based on virtual display is as follows:
  • each virtual display has an independent audio focus, and the audio focuses owned by different virtual displays are independent of each other and do not interfere with each other.
  • the application applies for audio focus, and in the case of audio focus preemption, the process for the application to acquire audio focus is as follows:
  • Steps S5 to S6 are the process for the first application to apply for audio focus, which specifically includes:
  • S5 Receive an operation that the user starts the first application to play music.
  • the user opens a first application on the mobile phone 100 to play audio
  • the first application is a music playing APP
  • the first application corresponds to a virtual display identifier established in the foregoing first part of the process, such as virtual display 0.
  • An implementation manner is that the first application sends a request to the native audio framework 20 for requesting to apply for audio focus.
  • the request includes: Android audio focus request message, audio type, and the like.
  • the requested audio focus is used to play the audio stream for the first application.
  • the native audio framework 20 is an AOSP native audio framework.
  • the native audio framework 20 After receiving the request for applying for audio focus, the native audio framework 20 sends the request for applying for audio focus to the first management module 21, where the request includes: Android audio focus request message, audio type, and the first application
  • the relevant information of the first application, etc., the relevant information of the first application includes but is not limited to the process id (process id, pid), package name, etc. that the first application currently starts and runs.
  • the first management module 21 After receiving the request, the first management module 21 sends the request for applying for audio focus to the second management module 22, where the request is used to query the virtual display information where the first application is located, and the request includes the Relevant information of the first application, such as pid, package name of the first application, and the like.
  • the second management module 22 After receiving the request, the second management module 22 queries the virtual display identifier corresponding to the first application according to the relevant information of the first application in the request.
  • the first application is application A or APP1, according to the corresponding relationship shown in Table 5, it is determined that the virtual display identifier corresponding to application A is Virtual display 0.
  • Smart screen 200 Virtual display0 Virtual Audio 0 Idle idle
  • the second management module 22 sends the searched virtual display identifier to the first management module 21.
  • the second management module 22 carries the searched virtual display identifier through the response message, that is, the response message includes: the virtual display identifier (Virtual display 0) corresponding to the first application.
  • the first management module 21 receives the virtual display identifier, searches for the virtual display record in the relationship table between the virtual display and the virtual audio device maintained in Table 4 or Table 5, and determines that the virtual display record is in the virtual display record. Whether the state of the audio focus is available, or in other words whether other applications use the audio focus.
  • the audio focus state corresponding to Virtual display0 is Idle (Idle)
  • the first management module 21 returns a query result to the native audio framework 20, where the query result includes indication information requesting that the first audio focus is available.
  • the first management module 21 sends a response (response message) to the native audio framework 20, where the response includes indication information that the first audio focus is available, allowing application A to authorize access to the first audio focus information.
  • the native audio framework 20 determines that the first audio focus applied by the first application is available according to the query result, that is, the application for the first audio focus is successful, and sends the indication information that the first audio focus is available to application A.
  • the first application obtains the first audio focus.
  • step S6-6 also includes: the first management module 21 updates the virtual display0 record information. Specifically, the first management module 21 sets the state of the first audio focus in the virtual display 0 to "in use”, sets the application A to occupy the audio focus of the virtual display 0, and adds the application A to the application stack table, and the updated virtual The record information of display0 is shown in Table 6.
  • step 207 if the first management module 21 determines that the first audio focus is in the "use" state, it indicates that the first audio focus has been occupied by other applications, and the first application to apply for the audio focus needs to comply with the audio focus preemption mechanism.
  • the method includes:
  • the mobile phone 100 receives the operation that the user starts the application B to play audio, the application B has an audio playback function, and the virtual display corresponding to the application B is identified as virtual display 1.
  • the application B After the application B receives the user operation, it calls the interface of the first management module 21 to apply for the audio focus and obtain the second audio focus.
  • the specific process is the same as the foregoing steps S6-1 to S6-8, and details are not repeated here in this embodiment.
  • application A uses the first audio focus to play the audio stream
  • application B uses the second audio focus to play the audio stream.
  • the updated virtual display record information is shown in Table 7.
  • the above method further includes:
  • S5' The mobile phone 100 receives the operation that the user starts the application C to play the audio.
  • Application C applies to the first management module 21 and the second management module 22 for audio focus, and the second management module queries the virtual display corresponding to application C as virtual display 1.
  • the foregoing steps S6-1 to S6-4 which will not be repeated here.
  • the method includes:
  • the first management module 21 receives the virtual display identifier where the application C is located and returned by the second management module 22.
  • the display identifier where the application C is located is the virtual display 1.
  • the first management module 21 determines, according to the virtual display1 where the application C is located, that the audio focus requested by the application C is the second audio focus, and determines whether the second audio focus is available.
  • the virtual display identifiers corresponding to application C and application B are both virtual display 1, and the virtual display 1 corresponds to the second audio focus, wherein the second audio focus is acquired and used by application B first, so as to determine The second audio focus for this application C application is not available.
  • the first management module 21 preempts the application of the low-priority service according to the virtual display audio focus mechanism, that is, the high-priority service application preempts the application of the low-priority service, and applies for the application preemption priority rule after following the service application of the same priority.
  • the service priority corresponding to application C is higher than that of application C, and application C is an application applied later, it is determined that application C preempts the second audio focus of application B.
  • the first management module 21 sends indication information to the native audio framework 20, where the indication information is used to instruct the application C to preempt the second audio focus.
  • the native audio framework 20 After receiving the indication information, the native audio framework 20 sends a notification to application B to notify application B to release the currently used second audio focus.
  • the method further includes:
  • the first management module 21 sends a notification message to the native audio framework 20 to notify the application C to use the second audio focus.
  • the native audio framework 20 sends the communication message to application C to notify application C to obtain the second audio focus.
  • application C After receiving the notification message, application C obtains and uses the second audio focus.
  • the application when multiple applications apply for the same audio focus, the application is allocated a corresponding focus according to the virtual display audio focus mechanism, thereby optimizing the audio focus preemption mechanism of applications running on different virtual displays, and supporting multitasking based on virtual display. Audio concurrency control.
  • the first management module 21 also refreshes the virtual display record information, as shown in Table 8.
  • application A, application B, and application C may be the first application or the second application in the foregoing embodiment, which is not limited in this embodiment.
  • the multi-screen audio management module splits the audio stream played by the application to the corresponding virtual audio device for output and playback according to the mapping relationship between the display where the application is located and the virtual audio device.
  • the third part of the process define the audio distribution strategy based on the virtual Display, and transmit the audio stream to the virtual audio device corresponding to the application according to the distribution strategy.
  • the Android audio stream is distributed through AudioFlinger, and the multi-screen audio management module builds the binding relationship between the virtual display and the device ID of the virtual audio device in the "first part of the process".
  • the current application After obtaining the audio focus, create an AudioTrack to play the audio (or create an AudioRecod recording), AudioFlinger first finds the corresponding virtual audio device according to the virtual display belonging to the current application, and then distributes the application AudioTrack (or AudioRecord) to the corresponding virtual audio device.
  • the virtual audio HAL After receiving the audio stream, distribute it to the corresponding screen projection device.
  • the flow of the method for audio distribution based on virtual display includes:
  • the application A plays the music, calls the Android SDK interface to play the first audio stream, and the application A writes the first audio stream to the native audio framework 20.
  • the native audio framework 20 After receiving the first audio stream of the application A, the native audio framework 20 sends a query request to the first management module 21 to query the audio playback policy of the application A.
  • the query request includes application A related information, such as application A's package name, pid, identification and other information.
  • the first management module 21 After receiving the query message, the first management module 21 sends the query request to the second management module 22 .
  • the second management module 22 After receiving the request message sent from the first management module, the second management module 22 queries the virtual display identifier to which the application A belongs according to the virtual display record information table.
  • the second management module 22 sends the query result, that is, the virtual display identifier, to the first management module 21 .
  • the second management module 22 returns the first query result to the first management module 21, and the first query result includes: the virtual display 0 where the application A is located.
  • the first management module 21 After receiving the first query result, the first management module 21 searches for the virtual audio device corresponding to the virtual display 0 from the maintained binding relationship according to the virtual display 0 where the application A is located.
  • the binding relationship is the corresponding relationship between the virtual display and the device identifier of the virtual audio device established in the foregoing "Part 1 of the process".
  • the device identification of the virtual audio device bound to application A is determined, and the virtual audio device bound to the virtual display 0 is a smart screen, and the virtual audio device is bound to the virtual display 0.
  • the device identification of the audio device is the smart screen 200 .
  • the first management module 21 sends the device identification of the searched virtual audio device to the native audio architecture 20.
  • the first management module 21 sends the second query result, and the second query result includes the device identifier of the virtual audio device corresponding to display0, the smart screen 200 .
  • the native audio framework 20 After receiving the second query result, the native audio framework 20 acquires a first audio stream according to the audio policy, where the first audio stream is an audio stream that needs to be played on the smart screen 200.
  • the native audio framework 20 distributes the first audio stream played by application A and the device identifier of the virtual audio device to the virtual audio HAL 30, that is, sends the information of the first audio stream and the smart screen 200 to the virtual audio HAL.
  • the virtual audio HAL 30 After the virtual audio HAL 30 receives the first audio stream sent by the native audio framework 20 and the device identifier of the virtual audio device, it finds the corresponding audio path according to the device identifier of the virtual audio device, and sends the first audio stream through the audio path. to the audio equipment smart screen 200.
  • the smart screen 200 After receiving the first audio stream, the smart screen 200 plays the first audio stream, so as to realize the function of playing the first audio stream of the application A in the mobile phone 100 on the smart screen 200 .
  • steps 401 to 407 correspond to step S7 in the aforementioned "third part of the flow”
  • steps 408 to 410 correspond to the aforementioned step S8 in the "third part of the flow”.
  • the second audio stream is transmitted to the second device, such as the tablet 300, through the device identifier of the virtual audio device found by the first management module 21, thereby realizing the mobile phone 100.
  • steps 411 to 420 are the same as the foregoing steps 401 to 410, refer to the description of the foregoing embodiment, and are not described in detail here.
  • the virtual display allocated by application A that is, virtual display 0
  • the virtual display allocated by application B that is, virtual display 1
  • the virtual audio devices corresponding to each display are independent of each other and interfere with each other, so
  • the one-to-many screen projection function can be realized, and the multi-terminal screen projection display and audio input and output are independent of each other. Achieve true multitasking audio concurrency and pickup.
  • the above-mentioned application C requests to play the third audio stream and plays the third audio stream on the tablet 300 associated with the virtual display 1.
  • the specific process is the same as the aforementioned steps 401 to 410. See The description of the foregoing embodiment is not repeated in this embodiment.
  • the above scheme of transmitting audio streams to the virtual audio device corresponding to the application according to the streaming strategy is also applicable to other scenarios, such as recording scenarios, so that each screen-casting device can use the current screen-casting device for recording when running the application, which satisfies one requirement. Recording requirements for multi-screen projection. Alternatively, it is also applicable to a one-to-many projection screen distributed camera (camera) virtualization environment, which can realize a distributed camera usage scenario in a multi-screen scenario.
  • a one-to-many projection screen distributed camera (camera) virtualization environment which can realize a distributed camera usage scenario in a multi-screen scenario.
  • the mobile terminal can transmit the displayed picture content to each display screen of the screen projection device based on the form of the application window, so as to realize audio concurrency for each application window.
  • FIG. 15 is a schematic structural diagram of a management apparatus provided by an embodiment of the present application.
  • the apparatus may be applied to the aforementioned first management module, or may also be a component located in a terminal device. Furthermore, the apparatus can implement all the functions of the first management module 21 in the foregoing embodiments, and execute an audio playing method in the foregoing embodiments.
  • the apparatus includes: a first receiving unit 1501, a first processing unit 1502, and a first sending unit 1503, and may further include other units or modules, such as a storage unit and the like.
  • the first receiving unit 1501 is configured to receive a first request sent by the screen projection service module when the terminal device starts the screen projection service, where the first request is used to request the creation of a virtual audio device, and the first request includes Relevant information of the first device that the user wishes to screen;
  • the first sending unit 1503 is configured to send the first request to the hardware abstraction layer HAL;
  • the first receiving unit 1501 is further configured to receive the first virtual audio device sent by the HAL
  • the device identifier of the first virtual audio device is created according to the relevant information of the first device.
  • the first sending unit 1503 is further configured to send the device identifier of the first virtual audio device to the screen projection service module, so that the virtual screen projection service module establishes a relationship between the virtual display screen display and the first virtual audio device. binding relationship between.
  • the first receiving unit 1501 is further configured to receive the first binding relationship sent by the screen projection service module, where the first binding relationship includes the first binding relationship.
  • the first processing unit 1502 is configured to determine the first virtual display when the first application requests to play the audio stream, according to the first virtual display Find the device identifier of the first virtual audio device in the first binding relationship;
  • the first sending unit 1503 is further configured to send the device identifier of the first virtual audio device to the native audio framework, so that the native audio framework The corresponding audio stream is output to the first device through the first virtual audio device.
  • the first receiving unit 1501 is further configured to acquire the identifier of the first application; the first sending unit 1503 is further configured to send the first application to the second management module An identifier of an application; the first receiving unit 1501 is further configured to receive the first virtual display determined by the second management module according to the identifier of the first application.
  • the first processing unit 1502 is further configured to determine a first audio focus according to the first virtual display, where the first audio focus is the same as the first audio focus. Corresponding to the virtual display, query whether the state of the first audio focus is available; the first sending unit 1503 is further configured to send to the native audio framework when the first processing unit 1502 queries that the first audio focus is available the first audio focus.
  • the first processing unit 1502 is further configured to, when querying the status of the first audio focus is unavailable, determine that the application occupying the first audio focus is: The second application; the first sending unit 1503 is further configured to send first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be The first application is occupied; and, when the first receiving unit receives an instruction that the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that all The first application acquires the first audio focus.
  • the method further includes: the first processing unit 1502 is further configured to obtain the first audio focus.
  • the first focus management record includes the state of the first audio focus, the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
  • the first processing unit 1502 is further configured to maintain the first focus management record according to the virtual display audio focus mechanism.
  • the virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority service application according to the high priority The applications of the priority services, and, the service applications of the same priority follow the rule of applying for the application first and preempting the application first.
  • this embodiment further provides another management device.
  • the device can be applied to a second management module to implement all or part of the functions of the second management module 22, wherein the second management module
  • the management module includes: a second receiving unit 1601, a second processing unit 1602, and a second sending unit 1603, and may also include other units or modules, such as a storage unit and the like.
  • the second receiving unit 1601 is configured to receive a second request sent by the screen-casting service module, the second request is used to create a virtual display for screen-casting, and the second request includes: specifying the name, size and resolution of the virtual display rate information.
  • the second processing unit 1602 is configured to create a first virtual display according to the specified virtual display name, size and resolution information; the second sending unit 1603 is configured to send the first virtual display to the screen projection service module, so that The virtual screen projection service module establishes a first binding relationship between the first virtual display and the first virtual audio device.
  • the second receiving unit 1601 is further configured to receive the first binding relationship sent by the screen projection service module; the second sending unit 1603 is further configured to Send the first binding relationship to the first management module.
  • the second receiving unit 1601 is further configured to, when the first application requests to play the audio stream, the second management module to obtain the identifier of the first application;
  • the second processing unit 1602 is further configured to search for the first virtual display to which the first application belongs according to the identifier of the first application;
  • the second sending unit 1603 is further configured to send the first virtual display to the first management module.
  • the second receiving unit 1601 is further configured to receive an audio focus request sent by the first management module when the first application requests to apply for audio focus , the audio focus request includes the identifier of the first application.
  • the second receiving unit 1601 is further configured to receive, when the native audio framework acquires the audio stream played by the first application, a message sent by the first management module. the identifier of the first application.
  • this embodiment also provides an application device.
  • the device can be applied to a screen projection service module to realize part or all of the functions of the aforementioned screen projection service module 10.
  • the application device It includes: a third receiving unit 1701, a third processing unit 1702, and a third sending unit 1703, and may also include other units or modules, such as a storage unit and the like.
  • the third receiving unit 1701 is configured to obtain the first virtual display screen display created by the second management module when obtaining the user's operation of starting the screen projection service;
  • the third sending unit 1703 is configured to obtain the first virtual display screen display created by the second management module;
  • the device After the device establishes a virtual audio link, it sends a first request to the first management module, where the first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user wishes to screen. information.
  • the third receiving unit 1701 is further configured to receive the device identifier of the first virtual audio device sent by the first management module; the third processing unit 1702 is configured to establish a first binding relationship for the screen projection service module, the first The binding relationship includes the corresponding relationship between the first virtual display and the device identifier of the first virtual audio device; the third sending unit 1703 is further configured to send the first binding to the first management module relation.
  • the third sending unit 1703 is further configured to send a second request to the second management module, where the second request is used to request the second management module
  • the module creates a virtual display
  • the third receiving unit 1701 is further configured to receive the first virtual display created by the second management module according to the second request.
  • the third processing unit 1702 is further configured to release the first virtual display and the first virtual display when acquiring the operation of the user disconnecting the screencasting service.
  • the first binding relationship between the device identifiers of the virtual audio device; the third receiving unit 1703 is further configured to send a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship.
  • each of the above-mentioned management apparatuses and application apparatuses may be implemented by software or a combination of software and hardware.
  • the functions of the first receiving unit to the third receiving unit and the first sending unit to the third sending unit can be realized through the internal port of the terminal device, and the functions of the first processing unit to the third processing unit can be realized through The processor 110 shown in FIG. 3 is implemented, or jointly implemented by the processor 110 and the memory 120 .
  • Data transmission between the terminal device and each screen projection device, such as audio streaming transmission, may be implemented through the mobile communication module 150 or the wireless communication module 160 .
  • a one-to-many projection scenario is realized through the functions of the projection screen service, multi-frequency audio management and multi-screen management module.
  • the multi-terminal projection device display and audio input and output are independent of each other.
  • a screen-casting device displays the running application playback sound on the current screen-casting device, and each screen-casting device displays a running application recording that can be recorded using the current screen-casting device to achieve multi-task audio concurrency and pickup.
  • an embodiment of the present application also provides an audio playback system, the system includes at least one source device and at least two screen projection devices, and both the source device and the screen projection device may be any of the foregoing terminal devices, and the The structure of the terminal device may be the same as or different from the structure of the apparatus shown in FIG. 3 .
  • a network device such as a server, a cloud platform, etc., may also be included, and the network device is used to assist the terminal device to realize the one-to-many screen projection service function.
  • an embodiment of the present application also provides a chip system.
  • the chip system includes a processor 1801 to support the above-mentioned device to implement the functions involved in the above-mentioned methods. For example, the foregoing first part of the flow to the third part Method steps in part of the process.
  • the chip system further includes a memory 1802 for storing the first management device, the second management device, and necessary computer instructions and data for each module.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the memory 1802 includes a computer storage medium, wherein the computer storage medium may store program instructions, and when the program instructions are executed, may include part or all of the steps of the audio playback method provided by the present application.
  • the storage medium can be a magnetic disk, an optical disk, a read-only storage memory ROM or a random access storage memory RAM, and the like.
  • all or part of the implementation may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented in software, it can be implemented in whole or in part in the form of a computer program product.
  • the above-mentioned computer storage medium may be a computer program product, and the computer program product includes one or more computer instructions, such as an instruction requesting to apply for audio focus, an instruction requesting to create a virtual display, a query instruction, etc., which are loaded and executed on a computer.
  • computer program instructions such as an instruction requesting to apply for audio focus, an instruction requesting to create a virtual display, a query instruction, etc., which are loaded and executed on a computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • General Business, Economics & Management (AREA)
  • Business, Economics & Management (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

Disclosed in the present application are an audio playing method, apparatus and system. The method comprises: when a terminal device starts a screen mirroring service, a first management module receiving a first request sent by a screen mirroring service module, wherein the first request is used for requesting the creation of a virtual audio device, and the first request comprises relevant information of a first device to which a user expects to perform screen mirroring; the first management module sending the first request to a hardware abstraction layer (HAL); receiving a device identifier, which is sent by the HAL, of a first virtual audio device; and the first management module sending the device identifier of the first virtual audio device to the screen mirroring service module, such that the screen mirroring service module establishes a binding relationship between a virtual display and the first virtual audio device. By means of the method, the audio input/output capability in an existing screen mirroring scenario is enhanced, such that when a virtual display runs an application, an audio stream is input and output following an audio device at a screen mirroring end, and in a one-to-may screen mirroring scenario, screen mirroring devices display audio in a manner independent of each other, and do not interfere with each other.

Description

一种音频播放方法、装置和设备An audio playback method, device and device
本申请要求于2021年5月7日提交中国国家知识产权局、申请号为202110497072.1、发明名称为“一种音频播放方法、装置和设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110497072.1 and the title of the invention "An audio playback method, device and equipment", which was submitted to the State Intellectual Property Office of China on May 7, 2021, the entire contents of which are incorporated by reference in this application.
技术领域technical field
本申请涉及媒体播放领域,尤其是涉及一种音频播放方法、装置和设备。The present application relates to the field of media playback, and in particular, to an audio playback method, apparatus and device.
背景技术Background technique
当前安卓(Android)手机终端可以通过通用串行总线(universal serial bus,USB)线或无线保真(WiFi)实现手机对不同终端投屏。比如手机通过USB显示端口(DisplayPort,DP)接口将手机上显示的音频/视频内容投屏到其他终端设备上,或者通过Miracast或厂商多屏协同功能实现手机对平板电脑、个人计算机(personal computer,PC)、大屏显示器等设备投屏。At present, Android (Android) mobile phone terminals can realize the screen projection of the mobile phone to different terminals through a universal serial bus (universal serial bus, USB) cable or wireless fidelity (WiFi). For example, the mobile phone projects the audio/video content displayed on the mobile phone to other terminal devices through the USB DisplayPort (DP) interface, or realizes the mobile phone-to-tablet computer, personal computer (personal computer, personal computer) through Miracast or the multi-screen collaboration function of the manufacturer. PC), large-screen monitors and other devices to cast the screen.
通常Android终端的投屏业务大都是采用安卓虚拟投屏(Android Virtual Display)技术,手机终端具备构建多个虚拟显示屏(display)的能力。随着后续投屏技术的发展,手机终端可以作为多设备投屏服务端,实现一对多设备的投屏业务,并且不同设备中每个设备对应一个虚拟display。例如,手机通过USB DP接口投屏一个显示屏终端,同时该手机还通过多屏协同功能投屏到另一终端设备,比如智慧屏,从而满足用户A可以利用显示屏终端通过手机进行办公,同时还可以将手机投屏到智慧屏,满足家庭用户B的娱乐需求。Usually, the screen projection business of Android terminals mostly adopts the Android Virtual Display technology, and the mobile terminal has the ability to build multiple virtual displays. With the development of subsequent screen projection technologies, mobile terminals can be used as multi-device screen projection servers to implement one-to-many device projection services, and each device in different devices corresponds to a virtual display. For example, the mobile phone projects the screen to a display terminal through the USB DP interface, and the mobile phone also projects the screen to another terminal device, such as a smart screen, through the multi-screen collaboration function, so that user A can use the display terminal to work through the mobile phone, and at the same time The mobile phone can also be projected to the smart screen to meet the entertainment needs of home user B.
如图1所示,用户手持手机,该手机通过USB DP线连接到带扬声器显示屏,比如笔记本电脑进入办公模式,同时手机还可以投屏到智慧屏播放视频或语音通话,当前这类并发投屏场景下,由于Android是多任务系统,音频(Audio)系统是竞争资源,应用遵守Android音频焦点的调用机制,在播放音频前需要先去系统侧申请焦点,只有申请获得焦点的应用才能播放音频,一旦失去焦点,则暂停播放。如果遵守该音频焦点的调用机制,则在图1所示的场景中,手机声音只能在一个投屏设备上发声,比如默认选择在智慧屏上发声,则在笔记本电脑上将暂停发声,进而导致系统无法提供运行在不同display的音频播放类APP上同时发声,即当前Android音频系统同一时间只支持一个投屏设备上的声音播放,且仅对应一个播放应用发声,无法满足上述终端设备一对多的投屏场景中用户不同影音诉求。As shown in Figure 1, the user holds a mobile phone, and the mobile phone is connected to a display screen with a speaker through a USB DP cable. For example, a laptop computer enters the office mode. At the same time, the mobile phone can also cast the screen to the smart screen to play video or voice calls. In the screen scenario, since Android is a multi-tasking system, the audio system is a competitive resource. The application follows the Android audio focus calling mechanism. Before playing audio, you need to apply for the focus on the system side. Only the application that applies for the focus can play audio. , pauses playback once it loses focus. If the calling mechanism of the audio focus is followed, in the scenario shown in Figure 1, the sound of the mobile phone can only be sounded on one screen-casting device. For example, if the sound is selected on the smart screen by default, the sound will be paused on the laptop, and then As a result, the system cannot provide simultaneous sound on audio playback APPs running on different displays, that is, the current Android audio system only supports sound playback on one screen-casting device at the same time, and only corresponds to one playback application. In many screencasting scenarios, users have different audio and video demands.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种音频播放方法、装置和设备,用于解决虚拟display一对多路投屏场景下无法支持音频多路并发控制输入输出问题。具体地,本申请公开了以下技术方案:The present application provides an audio playback method, device, and device, which are used to solve the problem that audio multi-channel concurrent control input and output cannot be supported in the scenario of virtual display one-to-multi-channel screen projection. Specifically, the application discloses the following technical solutions:
第一方面,本申请提供了一种音频播放方法,该方法可应用于第一管理模块,所述方法包括:当终端设备启动投屏业务时,第一管理模块接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备 的相关信息;所述第一管理模块向硬件抽象层HAL发送所述第一请求,接收所述HAL发送的第一虚拟音频设备的设备标识,所述第一虚拟音频设备根据所述第一设备的相关信息创建;所述第一管理模块向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。In a first aspect, the present application provides an audio playback method, which can be applied to a first management module. The method includes: when a terminal device starts a screencasting service, the first management module receives the first information sent by the screencasting service module. a request, the first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user wishes to screen; the first management module sends the first device to the hardware abstraction layer HAL a request, receiving the device identifier of the first virtual audio device sent by the HAL, the first virtual audio device is created according to the relevant information of the first device; the first management module sends the screen casting service module The device identifier of the first virtual audio device, so that the screen projection service module establishes a binding relationship between the virtual display screen display and the first virtual audio device.
可选的,所述第一管理模块为应用框架层中的一个模块,比如多屏音频管理模块,或者为一种vendor音频拓展模块。Optionally, the first management module is a module in the application framework layer, such as a multi-screen audio management module, or a vendor audio expansion module.
本方面提供的方法,增强现有投屏场景音频输入输出能力,第一管理模块为每个请求投屏的设备建立虚拟display,并基于虚拟display配置独立虚拟音频输入输出设备,建立虚拟display与虚拟音频设备之间的绑定关系,使得虚拟display运行应用时,音频流跟随投屏端音频设备输入输出,实现一对多投屏场景下,每个投屏设备显示音频互相独立,互不干扰。The method provided in this aspect enhances the audio input and output capability of the existing screen projection scene. The first management module establishes a virtual display for each device requesting screen projection, configures an independent virtual audio input and output device based on the virtual display, and establishes a virtual display and a virtual display. The binding relationship between audio devices enables the audio stream to follow the input and output of the audio device on the screen-casting end when the virtual display runs the application. In the one-to-many screen-casting scenario, the display audio of each screen-casting device is independent of each other and does not interfere with each other.
另外,每个投屏设备运行应用播放声音,在当前投屏设备端发声,每个投屏设备显示运行应用录音可以使用当前投屏设备的录音功能进行录音,从而实现多任务音频设备并发发声和拾音。In addition, each screencasting device runs the application to play the sound, and makes a sound on the current screencasting device. The recording of each screencasting device running the application can be recorded by using the recording function of the current screencasting device, so as to realize the simultaneous sound and sound of the multitasking audio device. pickup.
结合第一方面,在第一方面的一种可能的实现方式中,还包括:所述第一管理模块接收所述投屏业务模块发送的第一绑定关系,所述第一绑定关系包括第一虚拟显示屏display和所述第一虚拟音频设备的设备标识之间的对应关系;当第一应用请求播放音频流时,所述第一管理模块确定第一虚拟display;根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识;向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。With reference to the first aspect, in a possible implementation manner of the first aspect, the method further includes: the first management module receives a first binding relationship sent by the screen projection service module, where the first binding relationship includes The correspondence between the first virtual display screen display and the device identifier of the first virtual audio device; when the first application requests to play an audio stream, the first management module determines the first virtual display; according to the first The virtual display searches for the device identification of the first virtual audio device in the first binding relationship; sends the device identification of the first virtual audio device to the native audio framework, so that the native audio framework passes the corresponding audio stream through The first virtual audio device is output to the first device.
本实现方式中,通过预先获得第一虚拟显示屏display和第一虚拟音频设备的设备标识之间的第一绑定关系,从而在获取第一虚拟display时,可根据该第一绑定关系找到对应的第一虚拟音频设备的设备标识,以便将音频流通过所述第一虚拟音频设备传输至第一设备中,实现音频流在第一设备上播放。In this implementation manner, the first binding relationship between the first virtual display screen display and the device identifier of the first virtual audio device is obtained in advance, so that when the first virtual display is obtained, the first binding relationship can be found according to the first binding relationship. The device identifier of the corresponding first virtual audio device, so as to transmit the audio stream to the first device through the first virtual audio device, so as to realize the playback of the audio stream on the first device.
结合第一方面,在第一方面的另一种可能的实现方式中,所述第一管理模块确定第一虚拟display,包括:第一管理模块获取第一应用的标识,向第二管理模块发送所述第一应用的标识;所述第一管理模块接收所述第二管理模块根据所述第一应用的标识确定的所述第一虚拟display。With reference to the first aspect, in another possible implementation manner of the first aspect, determining the first virtual display by the first management module includes: the first management module acquires the identifier of the first application, and sends the identifier to the second management module The identifier of the first application; the first management module receives the first virtual display determined by the second management module according to the identifier of the first application.
结合第一方面,在第一方面的又一种可能的实现方式中,所述第一管理模块确定第一虚拟display之后,还包括:所述第一管理模块根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应;所述第一管理模块查询所述第一音频焦点的状态是否可用;如果是,则向所述原生音频框架发送所述第一音频焦点。本方式实现音频焦点的分发,用于为请求播放音频流的设备提供音频焦点。With reference to the first aspect, in another possible implementation manner of the first aspect, after the first management module determines the first virtual display, the method further includes: the first management module determines the first virtual display according to the first virtual display. an audio focus, the first audio focus corresponds to the first virtual display; the first management module queries whether the state of the first audio focus is available; if so, sends the information to the native audio framework the first audio focus. This mode implements the distribution of audio focus, and is used to provide audio focus for the device requesting to play the audio stream.
结合第一方面,在第一方面的又一种可能的实现方式中,还包括:如果查询所述第一音频焦点的状态不可用,则确定占用所述第一音频焦点的应用为第二应用;所述第一管理模块向所述原生音频框架发送第一指示信息,所述第一指示信息用于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;当接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。With reference to the first aspect, in yet another possible implementation manner of the first aspect, the method further includes: if the state of the first audio focus is unavailable for querying, determining that the application occupying the first audio focus is the second application ; the first management module sends first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be occupied by the first application; when receiving When the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that the first application acquires the first audio focus.
本实现方式中,当有两个应用申请同一音频焦点时,根据虚拟display音频焦点机制为第二应用分配相应的第一音频焦点,从而优化运行在不同虚拟display的应用音频焦点抢占机制,支持基于虚拟display的多任务音频并发控制。In this implementation, when two applications apply for the same audio focus, a corresponding first audio focus is allocated to the second application according to the virtual display audio focus mechanism, so as to optimize the audio focus preemption mechanism of applications running on different virtual displays, and support based on the virtual display audio focus mechanism. Multitasking audio concurrency control for virtual displays.
结合第一方面,在第一方面的又一种可能的实现方式中,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:所述第一管理模块获取第一虚拟display所关联的第一焦点管理记录,所述第一焦点管理记录中包括第一音频焦点的状态,其中所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点。With reference to the first aspect, in yet another possible implementation manner of the first aspect, before the first management module inquires whether the state of the first audio focus is available, the method further includes: acquiring, by the first management module, the first The first focus management record associated with the virtual display, the first focus management record includes the state of the first audio focus, wherein the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the the first audio focus.
所述第一管理模块查询所述第一音频焦点的状态是否可用,包括:所述第一管理模块在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲。The first management module inquiring whether the state of the first audio focus is available includes: the first management module inquiring, in the first focus management record, whether the state of the first audio focus is idle.
结合第一方面,在第一方面的又一种可能的实现方式中,还包括:所述第一管理模块按照虚拟display音频焦点机制维护所述第一焦点管理记录;所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。With reference to the first aspect, in yet another possible implementation manner of the first aspect, the method further includes: the first management module maintains the first focus management record according to a virtual display audio focus mechanism; the virtual display audio focus mechanism Including: when there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, the application of the high-priority service preempts the application of the low-priority service, and, equal Priority business applications follow the rules of applying for applications later and preempting applications first.
本实现方式中,通过第一管理模块管理和记录每个音频焦点的状态,从而当有终端设备申请焦点时,可以为不同终端设备分配焦点,从而实现音频焦点的合理分配和使用,提高了音频焦点资源分发效率。In this implementation manner, the state of each audio focus is managed and recorded by the first management module, so that when a terminal device applies for a focus, the focus can be allocated to different terminal devices, thereby realizing the rational allocation and use of the audio focus and improving the audio frequency. Focus on resource distribution efficiency.
第二方面,本申请还提供一种音频播放方法,该方法应用于第二管理模块,所述方法包括:In a second aspect, the present application also provides an audio playback method, the method is applied to the second management module, and the method includes:
第二管理模块接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,其中所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息;所述第二管理模块根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;所述第二管理模块向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。The second management module receives a second request sent by the screen projection service module, where the second request is used to create a virtual display for screen projection, wherein the second request includes: specifying the name, size and resolution information of the virtual display; The second management module creates a first virtual display according to the specified virtual display name, size and resolution information; the second management module sends the first virtual display to the screen projection service module, so that the virtual display The screen projection service module establishes a first binding relationship between the first virtual display and the first virtual audio device.
可选的,所述第二管理模块为应用框架层中的一个模块,比如多屏管理模块。Optionally, the second management module is a module in the application framework layer, such as a multi-screen management module.
结合第二方面,在第二方面的一种可能的实现方式中,还包括:所述第二管理模块接收所述投屏业务模块发送的所述第一绑定关系;所述第二管理模块向所述第一管理模块发送所述第一绑定关系。With reference to the second aspect, in a possible implementation manner of the second aspect, the method further includes: the second management module receives the first binding relationship sent by the screen projection service module; the second management module Send the first binding relationship to the first management module.
结合第二方面,在第二方面的另一种可能的实现方式中,还包括:当第一应用请求播放音频流时,所述第二管理模块获取第一应用的标识;所述第二管理模块根据所述第一应用的标识查找第一应用所属的第一虚拟display;所述第二管理模块向所述第一管理模块发送所述第一虚拟display。With reference to the second aspect, in another possible implementation manner of the second aspect, the method further includes: when the first application requests to play an audio stream, the second management module acquires the identifier of the first application; the second management module The module searches for the first virtual display to which the first application belongs according to the identifier of the first application; the second management module sends the first virtual display to the first management module.
结合第二方面,在第二方面的又一种可能的实现方式中,所述第二管理模块获取第一应用的标识,包括:所述第二管理模块在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。With reference to the second aspect, in yet another possible implementation manner of the second aspect, the second management module acquiring the identifier of the first application includes: the second management module requests the first application to apply for audio focus When the audio focus request is sent by the first management module, the audio focus request includes the identifier of the first application.
结合第二方面,在第二方面的又一种可能的实现方式中,所述第二管理模块获取第一应用的标识,包括:所述第二管理模块在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。With reference to the second aspect, in yet another possible implementation manner of the second aspect, the second management module acquiring the identifier of the first application includes: the second management module acquiring the first application in the native audio framework When playing the audio stream, the identifier of the first application sent by the first management module is received.
第三方面,本申请还提供一种音频播放方法,可应用于投屏业务模块,所述方法包括: 投屏业务模块在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;所述投屏业务模块在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;所述投屏业务模块接收所述第一管理模块发送的第一虚拟音频设备的设备标识;建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;所述投屏业务模块向所述第一管理模块发送所述第一绑定关系。In a third aspect, the present application further provides an audio playback method, which can be applied to a screencasting service module, the method comprising: when the screencasting service module acquires an operation of a user initiating a screencasting service, acquiring the first file created by the second management module. A virtual display screen display; the screen projection service module sends a first request to the first management module after establishing a virtual audio link with the first device that expects screen projection, and the first request is used to request the creation of a virtual display Audio equipment, the first request includes the relevant information of the first equipment that the user wishes to screen; the screen casting service module receives the device identification of the first virtual audio equipment sent by the first management module; establishes a first binding The first binding relationship includes the corresponding relationship between the device identifiers of the first virtual display and the first virtual audio device; the screen projection service module sends the first management module the The first binding relationship.
本方面提供的方法,投屏业务模块根据接收的第一虚拟显示屏display和第一虚拟音频设备的设备标识,建立二者的绑定关系,从而为后续虚拟音频设备的选择以及音频流的分发提供便捷,使得虚拟display运行应用时,音频流跟随投屏端音频设备输入输出,实现一对多投屏场景下,每个投屏设备显示音频互相独立,互不干扰。In the method provided by this aspect, the screen projection service module establishes a binding relationship between the first virtual display screen display and the first virtual audio device according to the received device identifiers, so as to provide subsequent selection of virtual audio devices and distribution of audio streams. Provides convenience so that when the virtual display runs the application, the audio stream follows the input and output of the audio device on the screen-casting end, so that in the one-to-many screen-casting scenario, the audio displayed by each screen-casting device is independent of each other and does not interfere with each other.
可选的,所述投屏业务模块可以是位于应用层的一个功能模块。比如投屏业务APP,或投屏业务APK包。Optionally, the screen projection service module may be a functional module located at the application layer. For example, the screencasting service APP, or the screencasting service APK package.
结合第三方面,在第三方面的一种可能的实现方式中,所述获取第二管理模块创建的第一虚拟显示屏display,包括:所述投屏业务模块向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;所述投屏业务模块接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。With reference to the third aspect, in a possible implementation manner of the third aspect, the acquiring the first virtual display screen display created by the second management module includes: the screen projection service module sends a message to the second management module A second request, where the second request is used to request the second management module to create a virtual display; the screen projection service module receives the first virtual display created by the second management module according to the second request.
结合第三方面,在第三方面的另一种可能的实现方式中,还包括:当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;所述投屏业务模块向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。With reference to the third aspect, in another possible implementation manner of the third aspect, the method further includes: when the user's operation of disconnecting the screen-casting service is obtained, releasing the first virtual display and the first virtual audio device. The first binding relationship between device identifiers; the screen projection service module sends a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relation.
第四方面,本申请还提供一种管理装置,该装置可应用于第一管理模块,所述第一管理模块包括:第一接收单元,用于当终端设备启动投屏业务时,接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;第一发送单元,用于向硬件抽象层HAL发送所述第一请求;所述第一接收单元,还用于接收所述HAL发送的第一虚拟音频设备的设备标识,所述第一虚拟音频设备根据所述第一设备的相关信息创建;所述第一发送单元,还用于向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述虚拟投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。In a fourth aspect, the present application further provides a management device, which can be applied to a first management module, where the first management module includes: a first receiving unit, configured to receive a screen projection when a terminal device starts a screen projection service The first request sent by the service module, the first request is used to request the creation of a virtual audio device, and the first request includes the relevant information of the first device that the user expects to screen; the first sending unit is used to abstract from the hardware The layer HAL sends the first request; the first receiving unit is further configured to receive the device identifier of the first virtual audio device sent by the HAL, and the first virtual audio device is based on the relevant information of the first device. Create; the first sending unit is further configured to send the device identification of the first virtual audio device to the screen projection service module, so that the virtual screen projection service module establishes a virtual display screen display and the first Binding relationship between virtual audio devices.
结合第四方面,在第四方面的一种可能的实现方式中,所述第一接收单元,还用于接收所述投屏业务模块发送的第一绑定关系,所述第一绑定关系包括第一虚拟显示屏display和所述第一虚拟音频设备的设备标识之间的对应关系;第一处理单元,用于当第一应用请求播放音频流时确定第一虚拟display,根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识;所述第一发送单元,还用于向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。With reference to the fourth aspect, in a possible implementation manner of the fourth aspect, the first receiving unit is further configured to receive a first binding relationship sent by the screen projection service module, the first binding relationship including the correspondence between the first virtual display screen display and the device identifier of the first virtual audio device; the first processing unit is used to determine the first virtual display when the first application requests to play the audio stream, according to the first processing unit A virtual display searches for the device identifier of the first virtual audio device in the first binding relationship; the first sending unit is further configured to send the device identifier of the first virtual audio device to the native audio framework, so that the The native audio framework outputs the corresponding audio stream to the first device through the first virtual audio device.
结合第四方面,在第四方面的另一种可能的实现方式中,所述第一接收单元,还用于获取第一应用的标识;所述第一发送单元,还用于向第二管理模块发送所述第一应用的标识;所述第一接收单元,还用于接收所述第二管理模块根据所述第一应用的标识确定的所 述第一虚拟display。With reference to the fourth aspect, in another possible implementation manner of the fourth aspect, the first receiving unit is further configured to acquire the identifier of the first application; the first sending unit is further configured to send the second management The module sends the identifier of the first application; the first receiving unit is further configured to receive the first virtual display determined by the second management module according to the identifier of the first application.
结合第四方面,在第四方面的又一种可能的实现方式中,所述第一处理单元,还用于根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应,查询所述第一音频焦点的状态是否可用;所述第一发送单元,还用于在所述第一处理单元查询所述第一音频焦点可用时,向所述原生音频框架发送所述第一音频焦点。With reference to the fourth aspect, in yet another possible implementation manner of the fourth aspect, the first processing unit is further configured to determine a first audio focus according to the first virtual display, where the first audio focus is related to the Corresponding to the first virtual display, query whether the state of the first audio focus is available; the first sending unit is further configured to, when the first processing unit queries the availability of the first audio focus, to the The native audio framework sends the first audio focus.
结合第四方面,在第四方面的又一种可能的实现方式中,所述第一处理单元,还用于在查询所述第一音频焦点的状态不可用时,确定占用所述第一音频焦点的应用为第二应用;所述第一发送单元,还用于向所述原生音频框架发送第一指示信息,所述第一指示信息用于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;以及,当所述第一接收单元接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。With reference to the fourth aspect, in yet another possible implementation manner of the fourth aspect, the first processing unit is further configured to determine that the first audio focus is occupied when the state of the first audio focus is inquired to be unavailable The application in question is the second application; the first sending unit is further configured to send first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be being occupied by the first application; and, when the first receiving unit receives an indication that the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that the first application acquires the first audio focus.
结合第四方面,在第四方面的又一种可能的实现方式中,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:所述第一处理单元,还用于获取第一虚拟Display所关联的第一焦点管理记录,以及在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲。With reference to the fourth aspect, in yet another possible implementation manner of the fourth aspect, before the first management module queries whether the state of the first audio focus is available, the method further includes: the first processing unit, further using obtaining the first focus management record associated with the first virtual Display, and querying the first focus management record whether the state of the first audio focus is idle.
其中,所述第一焦点管理记录中包括第一音频焦点的状态,所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点。Wherein, the first focus management record includes the state of the first audio focus, the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
结合第四方面,在第四方面的又一种可能的实现方式中,所述第一处理单元,还用于按照虚拟display音频焦点机制维护所述第一焦点管理记录;所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。With reference to the fourth aspect, in yet another possible implementation manner of the fourth aspect, the first processing unit is further configured to maintain the first focus management record according to a virtual display audio focus mechanism; the virtual display audio focus The mechanism includes: when there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, the application of the high-priority service preempts the application of the low-priority service, and, Business applications with the same priority follow the rules of applying for applications later and preempting applications first.
第五方面,本申请还提供另一种管理装置,可应用于第二管理模块,所述第二管理模块包括:第二接收单元,用于接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,其中所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息;第二处理单元,用于根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;第二发送单元,用于向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。In a fifth aspect, the present application further provides another management device, which can be applied to a second management module, where the second management module includes: a second receiving unit configured to receive a second request sent by the screen projection service module, the The second request is used to create a screen-casting virtual display, wherein the second request includes: specifying the name, size, and resolution information of the virtual display; and a second processing unit, configured to specify the name, size, and resolution of the virtual display according to the specified rate information to create a first virtual display; a second sending unit, configured to send the first virtual display to the screen-casting service module, so that the virtual screen-casting service module establishes the first virtual display and the first virtual display The first binding relationship between audio devices.
结合第五方面,在第五方面的一种可能的实现方式中,所述第二接收单元,还用于接收所述投屏业务模块发送的所述第一绑定关系;所述第二发送单元,还用于向所述第一管理模块发送所述第一绑定关系。With reference to the fifth aspect, in a possible implementation manner of the fifth aspect, the second receiving unit is further configured to receive the first binding relationship sent by the screen projection service module; the second sending The unit is further configured to send the first binding relationship to the first management module.
结合第五方面,在第五方面的另一种可能的实现方式中,所述第二接收单元,还用于当第一应用请求播放音频流时,所述第二管理模块获取第一应用的标识;所述第二处理单元,还用于根据所述第一应用的标识查找第一应用所属的第一虚拟display;所述第二发送单元,还用于向所述第一管理模块发送所述第一虚拟display。With reference to the fifth aspect, in another possible implementation manner of the fifth aspect, the second receiving unit is further configured to, when the first application requests to play an audio stream, the second management module to obtain the first application's identifier; the second processing unit is further configured to search for the first virtual display to which the first application belongs according to the identifier of the first application; the second sending unit is further configured to send the information to the first management module Describe the first virtual display.
结合第五方面,在第五方面的又一种可能的实现方式中,所述第二接收单元,还用于在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。With reference to the fifth aspect, in yet another possible implementation manner of the fifth aspect, the second receiving unit is further configured to receive the data sent by the first management module when the first application requests to apply for audio focus An audio focus request, where the audio focus request includes the identifier of the first application.
结合第五方面,在第五方面的又一种可能的实现方式中,所述第二接收单元,还用于 在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。With reference to the fifth aspect, in yet another possible implementation manner of the fifth aspect, the second receiving unit is further configured to receive the first audio stream when the native audio framework acquires the audio stream played by the first application The identifier of the first application sent by the management module.
第六方面,本申请还提供一种应用装置,该应用装置可用是一种投屏业务模块,所述投屏业务模块包括:第三接收单元,用于在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;第三发送单元,用于在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;所述第三接收单元,还用于接收所述第一管理模块发送的第一虚拟音频设备的设备标识;第三处理单元,用于所述投屏业务模块建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;所述第三发送单元,还用于向所述第一管理模块发送所述第一绑定关系。In a sixth aspect, the present application further provides an application device, the application device can be a screen projection service module, and the screen projection service module includes: a third receiving unit for acquiring the operation of the user to start the screen projection service , obtains the first virtual display screen display created by the second management module; the third sending unit is configured to send a first request to the first management module after establishing a virtual audio link with the first device that expects screen projection, The first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user expects to screen; the third receiving unit is further configured to receive a message sent by the first management module The device identifier of the first virtual audio device; the third processing unit is used for the screen projection service module to establish a first binding relationship, and the first binding relationship includes the first virtual display and the first virtual Correspondence between device identifiers of audio devices; the third sending unit is further configured to send the first binding relationship to the first management module.
结合第六方面,在第六方面的一种可能的实现方式中,所述第三发送单元,还用于向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;所述第三接收单元,还用于接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。With reference to the sixth aspect, in a possible implementation manner of the sixth aspect, the third sending unit is further configured to send a second request to the second management module, where the second request is used to request the The second management module creates a virtual display; the third receiving unit is further configured to receive the first virtual display created by the second management module according to the second request.
结合第六方面,在第六方面的另一种可能的实现方式中,所述第三处理单元,还用于当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;所述第三接收单元,还用于向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。With reference to the sixth aspect, in another possible implementation manner of the sixth aspect, the third processing unit is further configured to release the first virtual display and all the the first binding relationship between the device identifiers of the first virtual audio device; the third receiving unit is further configured to send a first message to the first management module, where the first message is used to notify the The first management module deletes the first binding relationship.
第七方面,本申请还提供一种终端设备,包括:至少一个处理器和存储器,其中,所述存储器,用于存储计算机程序指令和/或数据;所述至少一个处理器,用于执行所述指令,以实现前述第一方面至第三方面各种实现方式中的方法。In a seventh aspect, the present application further provides a terminal device, comprising: at least one processor and a memory, wherein the memory is used to store computer program instructions and/or data; the at least one processor is used to execute the The above-mentioned instructions are used to implement the methods in the various implementation manners of the first aspect to the third aspect.
可选的,所述终端设备还包括接口电路,所述接口电路用于获取所述存储器中的计算机程序指令和/或数据。Optionally, the terminal device further includes an interface circuit, where the interface circuit is configured to acquire computer program instructions and/or data in the memory.
可选的,所述至少一个处理器、存储器和所述接口电路可以集成在一个处理芯片或者芯片电路中。Optionally, the at least one processor, the memory and the interface circuit may be integrated into one processing chip or chip circuit.
可选的,所述装置为一种终端设备,所述终端设备包括但不限于手机、PC、平板电脑。Optionally, the apparatus is a terminal device, and the terminal device includes but is not limited to a mobile phone, a PC, and a tablet computer.
第八方面,本申请还提供了一种音频播放系统,所述系统包括源设备和至少一个投屏设备,其中,所述源设备为前述第七方面的终端设备,用于实现前述第一方面至第三方面的各种实现方式中的方法。另外,所述至少一个投屏设备也可以是前述第七方面中的终端设备。In an eighth aspect, the present application further provides an audio playback system, the system includes a source device and at least one screen projection device, wherein the source device is the terminal device of the aforementioned seventh aspect, which is used to implement the aforementioned first aspect Methods in various implementations to the third aspect. In addition, the at least one screen projection device may also be the terminal device in the foregoing seventh aspect.
可选的,所述系统中还可以包括其他设备,比如云端服务器、网络设备等。Optionally, the system may further include other devices, such as cloud servers, network devices, and the like.
第九方面,本申请还提供了一种计算机可读存储介质,该存储介质中存储有指令,使得当指令在计算机或处理器上运行时,可以用于执行前述第一方面以及第一方面各种实现方式中的方法,和,前述第二方面以及第二方面各种实现方式中的方法,以及,前述第三方面以及第三方面各种实现方式中的方法。In a ninth aspect, the present application also provides a computer-readable storage medium, where instructions are stored in the storage medium, so that when the instructions are executed on a computer or a processor, they can be used to execute the foregoing first aspect and each of the first aspects. The method in one implementation manner, and the aforementioned second aspect and the method in various implementation manners of the second aspect, and the foregoing third aspect and the method in various implementation manners of the third aspect.
另外,本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,当该指令被计算机或处理器执行时,可实现前述第一方面以及第一方面各种实现方式中的方法,和,前述第二方面以及第二方面各种实现方式中的方法,以及,前述第三方面以及第 三方面各种实现方式中的方法。In addition, the present application also provides a computer program product, the computer program product includes computer instructions, when the instructions are executed by a computer or a processor, the aforementioned first aspect and the method in various implementation manners of the first aspect can be implemented, And, the aforementioned second aspect and methods in various implementations of the second aspect, and the aforementioned third aspect and methods in various implementations of the third aspect.
需要说明的是,上述第二方面至第九方面的各种实现方式的技术方案所对应的有益效果与前述第一方面以及第一方面的各种实现方式的有益效果相同,具体参见上述第一方面以及第一方面的各种实现方式中的有益效果描述,不再赘述。It should be noted that the beneficial effects corresponding to the technical solutions of the various implementation manners of the second aspect to the ninth aspect are the same as the beneficial effects of the foregoing first aspect and various implementation manners of the first aspect. For details, please refer to the foregoing first aspect. Aspects and descriptions of beneficial effects in various implementation manners of the first aspect will not be repeated.
附图说明Description of drawings
图1为本申请提供的一种手机终端投屏的场景示意图;Fig. 1 is a scene schematic diagram of a mobile phone terminal screen projection provided by the present application;
图2为本申请实施例提供的一种手机终端投屏业务的场景示意图;FIG. 2 is a schematic diagram of a scenario of a mobile phone terminal screen projection service provided by an embodiment of the present application;
图3为本申请实施例提供的一种终端设备的结构示意图;FIG. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
图4为本申请实施例提供的一种终端设备的软件结构示意图;FIG. 4 is a schematic diagram of a software structure of a terminal device according to an embodiment of the present application;
图5为本申请实施例提供的一种音频播放方法的流程图;5 is a flowchart of an audio playback method provided by an embodiment of the present application;
图6为本申请实施例提供的另一种音频播放方法的流程图;6 is a flowchart of another audio playback method provided by an embodiment of the present application;
图7为本申请实施例提供的一种源设备投屏到两个投屏设备的结构示意图;FIG. 7 is a schematic structural diagram of a source device projecting a screen to two screen projection devices according to an embodiment of the present application;
图8为本申请实施例提供的一种音频播放方法的信令流程图;FIG. 8 is a signaling flowchart of an audio playback method provided by an embodiment of the present application;
图9为本申请实施例提供的一种启动投屏流程的信令图;FIG. 9 is a signaling diagram for starting a screen projection process according to an embodiment of the present application;
图10为本申请实施例提供的一种断开投屏流程的信令图;10 is a signaling diagram of a process of disconnecting screen projection provided by an embodiment of the present application;
图11为本申请实施例提供的一种请求音频焦点的结构示意图;11 is a schematic structural diagram of requesting audio focus according to an embodiment of the present application;
图12为本申请实施例提供的一种应用获取音频焦点的信令流程图;FIG. 12 is a signaling flow chart of an application acquiring audio focus according to an embodiment of the present application;
图13为本申请实施例提供的一种音频焦点抢占机制的信令流程图;13 is a signaling flowchart of an audio focus preemption mechanism provided by an embodiment of the present application;
图14a为本申请实施例提供的一种音频流分发的示意图;14a is a schematic diagram of an audio stream distribution provided by an embodiment of the present application;
图14b为本申请实施例提供的一种播放音频流的信令流程图;FIG. 14b is a signaling flow chart of playing an audio stream provided by an embodiment of the application;
图15为本申请实施例提供的一种管理装置的结构示意图;FIG. 15 is a schematic structural diagram of a management apparatus provided by an embodiment of the present application;
图16为本申请实施例提供的另一种管理装置的结构示意图;FIG. 16 is a schematic structural diagram of another management apparatus provided by an embodiment of the present application;
图17为本申请实施例提供的应用装置的结构示意图;FIG. 17 is a schematic structural diagram of an application device provided by an embodiment of the present application;
图18为本申请实施例提供的一种芯片系统的结构示意图。FIG. 18 is a schematic structural diagram of a chip system provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请实施例中的技术方案,并使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请实施例中的技术方案作进一步详细的说明。In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more clearly understood, the following describes the technical solutions in the embodiments of the present application with reference to the accompanying drawings. The program is described in further detail.
在对本申请实施例的技术方案说明之前,首先结合附图对本申请实施例的应用场景进行说明。Before describing the technical solutions of the embodiments of the present application, the application scenarios of the embodiments of the present application are first described with reference to the accompanying drawings.
本申请的技术方案可应用于手机设备一对多的投屏业务场景,基于Android虚拟显示屏(display)利用虚拟化技术构建分布式音频,实现多端投屏显示以及音频输入输出相互独立,支持音频并发发声和拾音。The technical solution of the present application can be applied to the one-to-many screen projection business scenario of mobile phone devices. Based on the Android virtual display screen (display), the virtualized technology is used to construct distributed audio, so as to realize multi-terminal screen projection display and independent audio input and output, and support audio Simultaneous vocalization and pickup.
在一种可能的场景中,例如图2所示,手机通过安卓虚拟投屏(Android Virtual Display)技术投屏到智慧屏、平板以及显示屏上,本申请通过为N个投屏设备中的每个设备设置虚拟display,且为每个虚拟display分配独立的虚拟音频设备,所述虚拟音频设备包括扬声器(speaker)、麦克风(microphone,MIC)以及其他输入(input)设备等,以及多屏音频并发管理控制,以便用户在使用投屏显示端时,可以获得独立的音频视频体验,使得每个 显示端音频视频相互独立,互不干扰。In a possible scenario, such as shown in Figure 2, the mobile phone projects the screen to the smart screen, tablet and display screen through the Android Virtual Display (Android Virtual Display) technology. Each device sets up virtual displays, and assigns independent virtual audio devices to each virtual display. The virtual audio devices include speakers, microphones (MIC), and other input devices, etc., as well as multi-screen audio concurrent Management control, so that users can get an independent audio and video experience when using the screen projection display, so that the audio and video of each display are independent of each other and do not interfere with each other.
其中,所述手机还可以是其他终端设备,该终端设备可以是一种便携式设备,比如智能手机、平板电脑、笔记本电脑、个人计算机(personal computer,PC)、可折叠终端、具备无线通讯功能的可穿戴设备(例如智能手表或手环)、用户设备(user device)或用户设备(user equipment,UE)、以及增强现实(augmented reality,AR)或者虚拟现实(virtual reality,VR)设备、耳机等。此外,所述被投屏的设备也可以是上述终端设备中的任意一种或多种,本实施例对终端设备的具体设备形态不做限定。The mobile phone may also be other terminal equipment, and the terminal equipment may be a portable device, such as a smart phone, a tablet computer, a notebook computer, a personal computer (PC), a foldable terminal, a wireless communication function Wearable devices (such as smart watches or bracelets), user devices (user devices) or user equipment (UE), and augmented reality (AR) or virtual reality (VR) devices, headsets, etc. . In addition, the device to which the screen is projected may also be any one or more of the above-mentioned terminal devices, and the specific device form of the terminal device is not limited in this embodiment.
另外,上述各种终端设备中搭载安卓(Android)操作系统和/或兼容安卓的系统。In addition, the above-mentioned various terminal devices are equipped with an Android (Android) operating system and/or an Android-compatible system.
本实施例中,将投屏的设备称为源设备,将用户期望投屏的设备称为投屏设备。比如图2中,源设备为手机终端,投屏设备包括智慧屏、平板和显示屏等任意一种终端设备。In this embodiment, the device that projects the screen is called the source device, and the device that the user desires to project the screen is called the device that projects the screen. For example, in FIG. 2, the source device is a mobile phone terminal, and the screen projection device includes any terminal device such as a smart screen, a tablet, and a display screen.
可选的,上述应用场景中还可以包括云端侧,或云端网络设备,比如云服务器、数据中心等,且源设备与投屏设备之间通过无线网络,比如无线局域网(Wireless Local Area Networks,WLAN)或WiFi等。Optionally, the above application scenarios may also include cloud side or cloud network devices, such as cloud servers, data centers, etc., and the source device and the screen projection device are connected through a wireless network, such as a wireless local area network (Wireless Local Area Networks, WLAN). ) or WiFi, etc.
在一种实现方式中,上述终端设备可以包括以下结构,如图3所示,为本实施例提供的一种终端设备的结构示意图。该终端设备可以包括处理器110和存储器120,此外,还包括:USB接口130,电源管理模块140,电池141,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键191,指示器192,摄像头193,显示屏194,以及用户标识模块(Subscriber Identification Module,SIM)卡接口195等。In an implementation manner, the above-mentioned terminal device may include the following structure, as shown in FIG. 3 , which is a schematic structural diagram of a terminal device provided in this embodiment. The terminal device may include a processor 110 and a memory 120, and further include: a USB interface 130, a power management module 140, a battery 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, and a speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 191, indicator 192, camera 193, display screen 194, and subscriber identification module (Subscriber Identification Module, SIM) card interface 195 and the like.
其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,加速度传感器180C,重力传感器180D,触摸传感器180E,另外,传感器模块180中还可以包括指纹传感器,温度传感器,环境光传感器等。The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an acceleration sensor 180C, a gravity sensor 180D, and a touch sensor 180E. In addition, the sensor module 180 may also include a fingerprint sensor, a temperature sensor, an ambient light sensor, and the like.
可以理解的是,本申请实施例示意的结构并不构成对通信装置的具体限定。在本申请另一些实施例中,通信装置可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the communication device. In other embodiments of the present application, the communication device may include more or less components than shown, or some components are combined, or some components are separated, or different components are arranged. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(applicationprocessor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用,避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be directly called from the memory, which avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal  asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或USB接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or USB interface, etc.
其中,USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为通信装置充电,也可以用于通信装置与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。Among them, the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the communication device, and can also be used to transmit data between the communication device and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices.
电源管理模块140用于连接电池141与处理器110。电源管理模块140为处理器110,存储器120,显示屏194,摄像头193和无线通信模块160等供电。在一些实施例中,电源管理模块140可以设置于处理器110中。The power management module 140 is used for connecting the battery 141 and the processor 110 . The power management module 140 supplies power to the processor 110 , the memory 120 , the display screen 194 , the camera 193 , the wireless communication module 160 and the like. In some embodiments, the power management module 140 may be provided in the processor 110 .
终端设备的无线通信功能可以通过天线1、天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the terminal device may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。通信装置中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the communication device may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
移动通信模块150可以提供应用在通信装置上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。The mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G etc. applied on the communication device. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
无线通信模块160可以提供应用在通信装置上的包括WLAN(如WiFi网络),蓝牙(bluetooth),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on communication devices including WLAN (such as WiFi network), Bluetooth (bluetooth), global navigation satellite system (GNSS), frequency modulation (frequency modulation, FM), short-range wireless communication Technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
在一些实施例中,天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得终端设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(Long Term Evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS)。In some embodiments, the antenna 1 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), and a Beidou navigation satellite system (BDS).
显示屏194用于显示会话窗、显示界面、图像等。在一些实施例中,终端设备可以包括1个或N个显示屏,N为大于1的正整数。The display screen 194 is used to display conversation windows, display interfaces, images, and the like. In some embodiments, the terminal device may include 1 or N display screens, where N is a positive integer greater than 1.
存储器120可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。另外,还可以存储终端设备生成的或者与其他设备交互的数据/信息。Memory 120 may be used to store computer-executable program code, which includes instructions. In addition, data/information generated by the terminal device or interacted with other devices can also be stored.
进一步地,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。 处理器110通过运行存储在内部存储器120的指令,和/或存储在设置于处理器中的存储器的指令,执行终端设备的各种功能应用以及数据处理。Further, the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like. The processor 110 executes various functional applications and data processing of the terminal device by executing the instructions stored in the internal memory 120 and/or the instructions stored in the memory provided in the processor.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。陀螺仪传感器180B可以用于确定终端设备的运动姿态,比如测量终端设备的旋转角度。加速度传感器180C可检测终端设备在各个方向上(一般为三轴)加速度的大小。其中,加速度传感器180C中还包括线性加速度传感器,用于获得终端设备的线性加速度。重力传感器180D,用于测量终端设备在x轴、y轴和z轴方向上的加速度分量。触摸传感器180E,也称“触控器件”。触摸传感器180E可以设置于显示屏194,由触摸传感器180E与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180E用于检测作用于其上或附近的触摸操作,比如双击操作。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . The gyroscope sensor 180B can be used to determine the motion attitude of the terminal device, such as measuring the rotation angle of the terminal device. The acceleration sensor 180C can detect the magnitude of the acceleration of the terminal device in various directions (generally three axes). The acceleration sensor 180C further includes a linear acceleration sensor for obtaining the linear acceleration of the terminal device. The gravity sensor 180D is used to measure the acceleration components of the terminal device in the x-axis, y-axis and z-axis directions. The touch sensor 180E is also called "touch device". The touch sensor 180E may be disposed on the display screen 194 , and the touch sensor 180E and the display screen 194 form a touch screen, also referred to as a "touch screen". The touch sensor 180E is used to detect a touch operation on or near it, such as a double-tap operation.
按键191包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The keys 191 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和通信装置的接触和分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the communication device.
需要说明的是,上述云端侧或云端网络设备的结构可以与终端设备的结构相同,或者也可以不相同,本实施例对此不予限制。It should be noted that, the structure of the above-mentioned cloud side or cloud network device may be the same as or different from that of the terminal device, which is not limited in this embodiment.
另外,本实施例还提供一种终端设备的软件结构。以Android系统的终端设备为例,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。参见图4,在一些实施例中,所述终端设备的软件结构中Android系统从上至下分别为应用程序层(APP),应用程序框架层和硬件抽象层(Hardware Abstraction Layer,HAL),此外,在程序框架层和HAL层之间还包括安卓运行时(Android Runtime)和系统库(在图4中未示出)。In addition, this embodiment also provides a software structure of a terminal device. Taking the terminal device of the Android system as an example, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. Referring to FIG. 4, in some embodiments, the Android system in the software structure of the terminal device is an application layer (APP), an application framework layer and a hardware abstraction layer (HAL) from top to bottom, and in addition , Android runtime (Android Runtime) and system library (not shown in FIG. 4 ) are also included between the program framework layer and the HAL layer.
进一步地,在应用程序层可以包括一系列应用程序包,比如APP1,APP2,……。本实施例中包括投屏业务APP,所述投屏业务APP用于实现不同终端设备的投屏功能。Further, the application layer may include a series of application packages, such as APP1, APP2, . . . This embodiment includes a screen projection service APP, and the screen projection service APP is used to implement the screen projection function of different terminal devices.
可选的,应用程序框架层简称为“框架层(Framework)”。Optionally, the application framework layer is referred to as a "framework layer (Framework)" for short.
所述框架层为应用程序层的应用程序提供应用编程接口(Application Programming Interface,API)和编程框架。框架层包括一些预先定义的函数。The framework layer provides an application programming interface (Application Programming Interface, API) and a programming framework for applications in the application layer. The framework layer includes some predefined functions.
如图4所示,所述框架层中包括:安卓开源平台(Android open source platform,AOSP)原生音频框架、多屏管理(Multi-screen management)模块和供应商(Vendor)音频扩展功能模块。其中,所述Vendor音频扩展功能模块为新增的功能模块。As shown in Figure 4, the framework layer includes: Android open source platform (Android open source platform, AOSP) native audio framework, multi-screen management (Multi-screen management) module and vendor (Vendor) audio extension function module. Wherein, the Vendor audio extension function module is a newly added function module.
具体地,各个模块所包含的功能/作用如表1所示。Specifically, the functions/roles included in each module are shown in Table 1.
表1Table 1
Figure PCTCN2022088205-appb-000001
Figure PCTCN2022088205-appb-000001
Figure PCTCN2022088205-appb-000002
Figure PCTCN2022088205-appb-000002
所述多屏管理模块,针对主屏和虚拟屏管理模块,维护管理投屏业务使用Display信息。另外,多屏管理模块还关联音频框架,实现虚拟显示屏(Display)的创建、销毁以及虚拟音频设备配置管理等功能。The multi-screen management module, for the main screen and the virtual screen management module, maintains and manages the display information used by the screen projection business. In addition, the multi-screen management module is also associated with the audio framework to realize functions such as creation and destruction of virtual display screens (Display) and configuration management of virtual audio devices.
音频框架,包括AOSP原生音频框架和Vendor音频扩展功能,其中所述Vendor音频扩展功能为新增功能模块,用于扩展音频策略(AudoPolicy)、媒体焦点控制(MediaFocusControl)和音频调度服务(AudioFlinger)模块的功能,从而建立以虚拟Display为中心的音频焦点管理和音频流通路策略控制。Audio framework, including AOSP native audio framework and Vendor audio extension function, wherein the Vendor audio extension function is a new function module, used to extend audio policy (AudoPolicy), media focus control (MediaFocusControl) and audio scheduling service (AudioFlinger) modules function to establish audio focus management and audio streaming channel policy control centered on virtual Display.
进一步地,所述Vendor音频扩展的功能中至少包括以下新增功能:Further, the functions of the Vendor audio extension include at least the following new functions:
(1)AudioPolicyImp,用于实现基于虚拟Display的虚拟音频设备策略控制;(1) AudioPolicyImp, which is used to implement virtual audio device policy control based on virtual Display;
(2)MediaFocusControlImpl,用于实现基于虚拟Display为中心的音频焦点控制;(2) MediaFocusControlImpl, used to realize audio focus control based on virtual Display;
(3)AudioFlingerImpl,用于实现基于虚拟Display的音频流通路控制;(3) AudioFlingerImpl, used to realize the audio stream path control based on virtual Display;
(4)多屏音频管理模块,负责虚拟Display对接虚拟音频设备管理,所述虚拟音频设备包括虚拟Speaker设备和虚拟Mic设备,还用于建立虚拟Display与音频设备HAL之间的映射关系,提供基于虚拟Display焦点管理。(4) Multi-screen audio management module, responsible for virtual Display docking virtual audio equipment management, the virtual audio equipment includes virtual Speaker equipment and virtual Mic equipment, is also used to establish the mapping relationship between the virtual Display and the audio equipment HAL, provides based on Virtual Display focus management.
可选的,在所述框架层中还可以包括其他管理器,比如窗口管理器、内容提供器、视图系统、电话管理器和通知管理器等。Optionally, other managers may also be included in the framework layer, such as a window manager, a content provider, a view system, a telephony manager, a notification manager, and the like.
另外,所述Android Runtime包括核心库和虚拟机。Android Runtime负责安卓系统的调度和管理。具体地,核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。In addition, the Android Runtime includes a core library and a virtual machine. Android Runtime is responsible for scheduling and management of the Android system. Specifically, the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
所述系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。其中,所述媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。2D图形引擎是2D绘图的绘图引擎。The system library may include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files and the like. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing. 2D graphics engine is a drawing engine for 2D drawing.
硬件抽象层HAL,是位于操作系统内核与硬件电路之间的接口层,其目的在于将硬件抽象化。它隐藏了特定平台的硬件接口细节,为操作系统提供虚拟硬件平台,使其具有硬件无关性,可在多种平台上进行移植。从软硬件测试的角度来看,软硬件的测试工作都可分别基于硬件抽象层来完成,使得软硬件测试工作的并行进行成为可能。The hardware abstraction layer HAL is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on a variety of platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, which makes it possible to perform parallel testing of software and hardware.
本实施例中,所述HAL包括USB/DP Audio HAL、主音频(Primary Audio)HAL以及虚拟音频(Virtual Audio)HAL。其中,Virtual Audio HAL为新增的功能模块,所述Virtual Audio HAL可用于对接分布式虚拟音频设备,以及用于对接远端投屏音频输入输出设备。具体地,各个HAL模块的功能参见表2所示。In this embodiment, the HAL includes a USB/DP Audio HAL, a primary audio (Primary Audio) HAL, and a virtual audio (Virtual Audio) HAL. Among them, the Virtual Audio HAL is a newly added functional module, and the Virtual Audio HAL can be used for docking with distributed virtual audio devices, and for docking with remote screen projection audio input and output devices. Specifically, the functions of each HAL module are shown in Table 2.
表2Table 2
Figure PCTCN2022088205-appb-000003
Figure PCTCN2022088205-appb-000003
下面对本实施例提供的方法流程进行详细说明。The flow of the method provided in this embodiment will be described in detail below.
本申请实施例提供一种音频流播放方法,用于实现手机设备一对多投屏业务场景下,多端设备的投屏显示,以及音频并发发声和拾音。The embodiment of the present application provides an audio stream playback method, which is used to realize the screen projection display of multi-terminal devices, and the simultaneous sounding and pickup of audio in the scenario of a one-to-multiple screen projection service of a mobile phone device.
如图5所示,本实施例提供的一种音频播放方法,包括:As shown in FIG. 5, an audio playback method provided by this embodiment includes:
101:当终端设备启动投屏业务时,第一管理模块接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息,比如第一设备的标识、第一设备的设备名称等。101: When the terminal device starts the screencasting service, the first management module receives a first request sent by the screencasting service module, where the first request is used to request the creation of a virtual audio device, and the first request includes the user's desired screencasting related information of the first device, such as the identifier of the first device, the device name of the first device, and the like.
其中,所述第一管理模块为多屏音频管理模块,位于所述框架层,或者为所述Vendor音频扩展功能中新增功能模块。Wherein, the first management module is a multi-screen audio management module, located in the framework layer, or a new function module in the Vendor audio extension function.
102:所述第一管理模块向硬件抽象层HAL发送所述第一请求。102: The first management module sends the first request to the hardware abstraction layer HAL.
103:所述第一管理模块接收所述HAL发送的第一虚拟音频设备的设备标识,所述第一虚拟音频设备根据所述第一设备的相关信息创建。103: The first management module receives the device identifier of the first virtual audio device sent by the HAL, where the first virtual audio device is created according to the related information of the first device.
104:所述第一管理模块向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。104: The first management module sends the device identification of the first virtual audio device to the screen projection service module, so that the screen projection service module establishes a connection between the virtual display screen display and the first virtual audio device. binding relationship.
对应地,所述投屏业务模块接收该第一虚拟音频设备的设备标识,然后根据其获取的第一虚拟display,建立第一绑定关系,所述第一绑定关系为第一虚拟音频设备的设备标识和所述第一虚拟display之间的对应关系。Correspondingly, the screen projection service module receives the device identifier of the first virtual audio device, and then establishes a first binding relationship according to the acquired first virtual display, where the first binding relationship is the first virtual audio device The corresponding relationship between the device identifier and the first virtual display.
比如第一虚拟display为Virtual display0,所述第一虚拟音频设备的设备标识为Virtual Audio 0,则建立所述第一绑定关系为<Virtual display0,Virtual Audio 0>。For example, the first virtual display is Virtual display0, the device identifier of the first virtual audio device is Virtual Audio 0, and the first binding relationship is established as <Virtual display0, Virtual Audio 0>.
应理解,当有多个应用请求投屏时,则第一管理模块接收向HAL请求多个虚拟音频设备的设备标识,并为建立多个绑定关系,每个所述绑定关系包含一个虚拟display和一个虚拟音频设备之间的对应关系。It should be understood that when multiple applications request screen projection, the first management module receives the device identifiers requesting multiple virtual audio devices from the HAL, and establishes multiple binding relationships, each of which includes a virtual audio device. The correspondence between display and a virtual audio device.
另外,如图6所示,上述还包括:In addition, as shown in Figure 6, the above also includes:
105:第一管理模块接收所述投屏业务模块发送的所述第一绑定关系。105: The first management module receives the first binding relationship sent by the screen projection service module.
106:当第一应用请求播放音频流时,所述第一管理模块确定第一虚拟display。106: When the first application requests to play the audio stream, the first management module determines the first virtual display.
其中,所述第一应用具有音乐播放功能,比如
Figure PCTCN2022088205-appb-000004
APP。
Wherein, the first application has a music playback function, such as
Figure PCTCN2022088205-appb-000004
APP.
一种实施方式是,所述第一管理模块获取第一应用的标识,比如第一应用的包名,pid 等,然后向第二管理模块发送所述第一应用的标识。所述第二管理模块根据所述第一应用的标识查找第一应用所属的第一虚拟display,以及向所述第一管理模块发送所述第一虚拟display。所述第一管理模块接收所述第二管理模块根据所述第一应用的标识确定的所述第一虚拟display。In an implementation manner, the first management module acquires the identifier of the first application, such as the package name, pid, etc. of the first application, and then sends the identifier of the first application to the second management module. The second management module searches for the first virtual display to which the first application belongs according to the identifier of the first application, and sends the first virtual display to the first management module. The first management module receives the first virtual display determined by the second management module according to the identifier of the first application.
此外,在步骤106之后,所述方法还包括:In addition, after step 106, the method further includes:
所述第一管理模块根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应;查询所述第一音频焦点的状态是否可用;如果是,则向所述原生音频框架发送所述第一音频焦点。The first management module determines a first audio focus according to the first virtual display, and the first audio focus corresponds to the first virtual display; inquires whether the state of the first audio focus is available; if so, The first audio focus is then sent to the native audio framework.
如果查询所述第一音频焦点的状态不可用,则确定占用所述第一音频焦点的应用为第二应用;所述第一管理模块向所述原生音频框架发送第一指示信息,所述第一指示信息用于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;当接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。If the state of the first audio focus is not available, determine that the application occupying the first audio focus is the second application; the first management module sends first indication information to the native audio framework, and the first An indication message is used to notify the native audio framework that the first audio focus needs to be occupied by the first application; when receiving an indication that the second application stops using the first audio focus, send a notification to the native audio framework. The audio framework sends the first audio focus so that the first application acquires the first audio focus.
进一步地,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:所述第一管理模块获取第一虚拟display所关联的第一焦点管理记录,所述第一焦点管理记录中包括第一音频焦点的状态,其中所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点。Further, before the first management module inquires whether the state of the first audio focus is available, the method further includes: acquiring, by the first management module, a first focus management record associated with the first virtual display, the first focus The management record includes the state of the first audio focus, wherein the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
所述第一管理模块查询所述第一音频焦点的状态是否可用,包括:所述第一管理模块在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲。The first management module inquiring whether the state of the first audio focus is available includes: the first management module inquiring, in the first focus management record, whether the state of the first audio focus is idle.
107:所述第一管理模块根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识。107: The first management module searches for the device identifier of the first virtual audio device in the first binding relationship according to the first virtual display.
108:所述第一管理模块向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。108: The first management module sends the device identifier of the first virtual audio device to the native audio framework, so that the native audio framework outputs the corresponding audio stream to the first device through the first virtual audio device.
并且,上述方法还包括:所述第一管理模块按照虚拟display音频焦点机制维护所述第一焦点管理记录;In addition, the above method further includes: the first management module maintains the first focus management record according to the virtual display audio focus mechanism;
所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。The virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority according to the high priority service application Business applications, and business applications with the same priority follow the rule of applying for applications first and preempting applications later.
另外,还包括:每个虚拟display拥有独立的音频焦点,不同的虚拟display所对应的音频焦点相互独立,互补干扰。In addition, it also includes: each virtual display has an independent audio focus, and the audio focuses corresponding to different virtual displays are independent of each other and interfere with each other.
本实施例提供的方法,增强现有投屏场景音频输入输出能力,第一管理模块为每个请求投屏的设备建立虚拟display,并基于虚拟display配置独立虚拟音频输入输出设备,建立虚拟display与虚拟音频设备之间的绑定关系,使得虚拟display运行应用时,音频流跟随投屏端音频设备输入输出,实现一对多投屏场景下,每个投屏设备显示音频互相独立,互不干扰。The method provided by this embodiment enhances the audio input and output capability of the existing screen projection scene. The first management module establishes a virtual display for each device requesting screen projection, configures an independent virtual audio input and output device based on the virtual display, and establishes the virtual display and the virtual display. The binding relationship between the virtual audio devices enables the audio stream to follow the input and output of the audio device on the screen-casting end when the virtual display runs the application. In the one-to-many screen-casting scenario, the display audio of each screen-casting device is independent of each other and does not interfere with each other. .
另外,每个投屏设备运行应用播放声音,在当前投屏设备端发声,每个投屏设备显示运行应用录音可以使用当前投屏设备的录音功能进行录音,从而实现多任务音频设备并发发声和拾音。In addition, each screencasting device runs the application to play the sound, and makes a sound on the current screencasting device. The recording of each screencasting device running the application can be recorded by using the recording function of the current screencasting device, so as to realize the simultaneous sound and sound of the multitasking audio device. pickup.
另外,本实施例还提供了另一种音频播放方法,该方法可应用于第二管理模块,所述 第二管理模块为多屏管理模块,具体地,所述方法包括:In addition, this embodiment also provides another audio playback method, which can be applied to a second management module, where the second management module is a multi-screen management module. Specifically, the method includes:
第二管理模块接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,其中所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息;所述第二管理模块根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;以及,向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。The second management module receives a second request sent by the screen projection service module, where the second request is used to create a virtual display for screen projection, wherein the second request includes: specifying the name, size and resolution information of the virtual display; The second management module creates a first virtual display according to the specified virtual display name, size and resolution information; and sends the first virtual display to the screen projection service module, so that the virtual screen projection service module A first binding relationship between the first virtual display and the first virtual audio device is established.
此外,上述方法还包括:第二管理模块接收所述投屏业务模块发送的所述第一绑定关系,并向所述第一管理模块发送所述第一绑定关系。In addition, the above method further includes: the second management module receives the first binding relationship sent by the screen projection service module, and sends the first binding relationship to the first management module.
其中,在一种可能的实施方式中,所述第二管理模块获取第一应用的标识,包括:所述第二管理模块在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。Wherein, in a possible implementation manner, acquiring the identifier of the first application by the second management module includes: the second management module receives the first management module when the first application requests to apply for audio focus The audio focus request sent by the module includes the identifier of the first application.
本实施例,构建以虚拟display为中心音频焦点管控机制,为每一个虚拟display分配焦点,基于应用所在虚拟display进行音频焦点抢占管理,支持不同虚拟display应用音频焦点共存和音频播放并发管理。This embodiment builds an audio focus control mechanism centered on a virtual display, assigns a focus to each virtual display, performs audio focus preemption management based on the virtual display where the application is located, and supports coexistence of audio focus and concurrent management of audio playback for different virtual display applications.
可选的,在另一种可能的实施方式中,所述第二管理模块获取第一应用的标识,包括:所述第二管理模块在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。Optionally, in another possible implementation manner, the second management module acquiring the identifier of the first application includes: when the second management module acquires the audio stream played by the first application when the native audio framework acquires , receiving the identifier of the first application sent by the first management module.
另外,对于投屏业务模块来说,本实施例提供的音频播放方法,包括:In addition, for the screen projection service module, the audio playback method provided by this embodiment includes:
所述投屏业务模块在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;所述投屏业务模块在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息。The screen projection service module acquires the first virtual display screen display created by the second management module when acquiring the user's operation of starting the screen projection service; the screen projection service module establishes a virtual audio link with the first device that expects screen projection After the route is completed, a first request is sent to the first management module, where the first request is used to request the creation of a virtual audio device, and the first request includes relevant information of the first device on which the user wishes to project the screen.
所述投屏业务模块接收所述第一管理模块发送的第一虚拟音频设备的设备标识;所述投屏业务模块建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;以及向所述第一管理模块发送所述第一绑定关系。The screen projection service module receives the device identifier of the first virtual audio device sent by the first management module; the screen projection service module establishes a first binding relationship, and the first binding relationship includes the first virtual audio device. display the corresponding relationship between the device identifier of the first virtual audio device; and send the first binding relationship to the first management module.
其中,所述获取第二管理模块创建的第一虚拟显示屏display,包括:所述投屏业务模块向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;所述投屏业务模块接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。The acquiring the first virtual display screen display created by the second management module includes: the screen projection service module sends a second request to the second management module, where the second request is used to request the second The management module creates a virtual display; the screen projection service module receives the first virtual display created by the second management module according to the second request.
当结束投屏业务时,方法还包括:当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;所述投屏业务模块向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。具体地,通过第一管理模块删除第一虚拟音频设备,以及通过所述HAL删除该第一虚拟音频设备。When the screen-casting service is ended, the method further includes: when the user's operation of disconnecting the screen-casting service is obtained, releasing the first binding relationship between the device identifiers of the first virtual display and the first virtual audio device; The screen projection service module sends a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship. Specifically, the first virtual audio device is deleted through the first management module, and the first virtual audio device is deleted through the HAL.
下面结合具体例子对上述实施例提供的方法进行详细说明。The methods provided by the above embodiments will be described in detail below with reference to specific examples.
参见图7,本实施例提供的音频播放系统中包括一个源设备和两个投屏设备,其中所述源设备为手机100,投屏设备包括第一设备和第二设备。可选的,所述第一设备为智慧屏200所述第二设备为平板300,下面以手机100和智慧屏200为例,介绍源设备到投屏 设备的投屏过程,以及建立投屏连接后音频流从手机100传输至智慧屏200的方法流程。Referring to FIG. 7 , the audio playback system provided in this embodiment includes one source device and two screen projection devices, wherein the source device is a mobile phone 100 , and the screen projection device includes a first device and a second device. Optionally, the first device is the smart screen 200 and the second device is the tablet 300. The following takes the mobile phone 100 and the smart screen 200 as examples to introduce the screen casting process from the source device to the screen casting device, and the establishment of the screen casting connection. The method flow of the post audio stream is transmitted from the mobile phone 100 to the smart screen 200 .
具体地,参见图8,本方法包括以下三部分流程,第一部分流程概括为:启动投屏流程,该流程是播放音频前的准备阶段,包括步骤S1至S4,主要目的是建立虚拟display与虚拟音频设备之间的一对一绑定关系。Specifically, referring to FIG. 8 , the method includes the following three parts of the process. The first part of the process is summarized as: start the screen projection process, which is a preparation stage before playing audio, including steps S1 to S4, the main purpose is to establish virtual display and virtual display. A one-to-one binding relationship between audio devices.
第二部分流程为:音频焦点的申请和抢占。包括步骤S5至S6,因为在源设备播放音频流之前,需要先获得一个音频焦点,每个虚拟display可以提供一个音频焦点,当有两个或两个以上应用在申请同一个虚拟display的音频焦点时,则会发生音频焦点抢占,此时可以遵循虚拟display音频焦点机制为请求的应用提供音频焦点。The second part of the process is: application and preemption of audio focus. Including steps S5 to S6, because before the source device plays the audio stream, it needs to obtain an audio focus, and each virtual display can provide an audio focus. When two or more applications apply for the audio focus of the same virtual display When the audio focus is preempted, the audio focus can be provided for the requested application by following the virtual display audio focus mechanism.
第三部分流程为:根据分流策略向应用对应的虚拟音频设备传输音频流,从而实现从源设备到投屏设备的音频传输和播放,主要包括步骤S7和S8。The third part of the process is: according to the streaming strategy, the audio stream is transmitted to the virtual audio device corresponding to the application, so as to realize the audio transmission and playback from the source device to the screen projection device, which mainly includes steps S7 and S8.
其中,这三部分流程可以按顺序执行,或者第一部分流程和第二部分流程同时执行,本实施例对此不予限制。The three parts of the process may be executed in sequence, or the first part of the process and the second part of the process may be executed simultaneously, which is not limited in this embodiment.
其中,如图5所示,涉及的功能模块包括:手机100的投屏业务模块10、第一管理模块21、第二管理模块22和虚拟音频HAL 30。投屏业务模块10位于应用层中,第一管理模块21位于原生音频框架20中,第二管理模块位于多屏管理模块中,所述原生音频框架20和多屏管理模块位于框架层,所述虚拟音频HAL 30位于硬件层。Among them, as shown in FIG. 5 , the involved functional modules include: the screen projection service module 10 of the mobile phone 100 , the first management module 21 , the second management module 22 and the virtual audio HAL 30 . The screen projection service module 10 is located in the application layer, the first management module 21 is located in the native audio framework 20, the second management module is located in the multi-screen management module, and the native audio framework 20 and the multi-screen management module are located in the framework layer. The virtual audio HAL 30 is located at the hardware layer.
可选的,在一种可能的实施方式中,所述投屏业务模块10为一个Android应用程序包(Android application package,APK)。此外,还可以包括其他应用比如,第一应用11和第二应用12,并且所述第一应用11和第二应用12具有音频播放功能。Optionally, in a possible implementation manner, the screen projection service module 10 is an Android application package (Android application package, APK). In addition, other applications such as the first application 11 and the second application 12 may also be included, and the first application 11 and the second application 12 have an audio playback function.
可选的,在另一种可能的实施方式中,所述投屏业务模块10也可以位于框架层,与应用层的投屏业务应用相关联,用于执行投屏业务应用的相关进程。Optionally, in another possible implementation manner, the screen projection service module 10 may also be located in the framework layer, is associated with the screen projection service application of the application layer, and is used for executing the relevant process of the screen projection service application.
可选的,所述第一管理模块21为一种多屏音频管理模块,所述第二管理模块22为一种多屏管理模块。Optionally, the first management module 21 is a multi-screen audio management module, and the second management module 22 is a multi-screen management module.
下面对各个部分的方法流程做详细介绍。The method flow of each part is described in detail below.
首先,在准备阶段,第一部分流程:启动投屏流程,如图8所示,具体包括:First, in the preparation stage, the first part of the process: start the screen projection process, as shown in Figure 8, which includes:
S1:用户在终端设备上启动投屏业务。S1: The user starts the screen projection service on the terminal device.
具体地,用户通过投屏对应入口启动投屏。例如用户在手机100上点击投屏业务应用,启动在第一设备上的投屏操作,所述第一设备为智慧屏200。Specifically, the user starts the screencasting through the corresponding portal of the screencasting. For example, the user clicks on the screen casting service application on the mobile phone 100 to start the screen casting operation on the first device, where the first device is the smart screen 200 .
S2:建立所述终端设备与所述第一设备之间的第一通信链路。S2: Establish a first communication link between the terminal device and the first device.
其中,所述终端设备与所述第一设备之间可以通过USB或WiFi等方式建立所述第一通信链路。Wherein, the first communication link may be established between the terminal device and the first device by means of USB or WiFi.
具体地,手机100接收用户的启动投屏业务的操作后,与智慧屏200之间建立第一通信链路。一种实施方式是,Specifically, after receiving the user's operation of starting the screen projection service, the mobile phone 100 establishes a first communication link with the smart screen 200 . One implementation is,
S2-1:投屏业务模块10向智慧屏200发送第一消息,所述第一消息用于与手机100建立第一通信链路。具体地,所述投屏业务模块10通过无线资源控制(Radio Resource Control,RRC)信令向智慧屏200发送所述第一消息。所述第一消息中包括手机100标识、手机设备名称、连接请求等信息。S2-1: The screen projection service module 10 sends a first message to the smart screen 200, where the first message is used to establish a first communication link with the mobile phone 100. Specifically, the screen projection service module 10 sends the first message to the smart screen 200 through radio resource control (Radio Resource Control, RRC) signaling. The first message includes information such as the identification of the mobile phone 100, the name of the mobile phone device, and the connection request.
S2-2:智慧屏200接收所述第一消息后,向所述手机100发送第一响应消息。S2-2: After receiving the first message, the smart screen 200 sends a first response message to the mobile phone 100.
其中,所述第一响应消息中包括:手机100标识、手机设备名称、智慧屏200的相关 能力(尺寸、分辨率、支持视频编码)、音频相关能力,比如是否支持Speaker或Mic能力,支持采样率、位宽等,以及相关连接认证信息。Wherein, the first response message includes: mobile phone 100 identification, mobile phone device name, related capabilities of the smart screen 200 (size, resolution, support for video coding), audio related capabilities, such as whether to support Speaker or Mic capabilities, support sampling rate, bit width, etc., and related connection authentication information.
可选的,所述第一响应消息为RRC消息。具体地,智慧屏200将所述RRC消息发送给手机100的应用层。Optionally, the first response message is an RRC message. Specifically, the smart screen 200 sends the RRC message to the application layer of the mobile phone 100 .
S2-3:手机100的应用层(比如投屏业务模块10)接收所述第一响应消息,确定发送该第一响应消息的端设备是智慧屏200,建立与智慧屏200之间的第一通信链路。S2-3: The application layer of the mobile phone 100 (for example, the screen projection service module 10 ) receives the first response message, determines that the terminal device sending the first response message is the smart screen 200 , and establishes the first response message with the smart screen 200 . communication link.
投屏业务模块10根据场景选择通过USB或WiFi等方式连接所述智慧屏200,建立所述第一通信链路。The screen projection service module 10 selects to connect to the smart screen 200 by means of USB or WiFi according to the scenario, and establishes the first communication link.
S3:手机100与所述第一设备之间建立虚拟音频设备链路。S3: A virtual audio device link is established between the mobile phone 100 and the first device.
S4:手机100建立第一虚拟display和第一虚拟音频设备的设备标识之间的第一绑定关系。S4: The mobile phone 100 establishes a first binding relationship between the first virtual display and the device identifier of the first virtual audio device.
其中,如图9所示,在步骤S2之后,所述方法包括:Wherein, as shown in Figure 9, after step S2, the method includes:
S2’:投屏业务模块10请求所述第二管理模块22创建投屏虚拟display。S2': The screen projection service module 10 requests the second management module 22 to create a screen projection virtual display.
具体地,当手机100与智慧屏200之间建立完成第一通信链路后,手机100的投屏业务模块10向第二管理模块22发送第二请求,所述第二请求用于创建与投屏关联的虚拟display。所述第二请求中包括;虚拟display名称、大小以及分辨率信息等。Specifically, after the first communication link is established between the mobile phone 100 and the smart screen 200, the screen projection service module 10 of the mobile phone 100 sends a second request to the second management module 22, and the second request is used for creating and casting The virtual display associated with the screen. The second request includes: virtual display name, size, and resolution information.
一种实施方式包括:投屏业务模块10调用第二管理模块22的接口,并发送虚拟display名称、大小以及分辨率信息,创建投屏关联的虚拟display,并且将该虚拟display作为投屏显示源。One embodiment includes: the screen-casting service module 10 calls the interface of the second management module 22, and sends the virtual display name, size and resolution information, creates a virtual display associated with screencasting, and uses the virtual display as the screencasting display source. .
第二管理模块22接收所述第二请求,根据所述第二请求中携带的信息创建第一虚拟display,比如虚拟display 0。并且,将所述第一虚拟display发送给投屏业务模块10。The second management module 22 receives the second request, and creates a first virtual display, such as virtual display 0, according to the information carried in the second request. And, the first virtual display is sent to the screen projection service module 10 .
投屏业务模块10接收第二管理模块22发送的所述第一虚拟display,并利用该第一虚拟display与所述智慧屏200创建第二通信链路。所述第二通信链路为一虚拟音频设备链路。The screen projection service module 10 receives the first virtual display sent by the second management module 22, and uses the first virtual display to create a second communication link with the smart screen 200. The second communication link is a virtual audio device link.
具体地,一种实施方式包括:投屏业务模块10向智慧屏200发送请求消息,用于请求与所述智慧屏200建立第二通信链路。智慧屏200接收投屏业务模块10发送的请求消息后,向投屏业务模块10发送反馈结果,所述反馈结果中指示所述第二通信链路是否创建成功。其中,所述反馈结果中包括:指定音频设备类型、设备ID以及音频通路接入信息。Specifically, an implementation manner includes: the screen projection service module 10 sends a request message to the smart screen 200 for requesting to establish a second communication link with the smart screen 200 . After receiving the request message sent by the screen projection service module 10, the smart screen 200 sends a feedback result to the screen projection service module 10, where the feedback result indicates whether the second communication link is successfully created. Wherein, the feedback result includes: specified audio device type, device ID and audio channel access information.
对应地,所述投屏业务模块10接收所述反馈结果,当所述反馈结果中指示创建成功时,手机100与智慧屏200建立所述第二通信链路。Correspondingly, the screen projection service module 10 receives the feedback result, and when the feedback result indicates that the creation is successful, the mobile phone 100 and the smart screen 200 establish the second communication link.
参见图9,上述步骤S4具体包括:Referring to Figure 9, the above step S4 specifically includes:
S4-1:当与智慧屏200成功建立所述第二通信链路后,投屏业务模块10向第一管理模块21发送第一请求,所述第一请求用于请求创建虚拟音频设备。相应的,第一管理模块21接收所述投屏业务模块10发送的第一请求。S4-1: After successfully establishing the second communication link with the smart screen 200, the screen projection service module 10 sends a first request to the first management module 21, where the first request is used to request the creation of a virtual audio device. Correspondingly, the first management module 21 receives the first request sent by the screen projection service module 10 .
其中,所述第一请求中包括指定音频设备类型、手机100的设备ID以及音频通路接入信息,所述接入信息包括USB或WiFi等。The first request includes the specified audio device type, the device ID of the mobile phone 100, and audio channel access information, where the access information includes USB or WiFi.
S4-2:第一管理模块21收到所述第一请求后,向虚拟音频HAL 30发送所述第一请求。相应的,虚拟音频HAL 30接收所述第一管理模块21转发的第一请求。S4-2: After receiving the first request, the first management module 21 sends the first request to the virtual audio HAL 30. Correspondingly, the virtual audio HAL 30 receives the first request forwarded by the first management module 21.
S4-3:虚拟音频HAL 30通过手机100和智慧屏200之间的虚拟音频设备链路创建关 联的虚拟音频设备(audio device),确定所述虚拟音频设备的设备标识,比如确定所述虚拟音频设备为第一虚拟音频设备,则该虚拟音频设备的设备标识的设备标识为第一虚拟音频设备的设备标识,比如audio device 0。S4-3: The virtual audio HAL 30 creates an associated virtual audio device (audio device) through the virtual audio device link between the mobile phone 100 and the smart screen 200, and determines the device identifier of the virtual audio device, such as determining the virtual audio device If the device is the first virtual audio device, the device identifier of the device identifier of the virtual audio device is the device identifier of the first virtual audio device, such as audio device 0.
具体地,虚拟音频HAL 30为手机100和智慧屏200会话链路创建关联的虚拟音频设备,并生成虚拟音频的设备标识,虚拟音频设备对象包含虚拟音频的类型,设备ID以及音频通路接入信息等。Specifically, the virtual audio HAL 30 creates an associated virtual audio device for the session link between the mobile phone 100 and the smart screen 200, and generates a virtual audio device identifier. The virtual audio device object includes the virtual audio type, device ID and audio path access information Wait.
S4-4:虚拟音频HAL 30向所述第一管理模块21发送创建虚拟音频设备(VirtualAudio)的设备标识,即所述第一虚拟音频设备的设备标识。S4-4: The virtual audio HAL 30 sends to the first management module 21 a device identifier for creating a virtual audio device (VirtualAudio), that is, the device identifier of the first virtual audio device.
S4-5:第一管理模块21收到所述虚拟音频设备的设备标识后,向所述投屏业务模块10发送该虚拟音频设备的设备标识。S4-5: After receiving the device identifier of the virtual audio device, the first management module 21 sends the device identifier of the virtual audio device to the screen projection service module 10.
可选的,第一管理模块21通过指令或者消息发送所述虚拟音频设备的设备标识。Optionally, the first management module 21 sends the device identifier of the virtual audio device through an instruction or a message.
S4-6:投屏业务模块10接收所述虚拟音频设备的设备标识,并建立所述虚拟音频设备(Virtual Audio)的设备标识和第一虚拟display之间的绑定关系。其中,所述第一虚拟display由前述S2’中获得。S4-6: The screen projection service module 10 receives the device identifier of the virtual audio device, and establishes a binding relationship between the device identifier of the virtual audio device (Virtual Audio) and the first virtual display. Wherein, the first virtual display is obtained from the aforementioned S2'.
具体地,投屏业务模块10将第一虚拟display与新创建的所述虚拟音频设备的设备标识绑定,即为虚拟display配置一个虚拟音频设备,建立虚拟display对应虚拟音频设备的一对一绑定关系。参见表3所示,为建立的第一虚拟显示屏(Virtual display 0)与第一虚拟音频设备(Virtual Audio 0)的设备标识之间的第一绑定关系。Specifically, the screen projection service module 10 binds the first virtual display with the device identifier of the newly created virtual audio device, that is, configures a virtual audio device for the virtual display, and establishes a one-to-one binding between the virtual display and the virtual audio device established relationship. Referring to Table 3, it is the first binding relationship between the established first virtual display screen (Virtual display 0) and the device identifier of the first virtual audio device (Virtual Audio 0).
表3table 3
Figure PCTCN2022088205-appb-000005
Figure PCTCN2022088205-appb-000005
S4-7:投屏业务模块10将所述绑定关系发送给第二管理模块22,所述第二管理模块22接收后又将该绑定关系发送给第一管理模块21。S4-7: The screen projection service module 10 sends the binding relationship to the second management module 22, and the second management module 22 sends the binding relationship to the first management module 21 after receiving the binding relationship.
S4-8:第一管理模块21接收该绑定关系,并维护和存储。S4-8: The first management module 21 receives the binding relationship, and maintains and stores it.
本实施例中,手机100投屏智慧屏200,投屏业务模块10为智慧屏200创建虚拟display,投屏业务模块10将虚拟display与虚拟音频设备之间的绑定关系通知给第一管理模块21,使得第一管理模块21维护虚拟display与虚拟音频设备之间的绑定关系,用于后续为多屏音频焦点管理和音频流对应音频设备选择提供依据。In this embodiment, the mobile phone 100 mirrors the smart screen 200, the mirroring service module 10 creates a virtual display for the smart screen 200, and the mirroring service module 10 notifies the first management module of the binding relationship between the virtual display and the virtual audio device 21 , enabling the first management module 21 to maintain the binding relationship between the virtual display and the virtual audio device, so as to provide a basis for subsequent multi-screen audio focus management and selection of audio devices corresponding to audio streams.
另外,本实施例还提供了一种断开投屏连接的方法,手机100收到断开投屏请求操作,投屏业务模块需要解除所述虚拟display和创建的虚拟音频设备之间的绑定关系,如图10所示,具体流程如下:In addition, this embodiment also provides a method for disconnecting the screencasting connection. When the mobile phone 100 receives an operation of disconnecting the screencasting request, the screencasting service module needs to release the binding between the virtual display and the created virtual audio device. relationship, as shown in Figure 10, the specific process is as follows:
201:用户通过投屏业务应用启动断开投屏业务。201: The user initiates and disconnects the screencasting service through the screencasting service application.
具体地,所述用户在手机100上点击投屏业务界面,断开与智慧屏200的投屏连接。Specifically, the user clicks the screen projection service interface on the mobile phone 100 to disconnect the screen projection connection with the smart screen 200 .
202:投屏业务模块10接收到用户断开投屏操作后向多屏管理模块发送第一指令,所述第一指令用于请求断开智慧屏200关联的虚拟display,所述第一指令中包括智慧屏200标识信息。202: The screen projection service module 10 sends a first instruction to the multi-screen management module after receiving the user's disconnection of the screen projection operation, where the first instruction is used to request to disconnect the virtual display associated with the smart screen 200, and the first instruction includes: Including smart screen 200 identification information.
其中,所述多屏管理模块为前述图4所示的多屏管理模块,或者是图7所示的第二管 理模块22,本实施例以第二管理模块22举例。Wherein, the multi-screen management module is the aforementioned multi-screen management module shown in FIG. 4 , or the second management module 22 shown in FIG. 7 , and the second management module 22 is used as an example in this embodiment.
202:第二管理模块22接收所述第一指令,根据所述第一指令中携带的智慧屏200标识信息查找对应虚拟display。202: The second management module 22 receives the first instruction, and searches for the corresponding virtual display according to the identification information of the smart screen 200 carried in the first instruction.
本实施例中,假设第二管理模块22查找到的虚拟display为第一虚拟display。In this embodiment, it is assumed that the virtual display found by the second management module 22 is the first virtual display.
203:第二管理模块22查找到第一虚拟display后解除第一绑定关系,所述第一绑定关系为第一虚拟display和第一虚拟音频设备的设备标识之间的对应关系。203 : The second management module 22 releases the first binding relationship after finding the first virtual display, where the first binding relationship is a corresponding relationship between the first virtual display and the device identifiers of the first virtual audio device.
204:第二管理模块22向第一管理模块21发送第二指令,所述第二指令中包括:显示屏200对应虚拟display标识(即第一虚拟display)、智慧屏200标识等信息。相应的,第一管理模块21接收所述第二管理模块22发送所述第二指令。204: The second management module 22 sends a second instruction to the first management module 21, where the second instruction includes: the display screen 200 corresponds to the virtual display identifier (ie the first virtual display), the smart screen 200 identifier and other information. Correspondingly, the first management module 21 receives the second instruction sent by the second management module 22 .
205:第一管理模块21根据所述第二指令中携带的虚拟display标识查找该虚拟display与虚拟音频设备之间的绑定关系记录,查找到所述绑定关系记录后,第一管理模块21清除所述绑定关系记录中的绑定关系。205: The first management module 21 searches the binding relationship record between the virtual display and the virtual audio device according to the virtual display identifier carried in the second instruction, and after finding the binding relationship record, the first management module 21 Clear the binding relationship in the binding relationship record.
本示例中,第一管理模块21根据所述第一虚拟display查找到第一绑定关系,然后解除所述第一绑定关系中第一虚拟display和第一虚拟音频设备的设备标识之间的对应关系。In this example, the first management module 21 finds a first binding relationship according to the first virtual display, and then releases the device identification between the first virtual display and the first virtual audio device in the first binding relationship. Correspondence.
206:投屏业务模块10向所述第一管理模块21发送第三指令,所述第三指令用于通知第一管理模块21删除智慧屏200对应虚拟音频设备。其中,所述第三指令中包括智慧屏200标识信息,第一虚拟音频设备的设备标识等信息。206: The screen projection service module 10 sends a third instruction to the first management module 21, where the third instruction is used to notify the first management module 21 to delete the virtual audio device corresponding to the smart screen 200. The third instruction includes information such as the identification information of the smart screen 200, the device identification of the first virtual audio device, and the like.
207:第一管理模块21收到所述第三指令后,向虚拟音频HAL30发送该第三指令,用于通知所述虚拟音频HAL 30删除与智慧屏200对应的第一虚拟音频设备。207: After receiving the third instruction, the first management module 21 sends the third instruction to the virtual audio HAL 30 to notify the virtual audio HAL 30 to delete the first virtual audio device corresponding to the smart screen 200.
208:虚拟音频HAL 30接收所述第三指令,根据所述第三指令中携带第一虚拟音频设备的设备标识等信息断开智慧屏200与所述第一虚拟音频设备之间的关系,并删除所述第一虚拟音频设备的信息。208: The virtual audio HAL 30 receives the third instruction, disconnects the relationship between the smart screen 200 and the first virtual audio equipment according to the information such as the device identification of the first virtual audio equipment carried in the third instruction, and Delete the information of the first virtual audio device.
209:投屏业务模块10断开与智慧屏200之间的通信链路。209: The screen projection service module 10 disconnects the communication link with the smart screen 200.
具体地,投屏业务模块10向智慧屏200发送断开请求,所述断开请求用于断开与手机100与智慧屏200之间的所述第一通信链路。智慧屏200接收所述断开请求后,断开所述第一通信链路。Specifically, the screen projection service module 10 sends a disconnection request to the smart screen 200 , where the disconnection request is used to disconnect the first communication link with the mobile phone 100 and the smart screen 200 . After receiving the disconnection request, the smart screen 200 disconnects the first communication link.
此外,上述方法还包括第一管理模块21和第二管理模块22更新上述表3所示的绑定关系,释放所述第一虚拟display。In addition, the above method further includes that the first management module 21 and the second management module 22 update the binding relationship shown in Table 3 above, and release the first virtual display.
本实施例提供的了一种断开投屏连接的方法,当源设备与投屏设备之间不需要维持投屏连接时,通过第一管理模块和第二管理模块接触虚拟display和虚拟音频设备之间的绑定关系,从而释放虚拟display,为后续与其他投屏设备建立连接提供方便,This embodiment provides a method for disconnecting the screen projection connection. When the screen projection connection does not need to be maintained between the source device and the screen projection device, the first management module and the second management module contact the virtual display and the virtual audio device. The binding relationship between them, thereby releasing the virtual display and providing convenience for the subsequent establishment of connections with other screen projection devices,
另外,在投屏业务模块10建立所述第一绑定关系后,按照上述步骤S1至S4,针对手机投屏多个设备场景,多屏音频管理模块会在内部维护多个虚拟display与虚拟音频设备之间的绑定关系,不同虚拟display的应用播放音频功能会基于Android音频焦点机制设计开发。本实施例提供基于虚拟display的音频焦点机制,对应用无感知,应用APP不需要代码修改。In addition, after the screen projection service module 10 establishes the first binding relationship, according to the above steps S1 to S4, the multi-screen audio management module will internally maintain multiple virtual displays and virtual audios for multiple device scenarios of mobile phone screen projection. The binding relationship between devices, and the audio playback function of applications of different virtual displays will be designed and developed based on the Android audio focus mechanism. This embodiment provides an audio focus mechanism based on virtual display, which is unaware of the application, and the application APP does not need code modification.
此外,基于虚拟display的音频焦点方案,多屏音频管理模块在表3所示基础上还为每一个虚拟display提供一个焦点管理记录,用于记录当前虚拟display音频焦点状态(Audio Focus State)、占用音频焦点的应用(Owner)以及申请音频焦点应用栈(APP Stack)。其 中,所述虚拟display音频焦点状态包括:使用(Used)和空闲(Idle)两种状态。具体地,如表4所示,In addition, based on the audio focus solution of the virtual display, the multi-screen audio management module also provides a focus management record for each virtual display on the basis of Table 3, which is used to record the current virtual display audio focus state (Audio Focus State), occupation Audio focus application (Owner) and apply for audio focus application stack (APP Stack). Wherein, the virtual display audio focus state includes two states: used (Used) and idle (Idle). Specifically, as shown in Table 4,
表4Table 4
Figure PCTCN2022088205-appb-000006
Figure PCTCN2022088205-appb-000006
表4中记录了虚拟音频焦点的状态和占用者,为后续音频焦点的抢占和音频流的分配提供依据。The status and occupants of the virtual audio focus are recorded in Table 4, which provides a basis for subsequent audio focus preemption and audio stream allocation.
在第一部分流程的准备阶段完成后,执行第二部分流程,第二部分流程为:基于虚拟display的音频焦点抢占流程。如图8所示,第二部分流程概括为:After the preparation stage of the first part of the process is completed, the second part of the process is executed, and the second part of the process is: a virtual display-based audio focus preemption process. As shown in Figure 8, the second part of the process is summarized as:
S5:用户启动第一应用播放音频操作,所述第一应用具有音频播放功能,比如QQ音乐。S5: The user starts the first application to play an audio operation, and the first application has an audio playing function, such as QQ Music.
S6:手机终端根据用户的操作申请音频焦点,并获取第一音频焦点。其中所述第一音频焦点唯一对应第一虚拟display。S6: The mobile terminal applies for the audio focus according to the user's operation, and acquires the first audio focus. The first audio focus uniquely corresponds to the first virtual display.
该流程在手机连接多设备场景下,提供一种应用播放音频焦点的抢占机制,该机制为每个虚拟display维护一个焦点管理记录,用于记录当前虚拟display是否有可以为应用提供使用的音频焦点,以及各个应用当前申请的音频焦点信息。This process provides a preemption mechanism for the application to play audio focus in the scenario where the mobile phone is connected to multiple devices. This mechanism maintains a focus management record for each virtual display to record whether the current virtual display has audio focus that can be used by the application. , and the audio focus information currently applied by each application.
如上图11所示,应用层的一个应用向框架层的AudioManager申请音频焦点,MediaFocusControl根据申请应用归属虚拟display向多屏音频管理模块查找,判断对应虚拟display运行的应用申请的焦点是否可用,如果可用,则返回申请应用音频焦点;如果不可用,即焦点被其他应用使用,则抢占当前正在使用的应用音频焦点,返回申请应用可用的音频焦点,同时通知被抢占的应用失去音频焦点。As shown in Figure 11 above, an application in the application layer applies to the AudioManager of the framework layer for audio focus, and MediaFocusControl searches the multi-screen audio management module according to the virtual display that the application application belongs to, and determines whether the focus applied by the application running on the corresponding virtual display is available. , it returns to apply for the audio focus of the application; if it is unavailable, that is, the focus is used by other applications, it will preempt the audio focus of the application currently in use, return the audio focus available to the application application, and notify the preempted application of losing the audio focus.
基于虚拟display音频焦点机制如下:The audio focus mechanism based on virtual display is as follows:
第一、每个虚拟display拥有独立的音频焦点,不同虚拟display所拥有的音频焦点之间相互独立、互不干扰。First, each virtual display has an independent audio focus, and the audio focuses owned by different virtual displays are independent of each other and do not interfere with each other.
第二、如果在同一个虚拟display中有两个或两个以上应用,且两个或两个以上应用同时申请音频焦点时,遵循现有Android音频焦点抢占机制,即高优先级业务应用抢占低优先级业务的应用,对于同等优先级的业务应用遵循后申请应用抢占优先的规则。Second, if there are two or more applications in the same virtual display, and two or more applications apply for audio focus at the same time, follow the existing Android audio focus preemption mechanism, that is, high-priority business applications preempt low For the applications of priority services, the rules of application preemption after application are followed for service applications of the same priority.
如图12所示,应用申请音频焦点,以及在发生音频焦点抢占情况下,该应用获取音频焦点的流程说明如下:As shown in Figure 12, the application applies for audio focus, and in the case of audio focus preemption, the process for the application to acquire audio focus is as follows:
步骤S5至步骤S6为第一应用申请音频焦点的过程,具体包括:Steps S5 to S6 are the process for the first application to apply for audio focus, which specifically includes:
S5:接收用户启动第一应用播放音乐的操作。S5: Receive an operation that the user starts the first application to play music.
具体地,用户在手机100上打开第一应用播放音频,所述第一应用为一种音乐播放APP,比如
Figure PCTCN2022088205-appb-000007
且该第一应用对应前述第一部分流程中建立的一个虚拟display标识,比如虚拟display 0。
Specifically, the user opens a first application on the mobile phone 100 to play audio, and the first application is a music playing APP, such as
Figure PCTCN2022088205-appb-000007
And the first application corresponds to a virtual display identifier established in the foregoing first part of the process, such as virtual display 0.
S6-1:所述第一应用播放音频之前通过Android音频焦点申请接口向原生音频框架20申请音频焦点。S6-1: Before the first application plays audio, it applies to the native audio framework 20 for audio focus through the Android audio focus application interface.
一种实现方式是,第一应用向原生音频框架20发送一个请求,用于请求申请音频焦点。所述请求中包括:Android音频焦点请求消息、音频类型等。该请求的音频焦点用于为第一应用播放音频流。An implementation manner is that the first application sends a request to the native audio framework 20 for requesting to apply for audio focus. The request includes: Android audio focus request message, audio type, and the like. The requested audio focus is used to play the audio stream for the first application.
可选的,所述原生音频框架20为AOSP原生音频框架。Optionally, the native audio framework 20 is an AOSP native audio framework.
S6-2:原生音频框架20接收所述申请音频焦点的请求后,向第一管理模块21发送该申请音频焦点的请求,该请求中包括:Android音频焦点请求消息、音频类型、以及第一应用的相关信息等,所述第一应用的相关信息包括但不限于第一应用当前启动运行的进程id(process id,pid)、包名等。S6-2: After receiving the request for applying for audio focus, the native audio framework 20 sends the request for applying for audio focus to the first management module 21, where the request includes: Android audio focus request message, audio type, and the first application The relevant information of the first application, etc., the relevant information of the first application includes but is not limited to the process id (process id, pid), package name, etc. that the first application currently starts and runs.
S6-3:第一管理模块21接收所述请求后向第二管理模块22发送该申请音频焦点的请求,所述请求用于查询第一应用所在的虚拟display信息,所述请求中包括所述第一应用的相关信息,比如pid、第一应用的包名等。S6-3: After receiving the request, the first management module 21 sends the request for applying for audio focus to the second management module 22, where the request is used to query the virtual display information where the first application is located, and the request includes the Relevant information of the first application, such as pid, package name of the first application, and the like.
S6-4:第二管理模块22接收所述请求后,根据该请求中的所述第一应用的相关信息查询第一应用所对应的虚拟display标识。S6-4: After receiving the request, the second management module 22 queries the virtual display identifier corresponding to the first application according to the relevant information of the first application in the request.
比如,第一应用为应用A或APP1,根据表5所示的对应关系确定应用A所对应的虚拟display标识为Virtual display 0。For example, if the first application is application A or APP1, according to the corresponding relationship shown in Table 5, it is determined that the virtual display identifier corresponding to application A is Virtual display 0.
表5table 5
智慧屏200 Smart screen 200 Virtual display0Virtual display0 Virtual Audio 0Virtual Audio 0 Idle空闲Idle idle   
S6-5:第二管理模块22向第一管理模块21发送所述查找的虚拟display标识。S6-5: The second management module 22 sends the searched virtual display identifier to the first management module 21.
具体地,第二管理模块22通过响应消息携带所述查找的虚拟display标识,即所述响应消息中包括:第一应用所对应的虚拟display标识(Virtual display 0)。Specifically, the second management module 22 carries the searched virtual display identifier through the response message, that is, the response message includes: the virtual display identifier (Virtual display 0) corresponding to the first application.
S6-6:第一管理模块21接收所述虚拟display标识,并根据上述表4或表5维护的虚拟display与虚拟音频设备的关系表中查找所述虚拟display的记录,判断该虚拟display记录中的音频焦点的状态是否可用,或者换言之是否有其他应用使用该音频焦点。S6-6: The first management module 21 receives the virtual display identifier, searches for the virtual display record in the relationship table between the virtual display and the virtual audio device maintained in Table 4 or Table 5, and determines that the virtual display record is in the virtual display record. Whether the state of the audio focus is available, or in other words whether other applications use the audio focus.
本示例中,Virtual display0所对应的音频焦点状态为空闲(Idle),则确定当前第一应用所申请的第一音频焦点可用,表明第一应用请求的第一音频焦点可用。In this example, if the audio focus state corresponding to Virtual display0 is Idle (Idle), it is determined that the first audio focus currently applied for by the first application is available, indicating that the first audio focus requested by the first application is available.
S6-7:第一管理模块21向原生音频框架20返回查询结果,所述查询结果中包含请求第一音频焦点可用的指示信息。S6-7: The first management module 21 returns a query result to the native audio framework 20, where the query result includes indication information requesting that the first audio focus is available.
例如,第一管理模块21向原生音频框架20发送response(响应消息),所述response中包括所述第一音频焦点可用的指示信息,允许应用A授权访问第一音频焦点信息。For example, the first management module 21 sends a response (response message) to the native audio framework 20, where the response includes indication information that the first audio focus is available, allowing application A to authorize access to the first audio focus information.
S6-8:原生音频框架20根据所述查询结果确定第一应用申请的第一音频焦点可用,即申请第一音频焦点成功,并将该第一音频焦点可用的指示信息发送给应用A。S6-8: The native audio framework 20 determines that the first audio focus applied by the first application is available according to the query result, that is, the application for the first audio focus is successful, and sends the indication information that the first audio focus is available to application A.
对应的,第一应用接收来自所述原生音频框架20的指示信息后,获得所述第一音频 焦点。Correspondingly, after receiving the indication information from the native audio framework 20, the first application obtains the first audio focus.
此外,在上述步骤S6-6中还包括:第一管理模块21更新虚拟display0记录信息。具体地,第一管理模块21将虚拟display 0中第一音频焦点的状态设置成“使用”中,设置应用A占用虚拟display0音频焦点,以及将应用A添加到应用栈表中,更新后的虚拟display0记录信息如表6所示。In addition, the above step S6-6 also includes: the first management module 21 updates the virtual display0 record information. Specifically, the first management module 21 sets the state of the first audio focus in the virtual display 0 to "in use", sets the application A to occupy the audio focus of the virtual display 0, and adds the application A to the application stack table, and the updated virtual The record information of display0 is shown in Table 6.
表6、更新后的虚拟display0记录信息Table 6. The updated virtual display0 record information
Figure PCTCN2022088205-appb-000008
Figure PCTCN2022088205-appb-000008
另外,在上述步骤207中,如果第一管理模块21判断所述第一音频焦点处于“使用”状态,则表明第一音频焦点已经被其他应用占用,则第一应用申请音频焦点需要遵从音频焦点抢占机制。In addition, in the above step 207, if the first management module 21 determines that the first audio focus is in the "use" state, it indicates that the first audio focus has been occupied by other applications, and the first application to apply for the audio focus needs to comply with the audio focus preemption mechanism.
下面介绍应用B和应用C申请音频焦点的方法流程。具体地,如图13所示,方法包括:The following describes the method flow of application B and application C to apply for audio focus. Specifically, as shown in Figure 13, the method includes:
S5:手机100接收用户启动应用B播放音频的操作,所述应用B具有音频播放功能,且该应用B对应的虚拟display标识为虚拟display 1。S5: The mobile phone 100 receives the operation that the user starts the application B to play audio, the application B has an audio playback function, and the virtual display corresponding to the application B is identified as virtual display 1.
应用B接收用户操作后,调用第一管理模块21的接口,申请音频焦点,并获得第二音频焦点。具体的过程与前述步骤S6-1至S6-8相同,本实施例此处不再赘述。此时应用A使用第一音频焦点播放音频流,应用B使用第二音频焦点播放音频流。After the application B receives the user operation, it calls the interface of the first management module 21 to apply for the audio focus and obtain the second audio focus. The specific process is the same as the foregoing steps S6-1 to S6-8, and details are not repeated here in this embodiment. At this time, application A uses the first audio focus to play the audio stream, and application B uses the second audio focus to play the audio stream.
此时更新后的虚拟display记录信息如表7所示。In this case, the updated virtual display record information is shown in Table 7.
表7Table 7
Figure PCTCN2022088205-appb-000009
Figure PCTCN2022088205-appb-000009
当应用C申请音频焦点时,上述方法还包括:When application C applies for audio focus, the above method further includes:
S5’:手机100接收用户启动应用C播放音频的操作。S5': The mobile phone 100 receives the operation that the user starts the application C to play the audio.
应用C向第一管理模块21和第二管理模块22申请音频焦点,第二管理模块查询应用C所对应的虚拟display为虚拟display 1。具体过程可参见前述步骤S6-1至S6-4,此处不再赘述。Application C applies to the first management module 21 and the second management module 22 for audio focus, and the second management module queries the virtual display corresponding to application C as virtual display 1. For the specific process, reference may be made to the foregoing steps S6-1 to S6-4, which will not be repeated here.
在第二管理模块22查询到应用C所在的虚拟display后,参见图13所示,方法包括:After the second management module 22 queries the virtual display where the application C is located, as shown in FIG. 13 , the method includes:
301:第一管理模块21接收第二管理模块22返回的应用C所在虚拟display标识,本示例中应用C所在的display标识为虚拟display 1。301: The first management module 21 receives the virtual display identifier where the application C is located and returned by the second management module 22. In this example, the display identifier where the application C is located is the virtual display 1.
302:第一管理模块21根据所述应用C所在的虚拟display1确定应用C请求的音频焦点为第二音频焦点,并且判断该第二音频焦点是否可用。302 : The first management module 21 determines, according to the virtual display1 where the application C is located, that the audio focus requested by the application C is the second audio focus, and determines whether the second audio focus is available.
本示例中,应用C和应用B所对应的虚拟display标识都是Virtual display 1,且该Virtual display 1对应第二音频焦点,其中第二音频焦点被应用B先获取和使用(used),从而判断该应用C申请的第二音频焦点不可用。In this example, the virtual display identifiers corresponding to application C and application B are both virtual display 1, and the virtual display 1 corresponds to the second audio focus, wherein the second audio focus is acquired and used by application B first, so as to determine The second audio focus for this application C application is not available.
303:第一管理模块21根据虚拟display音频焦点机制,即高优先级业务应用抢占低优先级业务的应用,以及,对于同等优先级的业务应用遵循后申请应用抢占优先的规则。本示例中,因为应用C所对应的业务优先级高于应用C,且应用C是后申请的应用,所以确定应用C抢占应用B的第二音频焦点。303: The first management module 21 preempts the application of the low-priority service according to the virtual display audio focus mechanism, that is, the high-priority service application preempts the application of the low-priority service, and applies for the application preemption priority rule after following the service application of the same priority. In this example, because the service priority corresponding to application C is higher than that of application C, and application C is an application applied later, it is determined that application C preempts the second audio focus of application B.
304:第一管理模块21向原生音频框架20发送指示信息,所述指示信息用于指示应用C抢占所述第二音频焦点。304: The first management module 21 sends indication information to the native audio framework 20, where the indication information is used to instruct the application C to preempt the second audio focus.
305:原生音频框架20接收所述指示信息后向应用B发送通知,通知应用B释放当前使用的第二音频焦点。305: After receiving the indication information, the native audio framework 20 sends a notification to application B to notify application B to release the currently used second audio focus.
306:应用B接收该通知后,停止使用并释放所述第二音频焦点。306: After receiving the notification, application B stops using and releases the second audio focus.
另外,在步骤306释放所述第二音频焦点后,还包括:In addition, after releasing the second audio focus in step 306, the method further includes:
307:第一管理模块21向原生音频框架20发送通知消息,用于通知应用C使用所述第二音频焦点。307: The first management module 21 sends a notification message to the native audio framework 20 to notify the application C to use the second audio focus.
308:原生音频框架20将所述通信消息发送给应用C,通知应用C获得第二音频焦点。308: The native audio framework 20 sends the communication message to application C to notify application C to obtain the second audio focus.
309:应用C接收该通知消息后,获得并使用所述第二音频焦点。309: After receiving the notification message, application C obtains and uses the second audio focus.
本实施例中,当有多个应用申请同一音频焦点时,根据虚拟display音频焦点机制为应用分配相应的焦点,从而优化运行在不同虚拟display的应用音频焦点抢占机制,支持基于虚拟display的多任务音频并发控制。In this embodiment, when multiple applications apply for the same audio focus, the application is allocated a corresponding focus according to the virtual display audio focus mechanism, thereby optimizing the audio focus preemption mechanism of applications running on different virtual displays, and supporting multitasking based on virtual display. Audio concurrency control.
此外,第一管理模块21还刷新虚拟display记录信息,如表8所示。In addition, the first management module 21 also refreshes the virtual display record information, as shown in Table 8.
表8Table 8
Figure PCTCN2022088205-appb-000010
Figure PCTCN2022088205-appb-000010
需要说明的是,上述应用A、应用B和应用C可以是前述实施例的第一应用,也可以是第二应用,本实施例对此不予限制。It should be noted that the foregoing application A, application B, and application C may be the first application or the second application in the foregoing embodiment, which is not limited in this embodiment.
当应用申请到音频焦点后,通过Android SDK接口播放音频流,多屏音频管理模块根据应用所在display与虚拟音频设备映射关系,将应用播放音频流分流到对应的虚拟音频设 备上输出播放。After the application applies for the audio focus, the audio stream is played through the Android SDK interface. The multi-screen audio management module splits the audio stream played by the application to the corresponding virtual audio device for output and playback according to the mapping relationship between the display where the application is located and the virtual audio device.
第三部分流程:定义基于虚拟Display的音频分流策略,根据分流策略向应用对应的虚拟音频设备传输音频流。The third part of the process: define the audio distribution strategy based on the virtual Display, and transmit the audio stream to the virtual audio device corresponding to the application according to the distribution strategy.
具体地,如图14a所示,Android音频流通过AudioFlinger进行分发,多屏音频管理模块在“第一部分流程中”中构建了虚拟display与虚拟音频设备的设备标识之间的绑定关系,当前应用获取音频焦点后,创建AudioTrack播放音频(或创建AudioRecod录音),AudioFlinger先根据当前应用归属虚拟display找到对应虚拟音频设备,然后将应用AudioTrack(或AudioRecord)分发到对应的虚拟音频设备中,虚拟音频HAL收到音频流后分发到对应投屏设备端。Specifically, as shown in Figure 14a, the Android audio stream is distributed through AudioFlinger, and the multi-screen audio management module builds the binding relationship between the virtual display and the device ID of the virtual audio device in the "first part of the process". The current application After obtaining the audio focus, create an AudioTrack to play the audio (or create an AudioRecod recording), AudioFlinger first finds the corresponding virtual audio device according to the virtual display belonging to the current application, and then distributes the application AudioTrack (or AudioRecord) to the corresponding virtual audio device. The virtual audio HAL After receiving the audio stream, distribute it to the corresponding screen projection device.
如图14b所示,基于虚拟display音频分流方法流程包括:As shown in Figure 14b, the flow of the method for audio distribution based on virtual display includes:
401:当用启动应用A播放音乐时,应用A播放音乐,调用Android SDK接口播放第一音频流,应用A向原生音频框架20写入所述第一音频流。401: When the startup application A is used to play music, the application A plays the music, calls the Android SDK interface to play the first audio stream, and the application A writes the first audio stream to the native audio framework 20.
402:原生音频框架20接收到应用A的所述第一音频流后,向第一管理模块21发送查询请求,查询应用A的音频播放策略。402 : After receiving the first audio stream of the application A, the native audio framework 20 sends a query request to the first management module 21 to query the audio playback policy of the application A.
其中,所述查询请求中包含应用A相关信息,例如应用A的包名、pid、标识等信息。Wherein, the query request includes application A related information, such as application A's package name, pid, identification and other information.
403:第一管理模块21接收所述查询消息后,将该查询请求发送至第二管理模块22。403 : After receiving the query message, the first management module 21 sends the query request to the second management module 22 .
404:第二管理模块22接收来自所述第一管理模块发送的请求消息后,根据虚拟display记录信息表查询应用A所属的虚拟display标识。404: After receiving the request message sent from the first management module, the second management module 22 queries the virtual display identifier to which the application A belongs according to the virtual display record information table.
本示例中,根据表6至表8的对应关系,确定应用A所属的虚拟display标识为虚拟display 0。In this example, according to the corresponding relationship in Table 6 to Table 8, it is determined that the virtual display identifier to which application A belongs is virtual display 0.
405:第二管理模块22将查询结果,即虚拟display标识发送给第一管理模块21。比如第二管理模块22向第一管理模块21返回第一查询结果,所述第一查询结果中包括:应用A的所在的虚拟display 0。405 : The second management module 22 sends the query result, that is, the virtual display identifier, to the first management module 21 . For example, the second management module 22 returns the first query result to the first management module 21, and the first query result includes: the virtual display 0 where the application A is located.
406:第一管理模块21接收第一查询结果后,根据应用A的所在的虚拟display 0,从维护的绑定关系中查找虚拟display 0所对应的虚拟音频设备。406: After receiving the first query result, the first management module 21 searches for the virtual audio device corresponding to the virtual display 0 from the maintained binding relationship according to the virtual display 0 where the application A is located.
所述绑定关系为前述“第一部分流程”中建立的虚拟display和虚拟音频设备的设备标识之间的对应关系。如前述表4、表5、表6所示的绑定关系,确定与应用A绑定的虚拟音频设备的设备标识,与所述虚拟display 0所绑定的虚拟音频设备为智慧屏,该虚拟音频设备的设备标识为智慧屏200。The binding relationship is the corresponding relationship between the virtual display and the device identifier of the virtual audio device established in the foregoing "Part 1 of the process". As shown in Table 4, Table 5 and Table 6, the device identification of the virtual audio device bound to application A is determined, and the virtual audio device bound to the virtual display 0 is a smart screen, and the virtual audio device is bound to the virtual display 0. The device identification of the audio device is the smart screen 200 .
407:第一管理模块21向所述原生音频架构20发送查找的虚拟音频设备的设备标识。407: The first management module 21 sends the device identification of the searched virtual audio device to the native audio architecture 20.
本示例中,第一管理模块21发送第二查询结果,第二查询结果中包含display0对应关联的虚拟音频设备的设备标识,智慧屏200。In this example, the first management module 21 sends the second query result, and the second query result includes the device identifier of the virtual audio device corresponding to display0, the smart screen 200 .
408:原生音频框架20收到所述第二查询结果后,根据音频策略获取第一音频流,所述第一音频流是需要向智慧屏200播放的音频流。408: After receiving the second query result, the native audio framework 20 acquires a first audio stream according to the audio policy, where the first audio stream is an audio stream that needs to be played on the smart screen 200.
409:原生音频框架20将应用A播放的第一音频流和虚拟音频设备的设备标识分发到虚拟音频HAL 30,即向所述虚拟音频HAL发送所述第一音频流和智慧屏200的信息。409: The native audio framework 20 distributes the first audio stream played by application A and the device identifier of the virtual audio device to the virtual audio HAL 30, that is, sends the information of the first audio stream and the smart screen 200 to the virtual audio HAL.
410:虚拟音频HAL 30收到原生音频框架20发送的第一音频流和虚拟音频设备的设备标识后,根据虚拟音频设备的设备标识找到对应的音频通路,将第一音频流通过该音频通路发送至音频设备智慧屏200。410: After the virtual audio HAL 30 receives the first audio stream sent by the native audio framework 20 and the device identifier of the virtual audio device, it finds the corresponding audio path according to the device identifier of the virtual audio device, and sends the first audio stream through the audio path. to the audio equipment smart screen 200.
智慧屏200接收该第一音频流后,播放该第一音频流,实现手机100中的应用A的第一音频流在智慧屏200上播放功能。After receiving the first audio stream, the smart screen 200 plays the first audio stream, so as to realize the function of playing the first audio stream of the application A in the mobile phone 100 on the smart screen 200 .
其中,上述步骤401至407对应前述“第三部分流程”中的步骤S7,步骤408至410对应前述“第三部分流程”中的步骤S8。Wherein, the above-mentioned steps 401 to 407 correspond to step S7 in the aforementioned "third part of the flow", and steps 408 to 410 correspond to the aforementioned step S8 in the "third part of the flow".
同理地,当应用B请求播放第二音频流时,将第二音频流通过第一管理模块21查找到的虚拟音频设备的设备标识,传输至第二设备,比如平板300,从而实现手机100的应用B将第二音频流传输至另一投屏设备,平板300的功能。Similarly, when application B requests to play the second audio stream, the second audio stream is transmitted to the second device, such as the tablet 300, through the device identifier of the virtual audio device found by the first management module 21, thereby realizing the mobile phone 100. The function of the application B to transmit the second audio stream to another screen projection device, the tablet 300.
具体地,应用B传输分发第二媒体流的过程,步骤411至420的方法与前述步骤401至410相同,参见前述实施例的描述,此处不详细赘述。Specifically, in the process of applying B to transmit and distribute the second media stream, the methods of steps 411 to 420 are the same as the foregoing steps 401 to 410, refer to the description of the foregoing embodiment, and are not described in detail here.
本实施例中,由于应用A分配的虚拟display(即虚拟display 0)和应用B所分配的虚拟display(即虚拟display 1)不同,且每个display对应的虚拟音频设备互相独立,互补干扰,所以通过“第一部分流程”建立的绑定关系,可以实现一对多投屏功能,多端投屏显示以及音频输入输出相互独立,每一个投屏端设备运行应用播放声音在当前投屏端设备发声,实现真正的多任务音频并发和拾音。In this embodiment, since the virtual display allocated by application A (that is, virtual display 0) and the virtual display allocated by application B (that is, virtual display 1) are different, and the virtual audio devices corresponding to each display are independent of each other and interfere with each other, so Through the binding relationship established by the "first part of the process", the one-to-many screen projection function can be realized, and the multi-terminal screen projection display and audio input and output are independent of each other. Achieve true multitasking audio concurrency and pickup.
应理解,上述应用C在获取第二音频焦点后,请求播放第三音频流并在虚拟display 1所关联的平板300上播放所述第三音频流,具体过程与前述步骤401至410相同,参见前述实施例的描述,本实施例对此不再赘述。It should be understood that, after obtaining the second audio focus, the above-mentioned application C requests to play the third audio stream and plays the third audio stream on the tablet 300 associated with the virtual display 1. The specific process is the same as the aforementioned steps 401 to 410. See The description of the foregoing embodiment is not repeated in this embodiment.
此外,上述根据分流策略向应用对应的虚拟音频设备传输音频流的方案还适用于其他场景,比如录音场景,从而实现每个投屏设备运行应用录音可以使用当前投屏端设备进行录音,满足一对多投屏功能的录音需求。或者,还适用于一对多投屏分布式相机(camera)虚拟化环境,可实现多屏场景分布式camera使用场景。In addition, the above scheme of transmitting audio streams to the virtual audio device corresponding to the application according to the streaming strategy is also applicable to other scenarios, such as recording scenarios, so that each screen-casting device can use the current screen-casting device for recording when running the application, which satisfies one requirement. Recording requirements for multi-screen projection. Alternatively, it is also applicable to a one-to-many projection screen distributed camera (camera) virtualization environment, which can realize a distributed camera usage scenario in a multi-screen scenario.
本申请实施例中,手机端可基于应用窗口形态将显示的画面内容传输到投屏设备的每个显示屏上,实现针对每个应用窗口音频并发。In the embodiment of the present application, the mobile terminal can transmit the displayed picture content to each display screen of the screen projection device based on the form of the application window, so as to realize audio concurrency for each application window.
下面介绍与上述方法实施例对应的装置实施例。Apparatus embodiments corresponding to the foregoing method embodiments are introduced below.
图15为本申请实施例提供的一种管理装置的结构示意图。所述装置可以应用于前述的第一管理模块,或者,还可以是位于终端设备中的部件。并且,该装置可以实现前述实施例中的第一管理模块21的所有功能,并执行前述实施例中的一种音频播放方法。FIG. 15 is a schematic structural diagram of a management apparatus provided by an embodiment of the present application. The apparatus may be applied to the aforementioned first management module, or may also be a component located in a terminal device. Furthermore, the apparatus can implement all the functions of the first management module 21 in the foregoing embodiments, and execute an audio playing method in the foregoing embodiments.
其中,该装置包括:第一接收单元1501、第一处理单元1502和第一发送单元1503,此外还可以包括其他单元或模块,比如存储单元等。Wherein, the apparatus includes: a first receiving unit 1501, a first processing unit 1502, and a first sending unit 1503, and may further include other units or modules, such as a storage unit and the like.
具体地,第一接收单元1501用于当终端设备启动投屏业务时,接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;第一发送单元1503用于向硬件抽象层HAL发送所述第一请求;第一接收单元1501还用于接收所述HAL发送的第一虚拟音频设备的设备标识,所述第一虚拟音频设备根据所述第一设备的相关信息创建。第一发送单元1503还用于向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述虚拟投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。Specifically, the first receiving unit 1501 is configured to receive a first request sent by the screen projection service module when the terminal device starts the screen projection service, where the first request is used to request the creation of a virtual audio device, and the first request includes Relevant information of the first device that the user wishes to screen; the first sending unit 1503 is configured to send the first request to the hardware abstraction layer HAL; the first receiving unit 1501 is further configured to receive the first virtual audio device sent by the HAL The device identifier of the first virtual audio device is created according to the relevant information of the first device. The first sending unit 1503 is further configured to send the device identifier of the first virtual audio device to the screen projection service module, so that the virtual screen projection service module establishes a relationship between the virtual display screen display and the first virtual audio device. binding relationship between.
可选的,在本实施例的一种具体的实施方式中,第一接收单元1501还用于接收所述投屏业务模块发送的第一绑定关系,所述第一绑定关系包括第一虚拟显示屏display和所述第一虚拟音频设备的设备标识之间的对应关系;第一处理单元1502用于当第一应用请求 播放音频流时确定第一虚拟display,根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识;第一发送单元1503还用于向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。Optionally, in a specific implementation of this embodiment, the first receiving unit 1501 is further configured to receive the first binding relationship sent by the screen projection service module, where the first binding relationship includes the first binding relationship. The corresponding relationship between the virtual display screen display and the device identifier of the first virtual audio device; the first processing unit 1502 is configured to determine the first virtual display when the first application requests to play the audio stream, according to the first virtual display Find the device identifier of the first virtual audio device in the first binding relationship; the first sending unit 1503 is further configured to send the device identifier of the first virtual audio device to the native audio framework, so that the native audio framework The corresponding audio stream is output to the first device through the first virtual audio device.
可选的,在本实施例的另一种具体的实施方式中,第一接收单元1501还用于获取第一应用的标识;第一发送单元1503还用于向第二管理模块发送所述第一应用的标识;第一接收单元1501还用于接收所述第二管理模块根据所述第一应用的标识确定的所述第一虚拟display。Optionally, in another specific implementation of this embodiment, the first receiving unit 1501 is further configured to acquire the identifier of the first application; the first sending unit 1503 is further configured to send the first application to the second management module An identifier of an application; the first receiving unit 1501 is further configured to receive the first virtual display determined by the second management module according to the identifier of the first application.
可选的,在本实施例的又一种具体的实施方式中,第一处理单元1502还用于根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应,查询所述第一音频焦点的状态是否可用;第一发送单元1503还用于在所述第一处理单元1502查询所述第一音频焦点可用时,向所述原生音频框架发送所述第一音频焦点。Optionally, in yet another specific implementation of this embodiment, the first processing unit 1502 is further configured to determine a first audio focus according to the first virtual display, where the first audio focus is the same as the first audio focus. Corresponding to the virtual display, query whether the state of the first audio focus is available; the first sending unit 1503 is further configured to send to the native audio framework when the first processing unit 1502 queries that the first audio focus is available the first audio focus.
可选的,在本实施例的又一种具体的实施方式中,第一处理单元1502还用于在查询所述第一音频焦点的状态不可用时,确定占用所述第一音频焦点的应用为第二应用;所述第一发送单元1503还用于向所述原生音频框架发送第一指示信息,所述第一指示信息用于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;以及,当所述第一接收单元接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。Optionally, in yet another specific implementation of this embodiment, the first processing unit 1502 is further configured to, when querying the status of the first audio focus is unavailable, determine that the application occupying the first audio focus is: The second application; the first sending unit 1503 is further configured to send first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be The first application is occupied; and, when the first receiving unit receives an instruction that the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that all The first application acquires the first audio focus.
可选的,在本实施例的又一种具体的实施方式中,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:第一处理单元1502还用于获取第一虚拟display所关联的第一焦点管理记录,以及在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲。其中,所述第一焦点管理记录中包括第一音频焦点的状态,所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点。Optionally, in another specific implementation of this embodiment, before the first management module queries whether the state of the first audio focus is available, the method further includes: the first processing unit 1502 is further configured to obtain the first audio focus. A first focus management record associated with a virtual display, and querying the first focus management record whether the state of the first audio focus is idle. Wherein, the first focus management record includes the state of the first audio focus, the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
可选的,在本实施例的又一种具体的实施方式中,第一处理单元1502还用于按照虚拟display音频焦点机制维护所述第一焦点管理记录。其中,所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。Optionally, in another specific implementation of this embodiment, the first processing unit 1502 is further configured to maintain the first focus management record according to the virtual display audio focus mechanism. Wherein, the virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority service application according to the high priority The applications of the priority services, and, the service applications of the same priority follow the rule of applying for the application first and preempting the application first.
此外,本实施例还提供另一种管理装置,如图16所示,该装置可应用于第二管理模块,用于实现前述第二管理模块22的全部或部分功能,其中,所述第二管理模块包括:第二接收单元1601、第二处理单元1602和第二发送单元1603,此外还可以包括其他单元或模块,比如存储单元等。In addition, this embodiment further provides another management device. As shown in FIG. 16 , the device can be applied to a second management module to implement all or part of the functions of the second management module 22, wherein the second management module The management module includes: a second receiving unit 1601, a second processing unit 1602, and a second sending unit 1603, and may also include other units or modules, such as a storage unit and the like.
其中,第二接收单元1601用于接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息。第二处理单元1602用于根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;第二发送单元1603用于向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。The second receiving unit 1601 is configured to receive a second request sent by the screen-casting service module, the second request is used to create a virtual display for screen-casting, and the second request includes: specifying the name, size and resolution of the virtual display rate information. The second processing unit 1602 is configured to create a first virtual display according to the specified virtual display name, size and resolution information; the second sending unit 1603 is configured to send the first virtual display to the screen projection service module, so that The virtual screen projection service module establishes a first binding relationship between the first virtual display and the first virtual audio device.
可选的,在本实施例的一种具体的实施方式中,第二接收单元1601还用于接收所述 投屏业务模块发送的所述第一绑定关系;第二发送单元1603还用于向所述第一管理模块发送所述第一绑定关系。Optionally, in a specific implementation of this embodiment, the second receiving unit 1601 is further configured to receive the first binding relationship sent by the screen projection service module; the second sending unit 1603 is further configured to Send the first binding relationship to the first management module.
可选的,在本实施例的另一种具体的实施方式中,第二接收单元1601还用于当第一应用请求播放音频流时,所述第二管理模块获取第一应用的标识;第二处理单元1602还用于根据所述第一应用的标识查找第一应用所属的第一虚拟display;第二发送单元1603还用于向所述第一管理模块发送所述第一虚拟display。Optionally, in another specific implementation of this embodiment, the second receiving unit 1601 is further configured to, when the first application requests to play the audio stream, the second management module to obtain the identifier of the first application; The second processing unit 1602 is further configured to search for the first virtual display to which the first application belongs according to the identifier of the first application; the second sending unit 1603 is further configured to send the first virtual display to the first management module.
可选的,在本实施例的又一种具体的实施方式中,第二接收单元1601还用于在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。Optionally, in another specific implementation of this embodiment, the second receiving unit 1601 is further configured to receive an audio focus request sent by the first management module when the first application requests to apply for audio focus , the audio focus request includes the identifier of the first application.
可选的,在本实施例的又一种具体的实施方式中,第二接收单元1601还用于在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。Optionally, in yet another specific implementation of this embodiment, the second receiving unit 1601 is further configured to receive, when the native audio framework acquires the audio stream played by the first application, a message sent by the first management module. the identifier of the first application.
此外,本实施例还提供了一种应用装置,如图17所示,该装置可用应用于一种投屏业务模块,用于实现前述投屏业务模块10的部分或全部功能,所述应用装置包括:第三接收单元1701、第三处理单元1702和第三发送单元1703,此外还可以包括其他单元或模块,比如存储单元等。In addition, this embodiment also provides an application device. As shown in FIG. 17 , the device can be applied to a screen projection service module to realize part or all of the functions of the aforementioned screen projection service module 10. The application device It includes: a third receiving unit 1701, a third processing unit 1702, and a third sending unit 1703, and may also include other units or modules, such as a storage unit and the like.
具体地,第三接收单元1701用于在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;第三发送单元1703用于在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息。Specifically, the third receiving unit 1701 is configured to obtain the first virtual display screen display created by the second management module when obtaining the user's operation of starting the screen projection service; the third sending unit 1703 is configured to obtain the first virtual display screen display created by the second management module; After the device establishes a virtual audio link, it sends a first request to the first management module, where the first request is used to request the creation of a virtual audio device, and the first request includes information about the first device that the user wishes to screen. information.
第三接收单元1701还用于接收所述第一管理模块发送的第一虚拟音频设备的设备标识;第三处理单元1702用于所述投屏业务模块建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;第三发送单元1703,还用于向所述第一管理模块发送所述第一绑定关系。The third receiving unit 1701 is further configured to receive the device identifier of the first virtual audio device sent by the first management module; the third processing unit 1702 is configured to establish a first binding relationship for the screen projection service module, the first The binding relationship includes the corresponding relationship between the first virtual display and the device identifier of the first virtual audio device; the third sending unit 1703 is further configured to send the first binding to the first management module relation.
可选的,在本实施例的一种具体的实施方式中,第三发送单元1703还用于向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;第三接收单元1701还用于接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。Optionally, in a specific implementation of this embodiment, the third sending unit 1703 is further configured to send a second request to the second management module, where the second request is used to request the second management module The module creates a virtual display; the third receiving unit 1701 is further configured to receive the first virtual display created by the second management module according to the second request.
可选的,在本实施例的另一种具体的实施方式中,第三处理单元1702还用于当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;第三接收单元1703还用于向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。Optionally, in another specific implementation of this embodiment, the third processing unit 1702 is further configured to release the first virtual display and the first virtual display when acquiring the operation of the user disconnecting the screencasting service. The first binding relationship between the device identifiers of the virtual audio device; the third receiving unit 1703 is further configured to send a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship.
需要说明的是,上述各个管理装置和应用装置可以通过软件,或者软硬件结合的方式来实现。其中,所述第一接收单元至第三接收单元,第一发送单元至第三发送单元的功能可以通过终端设备的内部端口来实现,所述第一处理单元至第三处理单元的功能可以通过图3所示的处理器110实现,或者由处理器110和存储器120共同实现。终端设备与各个投屏设备之间的数据传输,比如音频流传输则可通过移动通信模块150或无线通信模块160来实现。It should be noted that, each of the above-mentioned management apparatuses and application apparatuses may be implemented by software or a combination of software and hardware. Wherein, the functions of the first receiving unit to the third receiving unit and the first sending unit to the third sending unit can be realized through the internal port of the terminal device, and the functions of the first processing unit to the third processing unit can be realized through The processor 110 shown in FIG. 3 is implemented, or jointly implemented by the processor 110 and the memory 120 . Data transmission between the terminal device and each screen projection device, such as audio streaming transmission, may be implemented through the mobile communication module 150 or the wireless communication module 160 .
利用图3所示的终端设备,例如手机时,通过投屏业务、多频音频管理和多屏管理模 块的功能实现一对多投屏场景,多端投屏设备显示以及音频输入输出相互独立,每一个投屏设备显示运行应用播放声音在当前投屏端设备发声,每个投屏设备显示运行应用录音可以使用当前投屏设备进行录音,实现多任务音频并发和拾音。When using the terminal device shown in Figure 3, such as a mobile phone, a one-to-many projection scenario is realized through the functions of the projection screen service, multi-frequency audio management and multi-screen management module. The multi-terminal projection device display and audio input and output are independent of each other. A screen-casting device displays the running application playback sound on the current screen-casting device, and each screen-casting device displays a running application recording that can be recorded using the current screen-casting device to achieve multi-task audio concurrency and pickup.
此外,本申请实施例还提供了一种音频播放系统,该系统包括至少一个源设备和至少两个投屏设备,所述源设备和投屏设备都可以是前述任意一种终端设备,所述终端设备的结构可以与前述图3所示的装置结构相同,也可以不相同。此外,还可以包括网络设备,比如服务器,云平台等,所述网络设备用于辅助终端设备实现一对多投屏业务功能。In addition, an embodiment of the present application also provides an audio playback system, the system includes at least one source device and at least two screen projection devices, and both the source device and the screen projection device may be any of the foregoing terminal devices, and the The structure of the terminal device may be the same as or different from the structure of the apparatus shown in FIG. 3 . In addition, a network device, such as a server, a cloud platform, etc., may also be included, and the network device is used to assist the terminal device to realize the one-to-many screen projection service function.
此外,本申请实施例还提供一种芯片系统,如图18所示,该芯片系统中包括处理器1801用于支持上述装置实现上述各个方法中所涉及的功能,例如前述第一部分流程至第三部分流程中的方法步骤。在一种可能的设计中,芯片系统还包括存储器1802,用于保存第一管理装置、第二管理装置,以及各个模块必要的计算机指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。In addition, an embodiment of the present application also provides a chip system. As shown in FIG. 18 , the chip system includes a processor 1801 to support the above-mentioned device to implement the functions involved in the above-mentioned methods. For example, the foregoing first part of the flow to the third part Method steps in part of the process. In a possible design, the chip system further includes a memory 1802 for storing the first management device, the second management device, and necessary computer instructions and data for each module. The chip system may be composed of chips, or may include chips and other discrete devices.
所述存储器1802中包括计算机存储介质,其中,该计算机存储介质可存储有程序指令,该程序指令被执行时可包括本申请提供的音频播放方法的部分或全部步骤。所述的存储介质可为磁碟、光盘、只读存储记忆体ROM或随机存储记忆体RAM等。The memory 1802 includes a computer storage medium, wherein the computer storage medium may store program instructions, and when the program instructions are executed, may include part or all of the steps of the audio playback method provided by the present application. The storage medium can be a magnetic disk, an optical disk, a read-only storage memory ROM or a random access storage memory RAM, and the like.
在上述实施例中,可以全部或部分通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above-mentioned embodiments, all or part of the implementation may be implemented by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product.
上述计算机存储介质可以是一种计算机程序产品,所述计算机程序产品包括一个或多个计算机指令,例如请求申请音频焦点的指令、请求创建虚拟display指令、查询指令等,在计算机加载和执行所述计算机程序指令时,全部或部分地产生按照本申请上述各个实施例所述方法流程或功能。The above-mentioned computer storage medium may be a computer program product, and the computer program product includes one or more computer instructions, such as an instruction requesting to apply for audio focus, an instruction requesting to create a virtual display, a query instruction, etc., which are loaded and executed on a computer. When computer program instructions are used, all or part of the method processes or functions described in the above-mentioned embodiments of the present application are generated.
此外,在本申请的描述中,除非另有说明,“多个”是指两个或多于两个。另外,为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”、“第三”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”、“第三”等字样也并不限定一定不同。Also, in the description of this application, unless stated otherwise, "plurality" means two or more than two. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first", "second", "third" are used to describe the same items or items with basically the same function and effect. Similar items are distinguished. Those skilled in the art can understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second", "third" and the like are not necessarily different.
以上所述的本申请实施方式并不构成对本申请保护范围的限定。The above-described embodiments of the present application do not limit the protection scope of the present application.

Claims (32)

  1. 一种音频播放方法,其特征在于,所述方法包括:An audio playback method, characterized in that the method comprises:
    当终端设备启动投屏业务时,第一管理模块接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;When the terminal device starts the screencasting service, the first management module receives the first request sent by the screencasting service module, the first request is used to request the creation of a virtual audio device, and the first request includes the first request that the user wishes to screencast. information about the device;
    所述第一管理模块向硬件抽象层HAL发送所述第一请求;The first management module sends the first request to the hardware abstraction layer HAL;
    所述第一管理模块接收所述HAL发送的第一虚拟音频设备的设备标识,所述第一虚拟音频设备根据所述第一设备的相关信息创建;The first management module receives the device identifier of the first virtual audio device sent by the HAL, and the first virtual audio device is created according to the relevant information of the first device;
    所述第一管理模块向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。The first management module sends the device identification of the first virtual audio device to the screen projection service module, so that the screen projection service module establishes a binding between the virtual display screen display and the first virtual audio device. established relationship.
  2. 根据权利要求1所述的方法,其特征在于,还包括:The method of claim 1, further comprising:
    所述第一管理模块接收所述投屏业务模块发送的第一绑定关系,所述第一绑定关系包括第一虚拟显示屏display和所述第一虚拟音频设备的设备标识之间的对应关系;The first management module receives the first binding relationship sent by the screen projection service module, where the first binding relationship includes the correspondence between the first virtual display screen display and the device identifier of the first virtual audio device relation;
    当第一应用请求播放音频流时,所述第一管理模块确定第一虚拟display;When the first application requests to play the audio stream, the first management module determines the first virtual display;
    所述第一管理模块根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识;The first management module searches for the device identifier of the first virtual audio device in the first binding relationship according to the first virtual display;
    所述第一管理模块向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。The first management module sends the device identification of the first virtual audio device to the native audio framework, so that the native audio framework outputs the corresponding audio stream to the first device through the first virtual audio device.
  3. 根据权利要求2所述的方法,其特征在于,所述第一管理模块确定第一虚拟display,包括:The method according to claim 2, wherein the first management module determines the first virtual display, comprising:
    所述第一管理模块获取第一应用的标识;The first management module obtains the identifier of the first application;
    所述第一管理模块向第二管理模块发送所述第一应用的标识;The first management module sends the identifier of the first application to the second management module;
    所述第一管理模块接收所述第二管理模块根据所述第一应用的标识确定的所述第一虚拟display。The first management module receives the first virtual display determined by the second management module according to the identifier of the first application.
  4. 根据权利要求2或3所述的方法,其特征在于,所述第一管理模块确定第一虚拟display之后,还包括:The method according to claim 2 or 3, wherein after the first management module determines the first virtual display, the method further comprises:
    所述第一管理模块根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应;The first management module determines a first audio focus according to the first virtual display, and the first audio focus corresponds to the first virtual display;
    所述第一管理模块查询所述第一音频焦点的状态是否可用;The first management module inquires whether the state of the first audio focus is available;
    如果是,则向所述原生音频框架发送所述第一音频焦点。If so, send the first audio focus to the native audio framework.
  5. 根据权利要求4所述的方法,其特征在于,还包括:The method of claim 4, further comprising:
    如果查询所述第一音频焦点的状态不可用,则确定占用所述第一音频焦点的应用为第二应用;If the state of the querying the first audio focus is unavailable, determining that the application occupying the first audio focus is the second application;
    所述第一管理模块向所述原生音频框架发送第一指示信息,所述第一指示信息用 于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;The first management module sends first indication information to the native audio framework, and the first indication information is used to notify the native audio framework that the first audio focus needs to be occupied by the first application;
    当接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。When receiving the instruction that the second application stops using the first audio focus, the first audio focus is sent to the native audio framework, so that the first application acquires the first audio focus.
  6. 根据权利要求4所述的方法,其特征在于,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:The method according to claim 4, wherein before the first management module inquires whether the state of the first audio focus is available, the method further comprises:
    所述第一管理模块获取第一虚拟display所关联的第一焦点管理记录,所述第一焦点管理记录中包括第一音频焦点的状态,其中所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点;The first management module acquires a first focus management record associated with the first virtual display, the first focus management record includes the state of the first audio focus, wherein the state of the first audio focus includes idle and in use, The first virtual display uniquely corresponds to the first audio focus;
    所述第一管理模块查询所述第一音频焦点的状态是否可用,包括:The first management module inquires whether the status of the first audio focus is available, including:
    所述第一管理模块在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲。The first management module inquires in the first focus management record whether the state of the first audio focus is idle.
  7. 根据权利要求6所述的方法,其特征在于,还包括:The method of claim 6, further comprising:
    所述第一管理模块按照虚拟display音频焦点机制维护所述第一焦点管理记录;The first management module maintains the first focus management record according to the virtual display audio focus mechanism;
    所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。The virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority according to the high priority service application Business applications, and business applications with the same priority follow the rule of applying for applications first and preempting applications later.
  8. 一种音频播放方法,其特征在于,所述方法包括:An audio playback method, characterized in that the method comprises:
    第二管理模块接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,其中所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息;The second management module receives a second request sent by the screen-casting service module, where the second request is used to create a virtual display for screen-casting, wherein the second request includes: specifying the name, size, and resolution information of the virtual display;
    所述第二管理模块根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;The second management module creates a first virtual display according to the specified virtual display name, size and resolution information;
    所述第二管理模块向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。The second management module sends the first virtual display to the screen-casting service module, so that the virtual screen-casting service module establishes a first binding between the first virtual display and the first virtual audio device relation.
  9. 根据权利要求8所述的方法,其特征在于,还包括:The method of claim 8, further comprising:
    所述第二管理模块接收所述投屏业务模块发送的所述第一绑定关系;receiving, by the second management module, the first binding relationship sent by the screen projection service module;
    所述第二管理模块向所述第一管理模块发送所述第一绑定关系。The second management module sends the first binding relationship to the first management module.
  10. 根据权利要求8或9所述的方法,其特征在于,还包括:The method of claim 8 or 9, further comprising:
    当第一应用请求播放音频流时,所述第二管理模块获取第一应用的标识;When the first application requests to play the audio stream, the second management module obtains the identifier of the first application;
    所述第二管理模块根据所述第一应用的标识查找第一应用所属的第一虚拟display;The second management module searches for the first virtual display to which the first application belongs according to the identifier of the first application;
    所述第二管理模块向所述第一管理模块发送所述第一虚拟display。The second management module sends the first virtual display to the first management module.
  11. 根据权利要求10所述的方法,其特征在于,所述第二管理模块获取第一应用 的标识,包括:The method according to claim 10, wherein the second management module obtains the identification of the first application, comprising:
    所述第二管理模块在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。When the first application requests to apply for audio focus, the second management module receives an audio focus request sent by the first management module, where the audio focus request includes the identifier of the first application.
  12. 根据权利要求10所述的方法,其特征在于,所述第二管理模块获取第一应用的标识,包括:The method according to claim 10, wherein the second management module obtains the identifier of the first application, comprising:
    所述第二管理模块在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。The second management module receives the identifier of the first application sent by the first management module when the native audio framework acquires the audio stream played by the first application.
  13. 一种音频播放方法,其特征在于,所述方法包括:An audio playback method, characterized in that the method comprises:
    投屏业务模块在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;The screen projection service module acquires the first virtual display screen display created by the second management module when acquiring the operation of the user initiating the screen projection service;
    所述投屏业务模块在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;The screen projection service module sends a first request to the first management module after establishing a virtual audio link with the first device that expects screen projection, where the first request is used to request the creation of a virtual audio device, and the first request is used to request the creation of a virtual audio device. A request includes information about the first device on which the user wishes to project the screen;
    所述投屏业务模块接收所述第一管理模块发送的第一虚拟音频设备的设备标识;The screen projection service module receives the device identifier of the first virtual audio device sent by the first management module;
    所述投屏业务模块建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;The screen projection service module establishes a first binding relationship, and the first binding relationship includes a corresponding relationship between the device identifiers of the first virtual display and the first virtual audio device;
    所述投屏业务模块向所述第一管理模块发送所述第一绑定关系。The screen projection service module sends the first binding relationship to the first management module.
  14. 根据权利要求13所述的方法,其特征在于,所述获取第二管理模块创建的第一虚拟显示屏display,包括:The method according to claim 13, wherein the acquiring the first virtual display screen display created by the second management module comprises:
    所述投屏业务模块向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;The screen projection service module sends a second request to the second management module, where the second request is used to request the second management module to create a virtual display;
    所述投屏业务模块接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。The screen projection service module receives the first virtual display created by the second management module according to the second request.
  15. 根据权利要求13或14所述的方法,其特征在于,还包括:The method of claim 13 or 14, further comprising:
    当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;When acquiring the user's operation of disconnecting the screencasting service, releasing the first binding relationship between the device identifiers of the first virtual display and the first virtual audio device;
    所述投屏业务模块向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。The screen projection service module sends a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship.
  16. 一种管理装置,其特征在于,应用于第一管理模块,所述第一管理模块包括:A management device, characterized in that it is applied to a first management module, and the first management module includes:
    第一接收单元,用于当终端设备启动投屏业务时,接收投屏业务模块发送的第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;The first receiving unit is configured to receive a first request sent by the screencasting service module when the terminal device starts the screencasting service, the first request is used to request the creation of a virtual audio device, and the first request includes the user's desire to cast a screen. Information about the first device on the screen;
    第一发送单元,用于向硬件抽象层HAL发送所述第一请求;a first sending unit, configured to send the first request to the hardware abstraction layer HAL;
    所述第一接收单元,还用于接收所述HAL发送的第一虚拟音频设备的设备标识, 所述第一虚拟音频设备根据所述第一设备的相关信息创建;The first receiving unit is further configured to receive the device identifier of the first virtual audio device sent by the HAL, and the first virtual audio device is created according to the relevant information of the first device;
    所述第一发送单元,还用于向所述投屏业务模块发送所述第一虚拟音频设备的设备标识,以使所述虚拟投屏业务模块建立虚拟显示屏display和所述第一虚拟音频设备之间的绑定关系。The first sending unit is further configured to send the device identification of the first virtual audio device to the screen-casting service module, so that the virtual screen-casting service module establishes a virtual display screen display and the first virtual audio Binding relationship between devices.
  17. 根据权利要求16所述的装置,其特征在于,The apparatus of claim 16, wherein:
    所述第一接收单元,还用于接收所述投屏业务模块发送的第一绑定关系,所述第一绑定关系包括第一虚拟显示屏display和所述第一虚拟音频设备的设备标识之间的对应关系;The first receiving unit is further configured to receive a first binding relationship sent by the screen projection service module, where the first binding relationship includes a first virtual display screen display and a device identifier of the first virtual audio device Correspondence between;
    第一处理单元,用于当第一应用请求播放音频流时确定第一虚拟display,根据所述第一虚拟display在所述第一绑定关系中查找第一虚拟音频设备的设备标识;a first processing unit, configured to determine a first virtual display when the first application requests to play an audio stream, and search for the device identifier of the first virtual audio device in the first binding relationship according to the first virtual display;
    所述第一发送单元,还用于向原生音频框架发送所述第一虚拟音频设备的设备标识,以使所述原生音频框架将对应的音频流通过所述第一虚拟音频设备输出到第一设备。The first sending unit is further configured to send the device identification of the first virtual audio device to the native audio framework, so that the native audio framework outputs the corresponding audio stream to the first virtual audio device through the first virtual audio device. equipment.
  18. 根据权利要求17所述的装置,其特征在于,The apparatus of claim 17, wherein:
    所述第一接收单元,还用于获取第一应用的标识;The first receiving unit is further configured to obtain the identifier of the first application;
    所述第一发送单元,还用于向第二管理模块发送所述第一应用的标识;The first sending unit is further configured to send the identifier of the first application to the second management module;
    所述第一接收单元,还用于接收所述第二管理模块根据所述第一应用的标识确定的所述第一虚拟display。The first receiving unit is further configured to receive the first virtual display determined by the second management module according to the identifier of the first application.
  19. 根据权利要求17或18所述的装置,其特征在于,The device according to claim 17 or 18, characterized in that,
    所述第一处理单元,还用于根据所述第一虚拟display确定第一音频焦点,所述第一音频焦点与所述第一虚拟display相对应,查询所述第一音频焦点的状态是否可用;The first processing unit is further configured to determine a first audio focus according to the first virtual display, the first audio focus corresponds to the first virtual display, and query whether the state of the first audio focus is available ;
    所述第一发送单元,还用于在所述第一处理单元查询所述第一音频焦点可用时,向所述原生音频框架发送所述第一音频焦点。The first sending unit is further configured to send the first audio focus to the native audio framework when the first processing unit queries that the first audio focus is available.
  20. 根据权利要求19所述的装置,其特征在于,The apparatus of claim 19, wherein:
    所述第一处理单元,还用于在查询所述第一音频焦点的状态不可用时,确定占用所述第一音频焦点的应用为第二应用;The first processing unit is further configured to determine that the application occupying the first audio focus is the second application when the state of the first audio focus is inquired to be unavailable;
    所述第一发送单元,还用于向所述原生音频框架发送第一指示信息,所述第一指示信息用于通知所述原生音频框架所述第一音频焦点需要被所述第一应用占用;以及,当所述第一接收单元接收到所述第二应用停止使用所述第一音频焦点的指示时,向所述原生音频框架发送所述第一音频焦点,以使所述第一应用获取所述第一音频焦点。The first sending unit is further configured to send first indication information to the native audio framework, where the first indication information is used to notify the native audio framework that the first audio focus needs to be occupied by the first application ; and, when the first receiving unit receives an instruction that the second application stops using the first audio focus, sending the first audio focus to the native audio framework, so that the first application Acquire the first audio focus.
  21. 根据权利要求19所述的装置,其特征在于,所述第一管理模块查询所述第一音频焦点的状态是否可用之前,还包括:The apparatus according to claim 19, wherein before the first management module inquires whether the state of the first audio focus is available, the method further comprises:
    所述第一处理单元,还用于获取第一虚拟display所关联的第一焦点管理记录,以及在所述第一焦点管理记录查询所述第一音频焦点的状态是否为空闲;The first processing unit is further configured to acquire a first focus management record associated with the first virtual display, and query whether the state of the first audio focus is idle in the first focus management record;
    其中,所述第一焦点管理记录中包括第一音频焦点的状态,所述第一音频焦点的状态包括空闲和使用,所述第一虚拟display唯一对应所述第一音频焦点。Wherein, the first focus management record includes the state of the first audio focus, the state of the first audio focus includes idle and in use, and the first virtual display uniquely corresponds to the first audio focus.
  22. 根据权利要求21所述的装置,其特征在于,The device of claim 21, wherein:
    所述第一处理单元,还用于按照虚拟display音频焦点机制维护所述第一焦点管理记录;The first processing unit is further configured to maintain the first focus management record according to the virtual display audio focus mechanism;
    所述虚拟display音频焦点机制包括:在同一个虚拟display中有两个或两个以上应用,且所述两个或两个以上应用同时申请音频焦点时,按照高优先级业务应用抢占低优先级业务的应用,和,同等优先级的业务应用遵循后申请应用抢占先申请应用的规则。The virtual display audio focus mechanism includes: there are two or more applications in the same virtual display, and when the two or more applications apply for audio focus at the same time, preempt the low priority according to the high priority service application Business applications, and business applications with the same priority follow the rule of applying for applications first and preempting applications later.
  23. 一种管理装置,其特征在于,应用于第二管理模块,所述第二管理模块包括:A management device, characterized in that it is applied to a second management module, the second management module comprising:
    第二接收单元,用于接收投屏业务模块发送的第二请求,所述第二请求用于创建投屏的虚拟display,其中所述第二请求中包括;指定虚拟display名称、大小以及分辨率信息;The second receiving unit is configured to receive a second request sent by the screen projection service module, where the second request is used to create a virtual display for screen projection, wherein the second request includes: specifying the name, size and resolution of the virtual display information;
    第二处理单元,用于根据所述指定虚拟display名称、大小以及分辨率信息创建第一虚拟display;a second processing unit, configured to create a first virtual display according to the specified virtual display name, size and resolution information;
    第二发送单元,用于向所述投屏业务模块发送所述第一虚拟display,以使所述虚拟投屏业务模块建立所述第一虚拟display和第一虚拟音频设备之间的第一绑定关系。a second sending unit, configured to send the first virtual display to the screen-casting service module, so that the virtual screen-casting service module establishes a first binding between the first virtual display and the first virtual audio device established relationship.
  24. 根据权利要求23所述的装置,其特征在于,The apparatus of claim 23, wherein:
    所述第二接收单元,还用于接收所述投屏业务模块发送的所述第一绑定关系;The second receiving unit is further configured to receive the first binding relationship sent by the screen projection service module;
    所述第二发送单元,还用于向所述第一管理模块发送所述第一绑定关系。The second sending unit is further configured to send the first binding relationship to the first management module.
  25. 根据权利要求23或24所述的装置,其特征在于,The device according to claim 23 or 24, characterized in that,
    所述第二接收单元,还用于当第一应用请求播放音频流时,所述第二管理模块获取第一应用的标识;The second receiving unit is further configured to, when the first application requests to play the audio stream, the second management module to obtain the identifier of the first application;
    所述第二处理单元,还用于根据所述第一应用的标识查找第一应用所属的第一虚拟display;The second processing unit is further configured to search for the first virtual display to which the first application belongs according to the identifier of the first application;
    所述第二发送单元,还用于向所述第一管理模块发送所述第一虚拟display。The second sending unit is further configured to send the first virtual display to the first management module.
  26. 根据权利要求25所述的装置,其特征在于,The apparatus of claim 25, wherein:
    所述第二接收单元,还用于在所述第一应用请求申请音频焦点时,接收所述第一管理模块发送的音频焦点请求,所述音频焦点请求中包括所述第一应用的标识。The second receiving unit is further configured to receive an audio focus request sent by the first management module when the first application requests to apply for audio focus, where the audio focus request includes the identifier of the first application.
  27. 根据权利要求25所述的装置,其特征在于,The apparatus of claim 25, wherein:
    所述第二接收单元,还用于在所述原生音频框架获取第一应用播放的音频流时,接收所述第一管理模块发送的所述第一应用的标识。The second receiving unit is further configured to receive the identifier of the first application sent by the first management module when the native audio framework acquires the audio stream played by the first application.
  28. 一种应用装置,其特征在于,应用于投屏业务模块,所述投屏业务模块包括:An application device, characterized in that it is applied to a screen projection service module, and the screen projection service module includes:
    第三接收单元,用于在获取用户启动投屏业务的操作时,获取第二管理模块创建的第一虚拟显示屏display;a third receiving unit, configured to acquire the first virtual display screen display created by the second management module when acquiring the operation of the user initiating the screen projection service;
    第三发送单元,用于在与期望投屏的第一设备建立虚拟音频链路后,向所述第一管理模块发送第一请求,所述第一请求用于请求创建虚拟音频设备,所述第一请求中包括用户期望投屏的第一设备的相关信息;A third sending unit, configured to send a first request to the first management module after establishing a virtual audio link with the first device expected to screen the screen, where the first request is used to request the creation of a virtual audio device, the The first request includes relevant information of the first device on which the user wishes to project the screen;
    所述第三接收单元,还用于接收所述第一管理模块发送的第一虚拟音频设备的设备标识;The third receiving unit is further configured to receive the device identifier of the first virtual audio device sent by the first management module;
    第三处理单元,用于所述投屏业务模块建立第一绑定关系,所述第一绑定关系包括所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的对应关系;a third processing unit, used for the screen projection service module to establish a first binding relationship, where the first binding relationship includes a corresponding relationship between the device identifiers of the first virtual display and the first virtual audio device ;
    所述第三发送单元,还用于向所述第一管理模块发送所述第一绑定关系。The third sending unit is further configured to send the first binding relationship to the first management module.
  29. 根据权利要求28所述的装置,其特征在于,The apparatus of claim 28, wherein:
    所述第三发送单元,还用于向所述第二管理模块发送第二请求,所述第二请求用于请求所述第二管理模块创建虚拟display;The third sending unit is further configured to send a second request to the second management module, where the second request is used to request the second management module to create a virtual display;
    所述第三接收单元,还用于接收所述第二管理模块根据所述第二请求创建的所述第一虚拟display。The third receiving unit is further configured to receive the first virtual display created by the second management module according to the second request.
  30. 根据权利要求28或29所述的装置,其特征在于,The device according to claim 28 or 29, characterized in that,
    所述第三处理单元,还用于当获取用户断开投屏业务的操作时,解除所述第一虚拟display和所述第一虚拟音频设备的设备标识之间的第一绑定关系;The third processing unit is further configured to release the first binding relationship between the device identifiers of the first virtual display and the first virtual audio device when the user's operation of disconnecting the screen projection service is obtained;
    所述第三接收单元,还用于向所述第一管理模块发送第一消息,所述第一消息用于通知所述第一管理模块删除所述第一绑定关系。The third receiving unit is further configured to send a first message to the first management module, where the first message is used to notify the first management module to delete the first binding relationship.
  31. 一种终端设备,其特征在于,包括:至少一个处理器和存储器,A terminal device, characterized by comprising: at least one processor and a memory,
    所述存储器,用于存储计算机程序指令;the memory for storing computer program instructions;
    所述至少一个处理器,用于执行所述指令,以实现如权利要求1至15中任一项所述的方法。The at least one processor for executing the instructions to implement the method of any one of claims 1 to 15.
  32. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序指令;A computer-readable storage medium, wherein computer program instructions are stored in the computer-readable storage medium;
    当所述计算机程序指令被运行时,实现如权利要求1至15中任一项所述的方法。The computer program instructions, when executed, implement a method as claimed in any one of claims 1 to 15.
PCT/CN2022/088205 2021-05-07 2022-04-21 Audio playing method and apparatus, and device WO2022233237A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110497072.1A CN115314584A (en) 2021-05-07 2021-05-07 Audio playing method, device and equipment
CN202110497072.1 2021-05-07

Publications (1)

Publication Number Publication Date
WO2022233237A1 true WO2022233237A1 (en) 2022-11-10

Family

ID=83853822

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/088205 WO2022233237A1 (en) 2021-05-07 2022-04-21 Audio playing method and apparatus, and device

Country Status (2)

Country Link
CN (1) CN115314584A (en)
WO (1) WO2022233237A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116974508A (en) * 2023-06-30 2023-10-31 荣耀终端有限公司 Audio focus control method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032555A (en) * 2018-07-06 2018-12-18 广州视源电子科技股份有限公司 Throw screen sound intermediate frequency data processing method, device, storage medium and electronic equipment
CN109889885A (en) * 2019-02-27 2019-06-14 努比亚技术有限公司 A kind of throwing screen control method, terminal and computer readable storage medium
CN111324327A (en) * 2020-02-20 2020-06-23 华为技术有限公司 Screen projection method and terminal equipment
EP3674881A1 (en) * 2017-11-06 2020-07-01 Samsung Electronics Co., Ltd. Electronic device and screen sharing method using same

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106792055A (en) * 2016-12-28 2017-05-31 福建星网视易信息系统有限公司 Screen method, equipment and system are thrown in real time
CN110248022A (en) * 2019-06-06 2019-09-17 武汉卡比特信息有限公司 A kind of throwing screen method of tripartite's application based on mobile phone interconnection
CN110769394B (en) * 2019-09-18 2021-10-01 华为技术有限公司 Video call method and electronic equipment
CN111634188B (en) * 2020-05-29 2023-03-24 阿波罗智联(北京)科技有限公司 Method and device for projecting screen
CN111954028B (en) * 2020-10-19 2021-03-02 深圳乐播科技有限公司 Screen projection method, device and equipment of audio data and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3674881A1 (en) * 2017-11-06 2020-07-01 Samsung Electronics Co., Ltd. Electronic device and screen sharing method using same
CN109032555A (en) * 2018-07-06 2018-12-18 广州视源电子科技股份有限公司 Throw screen sound intermediate frequency data processing method, device, storage medium and electronic equipment
CN109889885A (en) * 2019-02-27 2019-06-14 努比亚技术有限公司 A kind of throwing screen control method, terminal and computer readable storage medium
CN111324327A (en) * 2020-02-20 2020-06-23 华为技术有限公司 Screen projection method and terminal equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116974508A (en) * 2023-06-30 2023-10-31 荣耀终端有限公司 Audio focus control method and device

Also Published As

Publication number Publication date
CN115314584A (en) 2022-11-08

Similar Documents

Publication Publication Date Title
CN110958475A (en) Cross-device content projection method and electronic device
WO2021082829A1 (en) Bluetooth connection method and related apparatus
WO2021218864A1 (en) Implementation method for wi-fi peer-to-peer service and related device
JP7369281B2 (en) Device capacity scheduling method and electronic devices
WO2021121052A1 (en) Multi-screen cooperation method and system, and electronic device
WO2022121775A1 (en) Screen projection method, and device
WO2022021878A1 (en) Channel adjustment method and electronic device
WO2023130991A1 (en) Collaborative calling method and apparatus, device, storage medium, and program product
WO2022247455A1 (en) Audio distribution method, and electronic device
CN114697527A (en) Shooting method, system and electronic equipment
WO2022206770A1 (en) Method for collaborative work of applications between devices, and device
CN114741008A (en) Distributed cross-device cooperation method, electronic device and communication system
US7286823B2 (en) Mobile multimedia engine
WO2022127670A1 (en) Call method and system, and related device
WO2022233237A1 (en) Audio playing method and apparatus, and device
CN115002842B (en) Data transmission method, electronic equipment and readable storage medium
WO2023035834A1 (en) Wi-fi direct communication method and apparatus
EP4191409A1 (en) Shared library multiplexing method and electronic device
CN115002820B (en) Call state monitoring method, device, equipment and storage medium
CN114916017B (en) Data transmission method, electronic equipment and readable storage medium
CN115733884B (en) Request processing method and related device
WO2024140122A1 (en) Connection management method, apparatus, and system for electronic device
CN116700660B (en) Audio playing method and electronic equipment
CN117135532B (en) Audio data processing method, device and storage medium
WO2024093922A1 (en) Audio control method, storage medium, program product, and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22798578

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22798578

Country of ref document: EP

Kind code of ref document: A1