Audio data output method and device
By creating a virtual audio playback mode in the multimedia player and adjusting the audio data timestamp, the problem of asynchronous output of audio and video data caused by an abnormality of the audio output device is solved, and the synchronous output of audio and video data is realized after the device is restored, which improves the efficiency of the audio and video data. Playback quality and user experience.
Patent Information
- Application Number
- CN202110771744.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-08
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-07-08
AI Technical Summary
During the operation of the multimedia player, audio output device abnormalities or terminal device driver problems cause audio data to be unable to be output, causing audio and video data output to be out of sync, affecting playback quality.
By creating a virtual audio playback mode, adjusting the output timestamp of the audio data, ensuring that the audio data is output synchronously with the video data after the audio output device is restored, using a preset application interface set to create the target audio playback mode, and switching to Virtual audio playback mode avoids calling the hardware part of the audio output device or terminal device.
When the audio output device is abnormal, the audio data timestamp is adjusted through the virtual audio playback mode to ensure the synchronous output of audio and video data, improve the playback quality, and friendly prompt the user to check the device connection status to ensure the normal output of audio data.
Smart Images

Figure CN115604542B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of audio data processing, and in particular to an audio data output method and device. Background Art
[0002] During the operation of the multimedia player, audio data and video data need to be output. Normally, the audio data and video data are output synchronously to ensure the playback quality.
[0003] However, if the audio output device is abnormal or the terminal device itself has a problem with the driver, the audio will not be output or the audio playback will fail; ultimately, the output of audio data and video data will be out of sync, affecting the playback quality.
[0004] Therefore, how to synchronously output audio and video data to ensure playback quality when there is a problem with the audio output device or the terminal device's own driver is a problem that needs to be solved at present. Summary of the invention
[0005] The present application provides an audio data output method and device to ensure synchronous output of audio and video data and improve playback quality.
[0006] In a first aspect, an embodiment of the present application provides an audio data output method, the method comprising:
[0007] For a target multimedia player, based on a preset set of application program interfaces, a corresponding target audio playback mode is created, and based on the creation result, an audio data output result is monitored;
[0008] If it is determined based on the audio data output result that the audio data is not successfully output, a virtual audio playback mode is created, and the virtual audio playback mode is used to adjust the first output timestamp corresponding to the audio data, and the audio data is virtually output.
[0009] In a second aspect, an embodiment of the present application provides an audio data output device, the device comprising:
[0010] A creation unit, for creating a corresponding target audio playback mode for a target multimedia player based on a preset set of application program interfaces, and monitoring an audio data output result based on the creation result;
[0011] The first determination unit is used to create a virtual audio playback mode if it is determined based on the audio data output result that the audio data is not successfully output, and adopt the virtual audio playback mode to adjust the output timestamp corresponding to the audio data and virtually output the audio data.
[0012] In a possible implementation, the creation unit detects the audio output result based on the creation result, specifically for:
[0013] If the corresponding target audio playback mode is not successfully created, it is determined that the audio data is not successfully output;
[0014] If the corresponding target audio playback mode is successfully created, but the audio data is not successfully written to the sound card using the successfully created target audio playback mode, it is determined that the audio data is not successfully output.
[0015] In a possible implementation, the preset application program interface set includes at least two application program interfaces;
[0016] The creation unit is specifically used to: read the application program interface from the application program interface set through the audio output adapter according to the preset interface arrangement order; wherein:
[0017] Each time an application program interface is read, a corresponding target audio playback mode is created based on the application program interface; if the creation is successful, the target audio playback mode is adopted to write the audio data into the sound card.
[0018] In a possible implementation, after the creation unit reads an application program interface each time and creates a corresponding target audio playback mode based on the application program interface, it is further configured to:
[0019] If the creation fails and it is determined that an application interface is not the last application interface in the interface arrangement sequence, continue to read the next application interface;
[0020] If the creation fails, and an application program interface is determined to be the last application program interface in the interface arrangement sequence, it is determined that the corresponding target audio playback mode is not successfully created based on the application program interface set.
[0021] In a possible implementation, the creation unit adopts the target audio playback mode, and after writing the audio data to the sound card, is further used to:
[0022] If writing to the sound card fails, and it is determined that an application interface is not the last application interface in the interface arrangement sequence, the target audio playback mode is destroyed and the next application interface is read;
[0023] If writing to the sound card fails, and an application program interface is determined to be the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed and a virtual audio playback mode is created.
[0024] In a possible implementation, before the creation unit creates the corresponding target audio playback mode based on the preset application program interface set, it is further configured to:
[0025] When the existence of a historical audio playback mode is detected, the historical audio playback mode is destroyed, wherein the historical audio playback mode is one of a historical target audio playback mode and a historical virtual audio playback mode.
[0026] In a possible implementation, the second determining unit adopts a virtual audio playback mode, and after virtually outputting the audio data, is further configured to:
[0027] Monitor the status information of the audio output device through the audio device monitor;
[0028] Based on the status information, after determining that the type of the connected audio output device has changed and determining that the most recently connected audio output device is the target device, a corresponding target audio playback mode is re-created based on a preset application program interface set.
[0029] In a possible implementation, if the creation unit determines based on the creation result that the corresponding target audio playback mode is not successfully created, the creation unit is further configured to:
[0030] The reminder information is presented on the display interface; wherein the reminder information is used to remind the user to check whether the connection status of the audio output device is normal.
[0031] In a possible implementation manner, the first determining unit is specifically configured to:
[0032] According to the second output timestamp corresponding to the video data contained in the playback time point query instruction, the first output timestamp corresponding to the audio data is adjusted so that the time point corresponding to the first output timestamp is consistent with the second output timestamp;
[0033] The first output timestamp corresponding to the output audio data.
[0034] In a third aspect, an embodiment of the present application provides an audio data output device, comprising: a memory and a processor, wherein the memory is used to store computer instructions; and the processor is used to execute computer instructions to implement the audio data output method provided in the embodiment of the present application.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, the audio data output method provided in the embodiment of the present application is implemented.
[0036] The beneficial effects of this application are as follows:
[0037] The embodiment of the present application provides an audio data output method, device and storage medium, which are applied to the field of audio data processing technology. In the embodiment of the present application, for a target multimedia player, a corresponding target audio playback mode is created based on a preset application program interface set, and based on the creation result, the audio data output result is monitored; if it is determined based on the audio data output result that the audio data is not successfully output, a virtual audio playback mode is created, and the virtual audio playback mode is used to adjust the first output timestamp corresponding to the audio data, and the audio data is virtually output, wherein the virtual audio playback mode is a compatible process, which ensures that the timestamps of audio data and video data are synchronized, and there is no need to call the hardware part corresponding to the audio output device or terminal device driver; therefore, when the target audio playback mode cannot be successfully created due to an abnormality of the audio output device, or the playback fails based on the target audio playback mode due to a problem with the terminal device driver, the virtual audio playback mode can be used to adjust the output timestamp of the audio data to ensure that the timestamps of the audio data and the video data are synchronized, so that after the audio output device is restored, when the target audio playback mode is used to output the audio data, the audio data and the video data are output synchronously to improve the playback quality.
[0038] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent from the description, or may be understood by practicing the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A schematic diagram of synchronously outputting audio and video data;
[0041] Figure 2 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0042] Figure 3 A structural diagram of a terminal device provided in an embodiment of the present application;
[0043] Figure 4 A schematic diagram of the structure of a memory provided in an embodiment of the present application;
[0044] Figure 5 A flow chart of a method for outputting audio data provided in an embodiment of the present application;
[0045] Figure 6A schematic diagram of the working process of the first audio output adapter provided in an embodiment of the present application;
[0046] Figure 7 A schematic diagram of an embodiment of the present application providing a reminder for a user to check whether the connection status of an audio output device is normal;
[0047] Figure 8 A schematic diagram of the cooperation between an audio output adapter and an audio device monitor provided in an embodiment of the present application;
[0048] Fig. 9 A schematic diagram of a workflow of an audio device monitor provided in an embodiment of the present application;
[0049] Fig.10 A schematic diagram of a second audio output adapter workflow provided in an embodiment of the present application;
[0050] Fig.11 A schematic diagram of a third audio output adapter workflow provided in an embodiment of the present application;
[0051] Fig.12 A schematic diagram of a fourth audio output adapter workflow provided in an embodiment of the present application;
[0052] Fig.13 A structural diagram of an audio data output device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and beneficial effects of this application clearer, the technical solution in the embodiment of this application will be clearly and completely described in conjunction with the drawings in the embodiment of this application. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0055] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0056] 1. The target multimedia player is an application that can output audio data and video data, including but not limited to: video player, music player.
[0057] 2. Application Programming Interface (API) is a set of predefined interfaces or agreements for connecting different components of a software system. It is used to provide a set of routines that applications and developers can access based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.
[0058] 3. The Audio Output Adapter (Sound Out Adapter) is used to control the output of audio data and realize the audio data playback function; it will create a target audio playback mode and a virtual audio playback mode to realize the output of audio data;
[0059] The target audio playback mode corresponds to an audio playback mode that converts audio data into a sound signal and outputs the sound signal normally through an audio output device;
[0060] The virtual audio playback mode corresponds to a compatible process, and no sound signal is played from the audio output device. It is only used to adjust the output timestamp of the audio data to ensure that the audio data and video data are output synchronously when the audio data device is restored and switched to the target audio playback mode.
[0061] 4. The Audio Device Monitor is used to monitor the status information of the audio output device; the status information that can be monitored includes but is not limited to: hot plugging of the audio output device, disabling of the audio output device, restoration of the audio output device, and missing of the audio output device.
[0062] 5. Audio output device, which is a device that can output sound signals, such as a speaker built into the terminal device, a headset connected to the terminal device via an external interface, or an external playback device connected to the terminal device via Bluetooth.
[0063] The following is a brief introduction to the design concept of the embodiments of the present application.
[0064] The embodiments of the present application relate to the operation or creation process of a target multimedia player installed in a terminal device, and in particular to a scenario in which audio data and video data are synchronously output during the operation or creation process of the target multimedia player.
[0065] During the operation of the target multimedia player, the video data and audio data are required to be output synchronously to ensure the playback quality; please refer to Figure 1 , taking the target multimedia player as a video player as an example, a schematic diagram of the target multimedia player synchronously outputting video data and audio data is provided. Figure 1It can be seen that when a video is played through a video player, the screen image corresponding to the video frame is displayed on the display interface of the terminal device, and the text information corresponding to the current video frame is displayed in the screen image. At the same time, the sound signal corresponding to the audio data is output through the audio output device external to the terminal device. The output sound signal is consistent with the content corresponding to the text information, that is, the audio data and the video data are output synchronously.
[0066] However, in the related art, during the operation of the target multimedia player, due to an abnormality in the audio output device, such as the audio output device is disabled or missing, etc., it will lead to the failure to create an audio playback mode through a set application interface, which will cause the audio data to be unable to be output, or the audio data playback fails; or the audio output device is normal, but there is a problem with the terminal device's own driver, and the audio data cannot be output, or the audio data playback fails; since there is no audio data output when the audio and video output device is disabled or missing, the audio data and video data cannot be output synchronously after the audio and video output device is restored, affecting the playback quality.
[0067] In view of this, the embodiments of the present application provide an audio data output method, apparatus and storage medium, which are used to ensure synchronous output of audio data and video data after the audio output device is restored, thereby improving the playback quality.
[0068] In an embodiment of the present application, for a target multimedia player, a corresponding target audio playback mode is created based on a preset set of application program interfaces, and a creation result is obtained; then, based on the creation result, the audio data output result is monitored; wherein the creation result is used to characterize whether the target audio playback mode is successfully created, and the audio data output result is used to characterize whether there is a sound signal output.
[0069] In a possible implementation, if it is determined based on the creation result that the corresponding target audio playback mode is successfully created, it is determined that the audio data is not output successfully, that is, no sound signal is output;
[0070] If, based on the creation result, it is determined that the corresponding target audio playback mode is successfully created, but the audio data is not successfully written to the sound card using the target audio playback mode, it is determined that the audio data is not successfully output, that is, no sound signal is output.
[0071] After determining that the audio data is not successfully output based on the audio data output result, a virtual audio playback mode is created, and the output timestamp corresponding to the audio data is adjusted using the virtual audio playback mode, and the audio data is virtually output.
[0072] In the embodiment of the present application, the preset application interface set includes at least two application interfaces, and at least two application interfaces have a fixed interface arrangement order; when creating a corresponding target audio playback mode based on the preset application interface set, the sound output adapter uses the application interfaces in the preset application interface set in sequence according to the interface arrangement order to create the corresponding target audio playback mode until the creation is successful, and the audio data is written to the sound card using the successfully created target audio playback mode to ensure the normal output of the audio data;
[0073] If all attempts to create the target audio playback mode through the application program interface in the application program interface set fail, the sound output adapter creates a virtual audio playback mode based on a preset method class, and uses the virtual audio playback mode to adjust the output timestamp corresponding to the audio data, and uses the adjusted output timestamp to virtually output the audio data; at the same time, after determining that all attempts to create the target audio playback mode have failed, a reminder message is displayed on the display interface to remind the user to check whether the connection status of the audio output device is normal.
[0074] If the target audio playback mode is successfully created through the application program interface in the application program interface set, but the audio data is not successfully written to the sound card using the successfully created target audio playback mode, that is, the audio data is not successfully output, the sound output adapter creates a virtual audio playback mode based on a preset method class, and uses the virtual audio playback mode to adjust the output timestamp corresponding to the audio data, and uses the adjusted output timestamp to virtually output the audio data; at the same time, after determining that the audio data is not successfully written to the sound card, a reminder message is displayed on the display interface to remind the user to check whether the connection status of the audio output device is normal.
[0075] In a possible implementation, while creating the virtual audio playback mode, a reminder message for reminding the user to check whether the connection status of the audio output device is normal may be displayed on the display interface.
[0076] In the embodiment of the present application, when an audio output device is abnormal, the output timestamp of the audio data is adjusted using a virtual audio playback mode, so that after the audio output device is restored, the output timestamps of the audio data and the video data are guaranteed to be consistent, that is, the audio data and the video data are output synchronously, thereby ensuring the playback quality. At the same time, when the audio output device fails, the user is prompted to perform corresponding operations in a friendly manner, so as to restore the audio output device in time and ensure the normal output of the audio data.
[0077] After introducing the design ideas of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In the specific implementation process, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0078] Please refer to Figure 2 , Figure 2 An application scenario in an embodiment of the present application is exemplarily provided, and the application scenario includes a terminal device 10 and a server 20;
[0079] Among them, the terminal device 10 is a terminal device that has installed and run a target multimedia player and website with multimedia playback function, such as a terminal device that has installed and run target multimedia players such as a music player, a video player, and a reading player; it can be a personal computer, a mobile phone, a tablet computer, a notebook, an e-book reader, a car terminal, and other computer devices.
[0080] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of the terminal device 10 in an embodiment of the present application is shown.
[0081] The following describes the embodiment of the present application by taking a terminal device 10 as an example. It should be understood that: Figure 3 The terminal device 10 shown is only an example, and the terminal device 10 may have more Figure 3 The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0082] Figure 3 exemplarily shows a hardware configuration block diagram of a terminal device 10. Figure 3 As shown, the terminal device 10 includes: a radio frequency (RF) circuit 100, a memory 110, an input / output (I / O) interface 120, a display unit 130, an audio circuit 140, a communication interface 150, a wireless fidelity (Wi-Fi) module 160, a processor 170 and other components.
[0083] The RF circuit 100 can be used to receive and send signals during the process of sending and receiving information. It can receive downlink data from the base station and hand it over to the processor 170 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.
[0084] The memory 110 may be used to store program codes and data;
[0085] In one possible implementation, the memory 110 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1101 and / or a cache memory 1102, and may further include a read-only memory (ROM) 1103;
[0086] The memory 110 may also include a program / utility 1105 having a set of (at least each) program modules 1104, see Figure 4 , Figure 4 An exemplary structure diagram of a memory 110 is provided; wherein the program module 1104 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data, and each or some combination of these examples may include the implementation of a network environment.
[0087] The input / output (I / O) interface 120 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 10. Specifically, the input / output (I / O) 120 may include a touch panel 121 disposed on the front of the terminal device 10, which is used to collect user touch operations on the touch panel 121 and determine various instructions triggered by the user, such as clicking a button, dragging a scroll box, etc. In a possible implementation, the input / output (I / O) interface 120 also includes other input / output devices 122, such as voice input / output, etc.
[0088] In one possible implementation, the input / output (I / O) interface 120 can enable the terminal device 10 to communicate with one or more external devices (such as a keyboard, a pointing device, etc.), and can also communicate with one or more devices that enable a user to interact with the terminal device 10, and / or communicate with any device that enables the terminal device 10 to communicate with one or more other computing devices (such as a router, a modem, etc.).
[0089] The display unit 130 may be used to display information input by a user or information provided to a user and a graphical user interface (GUI) of various menus of the terminal device 10. Specifically, the display unit 130 may include a display panel 131 disposed on the front of the terminal device 10. The display screen 131 may be configured in the form of a liquid crystal display, a light emitting diode, or the like.
[0090] In a possible implementation, the touch panel 121 can be covered on the display panel 131, or the touch panel 121 and the display panel 131 can be integrated to realize the input and output functions of the terminal device 10, and the integration can be referred to as a touch display screen. In the present application, the display unit 130 can display the video frame played by the target multimedia player, display the reminder information to remind the user to check whether the connection status of the audio output device is normal, and the corresponding operation steps.
[0091] An audio circuit 140 , wherein the audio circuit 140 is connected to a speaker 141 and a microphone 142 ;
[0092] In a possible implementation, the audio circuit 140, the speaker 141, and the microphone 142 may provide an audio interface between the user and the terminal device 10. The audio circuit 140 may transmit the electrical signal converted from the received audio data to the speaker 141, which is converted into a sound signal for output. The terminal device 10 may also be configured with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 142 converts the collected sound signal into an electrical signal, which is received by the audio circuit 140 and converted into audio data, and then the audio data is output to the RF circuit to be sent to, for example, another terminal, or the audio data is output to a memory for further processing.
[0093] The communication interface 150 is used for the terminal device 10 to communicate with the server 20 and obtain data.
[0094] Wi-Fi is a short-range wireless transmission technology. The terminal device 10 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 160, which provides users with wireless broadband Internet access.
[0095] The processor 170 runs the program code or data stored in the memory 110. When the program code is executed by the processor 170, the processor 170 performs the various steps of the audio data output method of various exemplary embodiments of the present application;
[0096] The processor 170 is the control center of the terminal device 10, and uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal device 10 and processes data by running or executing the software program of the target multimedia player stored in the memory 110 and reading the data stored in the memory 110.
[0097] In some embodiments, the processor 170 may include one or more processing units; the processor 170 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes an operating system, a user interface, and applications, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 170. In the embodiment of the present application, the processor 170 may run an operating system, an application, a user interface display and a touch response, and a processing method of the embodiment of the present application. In addition, the processor 170 is coupled to the input / output interface 120 and the display unit 130.
[0098] It should be noted that the above-mentioned components are connected via bus 180, which represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus structures.
[0099] The terminal device 10 provided in the embodiment of the present application also includes a Bluetooth module, a power supply, a network adapter, etc. Among them:
[0100] The Bluetooth module is used to exchange information with other Bluetooth devices having a Bluetooth module through the Bluetooth protocol. For example, the terminal device 10 can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module to exchange data.
[0101] The power supply can be logically connected to the processor 170 through the power management system, so that the power management system can manage charging, discharging, power consumption, etc. The terminal device 10 can also be configured with a power button for turning on and off the terminal, as well as locking the screen, etc.
[0102] The terminal device 10 can communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter. The network adapter communicates with other modules of the terminal device 10 through a bus.
[0103] It should be understood that although Figure 3 Not shown, other hardware and / or software modules may be used in conjunction with the terminal device 10, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAVD systems, tape drives, and data backup storage systems.
[0104] Among them, the server 20 in the above application scenario is a server that includes the service end of the target multimedia player; the server 20 can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.
[0105] In a possible implementation, the terminal device 10 and the server 20 can communicate with each other through a communication network, which is a wired network or a wireless network. Therefore, the terminal device 10 and the server 20 can be directly or indirectly connected through a wired or wireless communication. For example, the terminal device 10 can also be indirectly connected to the server 20 through a wireless access point 12, or the terminal device 10 can be directly connected to the server 20 through the Internet, and this application does not limit this.
[0106] In a possible application scenario, when the target multimedia player is running in the terminal device 10, the terminal device 10 obtains audio and video data from the server corresponding to the target multimedia player contained in the server 20, and synchronously renders the obtained audio and video data to ensure the synchronous output of audio data and video data.
[0107] In a possible application scenario, in order to reduce communication latency, servers 20 can be deployed in various regions, or for load balancing, different servers 20 can serve the regions corresponding to each publisher terminal device 10 and the regions corresponding to each terminal device 10. Multiple servers 20 can also share data through blockchain, and multiple servers 20 are equivalent to a data sharing system composed of multiple servers 20.
[0108] Each server 20 in the data sharing system has a node identifier corresponding to the server 20. Each server 20 in the data sharing system can store the node identifiers of other servers 20 in the data sharing system, so that the generated blocks can be broadcast to other servers 20 in the data sharing system according to the node identifiers of other servers 20.
[0109] Based on the above application scenarios, the audio data output method provided by the exemplary embodiment of the present application is described below in combination with the application scenarios described above according to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this respect.
[0110] Please refer to Figure 5 , Figure 5 An audio data output method in an embodiment of the present application is exemplarily provided, which is applied to a terminal device, and the method includes:
[0111] Step S500, for the target multimedia player, based on a preset set of application program interfaces, a corresponding target audio playback mode is created, and based on the creation result, the audio data output result is monitored.
[0112] The creation result is used to indicate whether the corresponding target audio playback mode is successfully created based on the preset application program interface set;
[0113] When a corresponding target audio playback mode is successfully created based on an application program interface in the preset application program interface set, it is determined that the corresponding target audio playback mode is successfully created;
[0114] When the corresponding target audio playback mode is not successfully created based on all the application program interfaces in the preset application program interface set, it is determined that the corresponding target audio playback mode is not successfully created.
[0115] The audio data output result is used to indicate whether there is actual audio data output, that is, whether there is sound signal output;
[0116] When a corresponding target audio playback mode is successfully created based on one of the preset application program interface sets, and the audio data is successfully written into the sound card using the successfully created target audio playback mode, it is determined that the audio data is successfully output;
[0117] When all application program interfaces in the preset application program interface set fail to successfully create the corresponding target audio playback mode, it is determined that the audio data is not successfully output;
[0118] When a corresponding target audio playback mode is successfully created based on at least one application program interface in a preset application program interface set, but audio data is not successfully written to the sound card using the successfully created target audio playback mode, it is determined that the audio data is not successfully output.
[0119] In the embodiment of the present application, when it is determined that the audio data is output successfully, it means that the audio output device is normal; when the audio data is not output successfully, it is determined that the audio output device is disabled or faulty. At this time, a virtual audio output mode is used to adjust the output timestamp of the audio data to ensure that after the audio output device is restored, the output timestamps of the audio data and the video data are consistent, and the audio data and the video data are output synchronously to improve the playback quality. Therefore, after it is determined that the audio data is not output successfully, step S501 is executed.
[0120] Step S501: If it is determined based on the audio data output result that the audio data is not output successfully, a virtual audio playback mode is created, and the first output timestamp corresponding to the audio data is adjusted using the virtual audio playback mode, and the audio data is virtually output.
[0121] In the embodiment of the present application, the preset application program interface set includes at least two application program interfaces, and the at least two application program interfaces included have a fixed interface arrangement order;
[0122] Among them, the application program interface includes but is not limited to: dsound, wasapi, and waveout.
[0123] In a possible implementation, the audio output adapter creates a corresponding target audio playback mode based on an application program interface; and the audio output adapter creates a virtual audio playback mode based on a preset method class;
[0124] Among them, the virtual audio playback mode is implemented by the software part, which corresponds to the execution logic when the target audio playback mode is executed. However, the virtual audio playback mode does not need to call the hardware parts such as the audio output device and the terminal device's own driver. It only adjusts the output timestamp of the audio data. Therefore, the virtual audio playback mode is adopted to output the output timestamp corresponding to the audio data, realize the virtual output of the audio data, and ensure the synchronization of the output timestamps of the audio data and the video data.
[0125] Therefore, when creating a corresponding target audio playback mode based on a preset application interface set, it is necessary to call the audio output adapter, and through the audio output adapter, read the application interface in the application interface set according to the interface arrangement order, and create the corresponding target audio playback mode based on the read application interface.
[0126] During the process of creating and running the target multimedia player, it is necessary to create the target audio playback mode through the audio output adapter, and based on the creation result, determine whether it is necessary to create a virtual audio playback mode based on the preset method class to ensure the synchronization of audio and video data.
[0127] The following two embodiments are used to describe in detail the workflow of the audio output adapter during the creation of the target multimedia player and during the operation and playback of the target multimedia player.
[0128] Embodiment 1: Process of creating a target multimedia player.
[0129] In a possible implementation, during the creation of the target multimedia player, the application program interface is read from the application program interface set through the audio output adapter according to a preset interface arrangement order.
[0130] At this time, the audio output adapter creates a corresponding target audio playback mode based on each read application interface, and determines whether the corresponding target audio playback mode is successfully created based on the read application interface.
[0131] If the creation is determined to be successful, the target audio playback mode is used to write the audio data to the sound card, so as to read the audio data from the sound card and output it.
[0132] In a possible implementation, after determining that the corresponding target audio playback mode is successfully created based on the read application program interface, the successfully created target audio playback mode is output so that audio data can be subsequently written to the sound card based on the target audio playback mode.
[0133] If it is determined that the creation fails, determining whether the read application program interface is the last application program interface in the interface arrangement sequence;
[0134] When it is determined that the currently read application interface is not the last application interface in the interface arrangement order, continue to read the next adjacent application interface, and continue to create the corresponding target audio playback mode based on the read application interface until one application interface in the application interface set is successfully created; or all application interfaces in the application interface set fail to be created, that is, when the read application interface is determined to be the last application interface in the interface arrangement order, the audio output adapter will create a virtual audio playback mode.
[0135] Please refer to Figure 6 , Figure 6 An exemplary workflow diagram of the first audio output adapter in the embodiment of the present application is provided. It is assumed that the preset application program interface set includes three application program interfaces, namely dsound, wasapi, and waveout, and the interface arrangement order of the three application program interfaces is: dsound->wasapi->waveout;
[0136] At this time, the audio output adapter creates an audio playback mode including the following steps:
[0137] Step S600, the audio output adapter reads the application program interface dsound;
[0138] Step S601, the audio output adapter creates a corresponding target audio playback mode (DirectSoundOut) based on the read application program interface dsound;
[0139] Among them, DirectSoundOut is an audio playback mode created based on the application program interface dsound;
[0140] Step S602, the audio output adapter determines whether the corresponding target audio playback mode is successfully created based on the application program interface dsound, if so, execute step S609, otherwise execute step S603;
[0141] Step S603, the audio output adapter reads the application program interface wasapi;
[0142] Step S604, the audio output adapter creates a corresponding target audio playback mode (wasapiSoundOut) based on the read application program interface wasapi;
[0143] Among them, wasapiSoundOut is an audio playback mode created based on the application program interface wasapi;
[0144] Step S605, the audio output adapter determines whether the corresponding target audio playback mode is successfully created based on the application program interface wasapi, if so, execute step S609, otherwise execute step S606;
[0145] Step S606, the audio output adapter reads the application program interface waveout;
[0146] Step S607, the audio output adapter creates a corresponding target audio playback mode (WaveOut) based on the read application program interface waveout;
[0147] Among them, WaveOut is an audio playback mode created based on the application program interface wasapi;
[0148] Step S608, the audio output adapter determines whether the corresponding target audio playback mode is successfully created based on the application program interface waveout, if yes, execute step S609, otherwise execute step S610;
[0149] Step S609, the audio output adapter adopts the successfully created target audio playback mode to write the audio data into the sound card;
[0150] Step S610: After the audio output adapter determines that the corresponding target audio playback mode has not been successfully created based on the application program interface set, it creates a virtual audio playback mode (VirtualSoundOut).
[0151] In a possible implementation, after determining that the audio output adapter has not successfully created the corresponding target audio playback mode based on all the application program interfaces in the application program interface set, a reminder message is displayed in the display interface, wherein the reminder message is used to remind the user to check whether the connection status of the audio output device is normal. Please refer to Figure 7 , Figure 7 A schematic diagram is exemplarily provided in an embodiment of the present application for reminding a user to check whether the connection status of an audio output device is normal.
[0152] In a possible implementation, when a virtual audio playback mode is created and the audio data is virtually output using the virtual audio playback mode, a reminder message may be displayed in the display interface.
[0153] If the user receives Figure 7 After the reminder message is shown, no operation is performed in response to the reminder message, that is, after no operation instruction from the user is received, the virtual audio playback mode will continue to run without the user's perception, thereby improving the robustness of the target multimedia player.
[0154] In a possible implementation, before creating a corresponding target audio playback mode based on a preset set of application program interfaces through an audio output adapter, the audio output adapter also detects whether there is a historical audio playback mode at present. If it is determined that there is a historical audio playback mode, the historical audio playback mode is first destroyed, and then the creation process is performed after the destruction, so as to avoid the phenomenon of freezing of the target multimedia player;
[0155] The historical audio playback mode is one of the historical target audio playback mode and the historical virtual audio playback mode.
[0156] It should be noted that the audio device listener can also be started during the creation of the target multimedia player. However, in order to save resources, the audio device listener is usually started during the operation and playback of the target multimedia player.
[0157] Embodiment 2: The process of the target multimedia player running and playing.
[0158] During the playback of the target multimedia player, the audio device listener is started. In order to better ensure the audio data output of the target multimedia player and the synchronization of audio data and video data, the audio device listener and the audio output adapter are coordinated with each other; please refer to Figure 8 , Figure 8 A schematic diagram of the cooperation between an audio output adapter and an audio device monitor in an embodiment of the present application is exemplarily provided.
[0159] The audio device listener monitors the status information of the audio output device, and based on the monitored status information, after determining that the audio output device has changed and determining that an audio playback mode adjustment instruction needs to be sent to the audio output adapter, the audio playback mode adjustment instruction is sent to the audio output adapter to enable the audio output adapter to adjust the audio playback mode.
[0160] Please refer to Fig. 9 , Fig. 9 A schematic diagram of a workflow of an audio device monitor in an embodiment of the present application is provided as an example. The workflow of the audio device monitor specifically includes the following steps:
[0161] Step S900, the audio device monitor obtains the status information of the audio output device;
[0162] In a possible implementation, the audio device listener is first registered in the system event notification callback (Register Endpoint Notification Callback), and the plug-and-play status information of the audio output device is determined through the system device enumeration interface (IMM DeviceEnumerator); then, the determined status information is returned to the audio device listener through the system event notification callback, and at this time, the audio device listener obtains the status information of the audio output device;
[0163] The status information of the audio output device includes, but is not limited to: the hot-plug status of the audio output device, the audio output device is disabled, the audio output device is restored to be available, and the audio output device is missing.
[0164] Step S901, the audio device monitor determines that the type of the connected audio output device has changed based on the received status information, and then obtains parameter information of the audio output device in the status information;
[0165] In a possible implementation, after receiving the status information of the audio output device, the audio device listener determines that the audio output device has changed, and then runs the On Default Device Changed function to obtain the parameter information of the audio output device carried in the status information.
[0166] Step S902: the audio device monitor determines that the changed audio output device is the target device based on the acquired parameter information of the audio output device, and then sends audio playback mode adjustment information to the audio output adapter;
[0167] The target device selected by the user may be an audio output device re-selected by the user or an audio output device set by default on the terminal device; the audio output device type change includes two situations: the audio output device changes from normal to abnormal, that is, the audio output device is determined to be disabled / missing, and the audio output device is restored to be available after being abnormal;
[0168] Specifically, when the audio output device changes from normal to abnormal, the audio device listener will notify the audio output adapter to create a virtual audio playback mode; when the audio output device recovers from the abnormality, the audio device listener will notify the audio output adapter to create a target audio playback mode.
[0169] Therefore, during the operation and playback of the multimedia audio player, the current audio output device is normal and uses the target audio playback mode to output audio data; at this time, when the audio device listener detects that the audio output device is abnormal, it will notify the audio output adapter to create a virtual audio playback mode; or
[0170] During the operation and playback of the multimedia audio player, the current audio output device is abnormal and the audio data is output in virtual audio playback mode. At this time, the audio output adapter will be notified to create the target audio playback mode only when the audio device listener detects that the audio output device is restored.
[0171] The above two situations are explained below respectively.
[0172] Case 1: When the target multimedia player is running and playing, the target audio playback mode is used to output audio data.
[0173] Please refer to Fig.10 , is a schematic diagram of the working process of the second audio output adapter in the embodiment of the present application, which specifically includes the following steps:
[0174] Step S1000, the audio output adapter receives an adjustment instruction for creating a virtual audio playback mode sent by the audio device monitor;
[0175] The adjustment instruction is sent after the audio device monitor detects that the audio output device changes from normal to abnormal.
[0176] Step S1001: the audio output adapter destroys the target audio play mode and creates a virtual audio play mode.
[0177] In a possible implementation, when it is determined that the target audio playback mode is destroyed and a virtual audio playback mode is created, a reminder message is presented in the display interface to remind the user to check whether the connection status of the audio output device is normal. Figure 7 , I will not go into details here.
[0178] Case 2: When the target multimedia player is running and playing, the virtual audio playback mode is used to output audio data.
[0179] Please refer to Fig.11 , is a schematic diagram of the working process of the third audio output adapter in the embodiment of the present application, comprising the following steps:
[0180] Step S1100, the audio output adapter receives an adjustment instruction for creating a target audio playback mode sent by the audio device monitor;
[0181] Step S1101, the audio output adapter destroys the virtual audio play mode and creates a corresponding target audio play mode based on a preset application program interface set;
[0182] It should be noted that the implementation method of destroying the virtual audio playback mode and creating the corresponding target audio playback mode based on the preset application program interface set can be found in Figure 6 , I will not go into details here.
[0183] For the above-mentioned situations 1 and 2, after receiving the adjustment instruction, the audio output adapter initiates an asynchronous task, destroys the original audio playback mode, and creates a new audio playback mode. In the embodiment of the present application, the asynchronous form is adopted because both creating and destroying the audio playback mode involve hardware operations, which are time-consuming to varying degrees. The asynchronous implementation does not affect the operation of the entire main thread and avoids the phenomenon of program jamming.
[0184] In the above-mentioned first and second embodiments, when it is determined that the target audio playback mode is adopted and the audio data is written into the sound card, during the process of writing the audio data into the sound card, the audio output adapter also detects whether the audio data is successfully written;
[0185] If it is detected that the target audio playback mode fails to write audio data to the sound card, and it is determined that an application program interface corresponding to the target audio playback mode is not the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed and the next application program interface is read; or
[0186] If it is detected that writing audio data to the sound card using the target audio playback mode fails, and it is determined that an application program interface corresponding to the target audio playback mode is the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed and a virtual audio playback mode is created;
[0187] Please refer to Fig.12 , Fig.12An exemplary workflow diagram of the third audio output adapter in the embodiment of the present application is provided. It is assumed that the preset application program interface set includes three application program interfaces, namely dsound, wasapi, and waveout, and the interface arrangement order of the three application program interfaces is: dsound->wasapi->waveout;
[0188] Step S1200, the audio output adapter determines that a corresponding target audio playback mode (DirectSoundOut) is successfully created based on the read application program interface dsound;
[0189] Step S1201, the audio output adapter uses DirectSoundOut to write audio data to the sound card;
[0190] In a possible implementation, when DirectSoundOut is used to write audio data to a sound card, the audio data is written to a designated area between IDirectSoundBuffer8Lock and Unlock;
[0191] Step S1202, the audio output adapter determines whether the writing is successful, if successful, executes step S1209, otherwise executes step S1203;
[0192] Step S1203, the audio output adapter destroys DirectSoundOut, and determines to create a corresponding target audio playback mode (wasapiSoundOut) based on the read application program interface wasapi;
[0193] Step S1204, after the audio output adapter determines that wasapiSoundOut is successfully created, the audio data is written to the sound card using wasapiSoundOut;
[0194] In one possible implementation, when wasapiSoundOut is used to write audio data to a sound card, the audio data is written to a specified area between IAudioRenderClientGetBuffer and ReleaseBuffer;
[0195] Step S1205, the audio output adapter determines whether the writing is successful, if successful, executes step S1209, otherwise executes step S1206;
[0196] Step S1206, the audio output adapter destroys wasapiSoundOut, and determines to create a corresponding target audio playback mode (WaveOut) based on the read application program interface waveout;
[0197] Step S1207, after the audio output adapter determines that WaveOut is successfully created, the audio data is written to the sound card using WaveOut;
[0198] In a possible implementation, when WaveOut is used to write audio data to a sound card, the audio data is written to a specified area (::WaveOutWrite) between ::WaveOutPrepareHeader and ::WaveOutUnprepareHeader.
[0199] Step S1208, the audio output adapter determines whether the writing is successful, if successful, executes step S1209, otherwise executes step S1210;
[0200] Step S1209, end; wherein end means that the creation of the corresponding target audio playback mode based on the preset application program interface set is ended;
[0201] That is, the target audio playback mode is successfully created, and based on the created audio playback mode, the audio data is successfully written to the sound card, and the audio data is successfully output.
[0202] Step S1210: the audio output adapter creates a virtual audio playback mode (VirtualSoundOut).
[0203] Since the sound card is not written successfully, the audio data cannot be played normally. In order to ensure the synchronous output of audio data and video data, a virtual audio playback mode will continue to be created.
[0204] Please refer to Fig.12 In one possible implementation, after determining that the target audio playback mode is successfully created and the audio data is written to the sound card but fails, the next application program interface is directly read to create the target audio playback mode; as in step S1203, the audio output adapter determines to create a corresponding target audio playback mode (wasapiSoundOut) based on the read application program interface wasapi, and does not destroy the mode.
[0205] In a possible implementation, if the target audio playback mode is successfully created but the audio data is not successfully written to the sound card, a reminder message is displayed in the display interface, wherein the reminder message is used to remind the user to check whether the connection status of the audio output device is normal. Please refer to Figure 7 .
[0206] In an embodiment of the present application, after creating a virtual audio playback mode, the virtual audio playback mode is adopted, the first output timestamp corresponding to the audio data is adjusted, and when the audio data is virtually output, it is mainly based on the second output timestamp corresponding to the video data contained in the received playback time point query instruction, and the first output timestamp corresponding to the audio data is adjusted so that the time point corresponding to the first output timestamp is consistent with the second output timestamp, and the adjusted first data timestamp corresponding to the audio data is output.
[0207] In order to ensure the synchronous output of audio data and video data, the output timestamps of audio data and video data need to be consistent;
[0208] At this time, the main control thread sends a playback time point query instruction to the demultiplexing, decoding, rendering and other sub-threads. The playback time point query instruction carries the second output timestamp corresponding to the video data to query the first output timestamp corresponding to the audio data; after receiving the second output timestamp corresponding to the video data, the sub-thread adjusts the first output timestamp corresponding to the audio data to a time point consistent with the second output timestamp, and feeds back the adjusted first output timestamp to the main control thread; when the main control thread performs audio and video output, since the first output timestamp of the audio data is adjusted based on the second timestamp of the video data, the audio data and video data are output synchronously to ensure playback quality.
[0209] It should be noted that, regardless of the output target audio playback mode or the output virtual audio playback mode, the audio output adapter will also perform common parts such as audio and video synchronization, sound resampling, and state machine detection.
[0210] In an embodiment of the present application, when there is a problem with the driver of the audio output device or the terminal device itself, a virtual audio playback mode is adopted to perform virtual output of audio data to ensure the synchronization of output timestamps of audio data and video data. After the audio output device is restored to availability, a target audio playback mode is adopted to ensure the synchronous output of audio data and video data when a sound signal is obtained by converting audio data through the audio output device, thereby improving the playback quality. When the virtual audio playback mode is adopted, the user is immediately reminded to check the connection status of the audio output device, thereby improving the playback quality and the user experience. Even if the user does not take any action in response to the reminder information, the virtual audio playback mode continues to be used to virtually output the audio data without the user's perception, thereby improving the robustness of the target multimedia player.
[0211] Based on the same inventive concept, the embodiment of the present application provides an audio data output device 1300, Fig.13 An audio data output device 1300 in an embodiment of the present application is exemplarily provided, and the device includes:
[0212] The creation unit 1301 is used to create a corresponding target audio playback mode for a target multimedia player based on a preset application program interface set, and monitor the audio data output result based on the creation result;
[0213] The first determining unit 1302 is used to create a virtual audio playback mode if it is determined based on the audio data output result that the audio data is not successfully output, and use the virtual audio playback mode to adjust the output timestamp corresponding to the audio data and virtually output the audio data.
[0214] In a possible implementation, the creation unit 1301 detects the audio output result based on the creation result, specifically for:
[0215] If the corresponding target audio playback mode is not successfully created, it is determined that the audio data is not successfully output;
[0216] If the corresponding target audio playback mode is successfully created, but the audio data is not successfully written to the sound card using the successfully created target audio playback mode, it is determined that the audio data is not successfully output.
[0217] In a possible implementation, the preset application program interface set includes at least two application program interfaces;
[0218] The creation unit 1301 is specifically used to: read the application program interface from the application program interface set through the audio output adapter according to the preset interface arrangement order; wherein:
[0219] Each time an application program interface is read, a corresponding target audio playback mode is created based on the application program interface; if the creation is successful, the target audio playback mode is adopted to write the audio data into the sound card.
[0220] In a possible implementation, after each time the creation unit 1301 reads an application program interface and creates a corresponding target audio playback mode based on the application program interface, it is further configured to:
[0221] If the creation fails and it is determined that an application interface is not the last application interface in the interface arrangement sequence, continue to read the next application interface;
[0222] If the creation fails, and an application program interface is determined to be the last application program interface in the interface arrangement sequence, it is determined that the corresponding target audio playback mode is not successfully created based on the application program interface set.
[0223] In a possible implementation, the creation unit 1301 adopts the target audio playback mode, and after writing the audio data into the sound card, is further used to:
[0224] If writing to the sound card fails, and it is determined that an application interface is not the last application interface in the interface arrangement sequence, the target audio playback mode is destroyed and the next application interface is read;
[0225] If writing to the sound card fails, and an application program interface is determined to be the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed and a virtual audio playback mode is created.
[0226] In a possible implementation, before creating the corresponding target audio playback mode based on the preset application program interface set, the creation unit 1301 is further configured to:
[0227] When the existence of a historical audio playback mode is detected, the historical audio playback mode is destroyed, wherein the historical audio playback mode is one of a historical target audio playback mode and a historical virtual audio playback mode.
[0228] In a possible implementation, the second determining unit 1303 adopts a virtual audio playback mode, and after virtually outputting the audio data, is further configured to:
[0229] Monitor the status information of the audio output device through the audio device monitor;
[0230] Based on the status information, after determining that the type of the connected audio output device has changed and determining that the most recently connected audio output device is the target device, a corresponding target audio playback mode is re-created based on a preset application program interface set.
[0231] In a possible implementation, if the creation unit 1301 determines based on the creation result that the corresponding target audio playback mode is not successfully created, it is further configured to:
[0232] The reminder information is presented on the display interface; wherein the reminder information is used to remind the user to check whether the connection status of the audio output device is normal.
[0233] In a possible implementation manner, the first determining unit 1301 is specifically configured to:
[0234] According to the second output timestamp corresponding to the video data contained in the playback time point query instruction, the first output timestamp corresponding to the audio data is adjusted so that the time point corresponding to the first output timestamp is consistent with the second output timestamp;
[0235] The first output timestamp corresponding to the output audio data.
[0236] For the convenience of description, the above is divided into each unit (or module) according to the function and described separately. Of course, when implementing the present application, the function of each unit (or module) can be implemented in each or multiple software or hardware. Therefore, various aspects of the present application can be specifically implemented in the following forms, namely: a complete hardware implementation method, a complete software implementation method (including firmware, microcode, etc.), or an implementation method combining hardware and software, which can be collectively referred to as "circuit", "module" or "system" here.
[0237] In some possible implementations, various aspects of the audio data output method provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the audio data output method according to various exemplary implementations of the present application described above in this specification.
[0238] The program product may use any combination of each or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with each or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0239] The program product for controlling the sending of short messages according to the embodiment of the present application may be in the form of a portable compact disk read-only memory (CD-ROM) and include program codes, and may be run on a computing device.
[0240] The readable signal medium may include a data signal propagated in baseband or as a carrier wave-submodule, wherein the readable program code is carried. The data signal of this propagation may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, device, or device.
[0241] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0242] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages.
[0243] It should be noted that although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the feature vectors and functions of two or more units described above can be embodied in each unit. Conversely, the feature vectors and functions of each unit described above can be further divided into multiple units to be embodied.
[0244] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or each step may be decomposed into multiple steps.
[0245] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An audio data output method, characterized in that: The method includes: For a target multimedia player, based on a preset set of application program interfaces, a corresponding target audio playback mode is created, and based on the creation result, an audio data output result is monitored; If it is determined based on the audio data output result that the audio data is not successfully output, a virtual audio playback mode is created, and the virtual audio playback mode is adopted to adjust the first output timestamp corresponding to the audio data, and the audio data is virtually output; The adopting of the virtual audio playback mode, adjusting the first output timestamp corresponding to the audio data, and virtually outputting the audio data includes: According to the second output timestamp corresponding to the video data contained in the playback time point query instruction, adjusting the first output timestamp corresponding to the audio data so that the time point corresponding to the first output timestamp is consistent with the second output timestamp; Output a first output timestamp corresponding to the audio data.
2. The method according to claim 1, characterized in that The step of monitoring the audio output result based on the creation result includes: If the corresponding target audio playback mode is not successfully created, it is determined that the audio data is not successfully output; If the corresponding target audio play mode is successfully created, but the audio data is not successfully written into the sound card using the target audio play mode, it is determined that the audio data is not successfully output.
3. The method according to claim 1 or 2, characterized in that The preset application program interface set includes at least two application program interfaces; The step of creating a corresponding target audio playback mode based on a preset set of application program interfaces includes: By means of the audio output adapter, the application program interface is read from the application program interface set according to a preset interface arrangement order; wherein: Each time an application program interface is read, a corresponding target audio playback mode is created based on the application program interface; if the creation is successful, the target audio playback mode is adopted to write the audio data into the sound card.
4. The method according to claim 3, characterized in that After each of reading an application program interface and creating a corresponding target audio playback mode based on the application program interface, the method further includes: If the creation fails, and it is determined that the one application program interface is not the last application program interface in the interface arrangement sequence, continue to read the next application program interface; If the creation fails, and it is determined that the one application interface is the last application interface in the interface arrangement sequence, it is determined that the corresponding target audio playback mode is not successfully created based on the application interface set.
5. The method according to claim 3, characterized in that After the target audio playing mode is adopted and the audio data is written into the sound card, the method further comprises: If writing to the sound card fails, and it is determined that the one application program interface is not the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed, and the next application program interface is read; If writing to the sound card fails, and it is determined that the one application program interface is the last application program interface in the interface arrangement sequence, the target audio playback mode is destroyed, and a virtual audio playback mode is created.
6. The method according to claim 1, characterized in that Before creating the corresponding target audio playback mode based on the preset application program interface set, the method further includes: When the existence of a historical audio playback mode is detected, the historical audio playback mode is destroyed, wherein the historical audio playback mode is one of a historical target audio playback mode and a historical virtual audio playback mode.
7. The method according to claim 1, characterized in that After the virtual audio playback mode is adopted to virtually output the audio data, the method further includes: Monitor the status information of the audio output device through the audio device monitor; Based on the state information, after determining that the type of the connected audio output device has changed and determining that the latest connected audio output device is the target device, a corresponding target audio playback mode is re-created based on a preset application program interface set.
8. The method according to claim 1, characterized in that If it is determined based on the creation result that the corresponding target audio playback mode is not successfully created, the method further includes: The reminder information is presented on the display interface; wherein the reminder information is used to remind the user to check whether the connection status of the audio output device is normal.
9. A device for outputting audio data, characterized in that: The device includes: A creation unit, for creating a corresponding target audio playback mode for a target multimedia player based on a preset set of application program interfaces, and monitoring an audio data output result based on the creation result; A first determining unit is configured to, if it is determined based on the audio data output result that the audio data is not output successfully, create a virtual audio playback mode, adopt the virtual audio playback mode, adjust an output timestamp corresponding to the audio data, and virtually output the audio data; Wherein, the first determining unit is specifically used for: According to the second output timestamp corresponding to the video data contained in the playback time point query instruction, the first output timestamp corresponding to the audio data is adjusted so that the time point corresponding to the first output timestamp is consistent with the second output timestamp; The first output timestamp corresponding to the output audio data.
10. An audio data output device, characterized in that: The audio data output device comprises: a processor and a memory, wherein: The memory is used to store computer instructions; The processor is used to execute the computer instructions to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A program product, characterized in that The program product comprises program codes, and when the program product is run on a computer device, the program codes are used to enable the computer device to execute the method according to any one of claims 1 to 8.
