Segmented measurement method and device for audio playing time delay, equipment and medium

By segmenting and measuring the latency of each module in the audio playback system, the problem of the inability to accurately optimize the total latency in traditional audio systems is solved, thus achieving efficient system operation and improved user experience.

CN121996461APending Publication Date: 2026-05-08BEI DOU ZHI LIAN KE JI YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEI DOU ZHI LIAN KE JI YOU XIAN GONG SI
Filing Date
2026-01-23
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Traditional audio systems cannot accurately distinguish the latency contribution of each stage, making it difficult to optimize the overall latency and affecting the user experience.

Method used

This paper provides a segmented measurement method for audio playback latency. By calculating the time taken from user-end command to audio data in various processing modules, including the processing latency of the player control module, audio framework, audio hardware abstraction layer and memory access area, the root cause of latency problems can be accurately located.

Benefits of technology

It achieves precise optimization of the audio system, specifically reducing the total latency to within the required range and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996461A_ABST
    Figure CN121996461A_ABST
Patent Text Reader

Abstract

The invention discloses a segmented measurement method and device for audio playing time delay, equipment and a medium, and the method comprises the steps: calculating the consumed time from the starting of an audio playing application to the calling of an audio data writing interface, so as to obtain first processing time delay information; calculating time consumed when the audio frame is started and the audio frame sends the audio data to the audio hardware abstraction layer, so as to obtain second processing time delay information; calculating time consumed by the audio driver from receiving the audio data to writing the audio data into the memory access area to obtain third processing time delay information; and calculating time consumed by the data processing module for completing processing of the audio data in the memory access area to obtain fourth processing time delay information. By utilizing the method, the time delay of each link can be determined, the root of the delay problem in the audio data can be accurately positioned, and the part with relatively large time delay can be conveniently optimized in a targeted manner, so that the total time delay is effectively reduced to a required range, and the accurate optimization of the audio data is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of audio playback delay segmentation measurement method, apparatus, device and medium. Background Technology

[0002] In traditional audio systems, audio latency is often measured as a whole, making it difficult to accurately distinguish the latency contribution of each component. For example, when audio is delayed during playback, it is difficult to determine whether the delay is caused by software or hardware. Moreover, some apps have requirements for the total latency of sound playback. If the total latency is not met, it is impossible to measure the latency of each path segment separately in order to optimize the parts with high latency and thus reduce the total latency to within the required range. Summary of the Invention

[0003] To overcome the shortcomings of existing technical solutions, embodiments of the present invention provide a method, apparatus, device, and medium for segmented measurement of audio playback delay.

[0004] The technical solution adopted by this invention to solve its technical problem is: In a first aspect, the present invention provides a segmented measurement method for audio playback delay, wherein the segmented measurement method is applied to the control module of a player, the control module being connected to a test terminal for signal transmission, and the segmented measurement method includes: Receive audio playback instructions sent by the user client and calculate the time consumed between the start of the audio playback application and the call to the write audio data interface to obtain the first processing latency information; The time taken from the start of the audio framework to the transmission of audio data to the audio hardware abstraction layer is calculated to obtain the second processing latency information. The audio data is written from the audio hardware abstraction layer to the audio driver for processing, and the time taken by the audio driver from receiving the audio data to writing the audio data to the memory access area is calculated to obtain the third processing latency information; The calculation data processing module takes time to process the audio data located in the memory access area to obtain the fourth processing delay information; The first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information are all uploaded to the test terminal.

[0005] Secondly, the present invention also provides a segmented measurement device for audio playback delay, wherein the segmented measurement device is disposed in the control module of the player, the control module is connected to the test terminal for signal transmission, and the segmented measurement device includes: The first calculation module is used to receive audio playback instructions sent by the user terminal and calculate the time consumed by the audio playback application from startup to calling the write audio data interface, so as to obtain the first processing delay information. The second calculation module is used to calculate the time from the start of the audio framework to the time it takes for the audio framework to send audio data to the audio hardware abstraction layer, so as to obtain the second processing delay information. The third calculation module is used to write the audio data from the audio hardware abstraction layer to the audio driver for processing, and to calculate the time taken for the audio driver to write the audio data to the memory access area from receiving the audio data, so as to obtain the third processing latency information. The fourth calculation module calculates the time taken for the data processing module to process the audio data located in the memory access area, so as to obtain the fourth processing delay information; The data transmission module uploads the first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information to the test terminal.

[0006] The present invention also provides a computer device, which includes a processor, a network interface, a memory, and a communication bus, wherein the processor, the network interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in a memory, it implements the steps of the segmented measurement method for audio playback delay described in any one of the first aspects above.

[0007] The present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the segmented measurement method for audio playback delay as described in any one of the first aspects above.

[0008] Compared with the prior art, the beneficial effects of the present invention are: By measuring the first processing latency from the user sending an audio playback command to calling the audio data write interface, the second processing latency from the audio framework startup to sending audio data to the audio hardware abstraction layer, the third processing latency from the audio hardware abstraction layer writing audio data to the audio driver and processing, and the fourth processing latency of the data processing module completing the processing of audio data in the memory access area, and uploading all of the above segmented latency information to the test terminal, the latency of each stage can be clearly identified, and the root cause of audio latency problems can be accurately located, whether it is caused by the software or hardware. For apps with strict total latency requirements, this method can measure the latency of each path segment, which facilitates targeted optimization of the parts with larger latency, thereby effectively reducing the total latency to within the required range and achieving precise optimization and efficient operation of the audio system. Attached Figure Description

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a flowchart of a segmented measurement method for audio playback delay according to an embodiment of the present invention.

[0011] Figure 2 This is a schematic block diagram of an audio playback delay segmentation measurement device according to an embodiment of the present invention.

[0012] Figure 3 This is a schematic block diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0015] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0016] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0017] In order to solve the technical problems existing in the prior art described in the background art, the present invention provides a segmented measurement method for audio playback delay.

[0018] The following details the specific steps of a segmented measurement method for audio playback delay provided by an embodiment of the present invention, based on the appendix. Figure 1 As shown, the specific steps of this segmented measurement method for audio playback delay include: Step S110: Calculate the time elapsed between receiving the audio playback command from the user terminal and calling the write audio data interface to obtain the first processing delay information.

[0019] Specifically, the user triggers a playback operation through the player's user interface (such as a music playback application on a car display screen), for example, by clicking the play button. The player's front-end interface captures the user's click event and generates a playback command. This command is an event message containing information such as the path to the audio file to be played and the playback mode. At the moment the playback command is captured, the system records a timestamp t1 in the player's control module. This timestamp marks the starting point for measuring the first processing delay. The playback command is transmitted from the user interface to the player's control module. The control module is responsible for processing the user's command and coordinating subsequent audio processing flows. After receiving the command, the control module begins to parse the command content, determining the path to the audio file to be played, the playback mode, and other information. Based on the parsed command, the control module loads the audio file from the specified path and prepares the audio data. After completing the above preparations, the control module calls the write audio data interface to transmit the audio data to the audio processing framework. The write audio data interface is an API provided by the audio processing framework for receiving audio data from the player's control module. At the moment the write audio data interface is called, the system records another timestamp t2. This timestamp marks the ending point for measuring the first processing delay.

[0020] The first processing latency information is t2-t1. The first processing latency reflects the time taken by the player control module from receiving the user's playback command to preparing the audio data and calling the audio data writing interface. In other words, it directly reflects the response speed of the player control module to the user's command. If this latency is too long, the user may feel a significant delay, affecting the user experience. By measuring the first processing latency, developers can discover performance bottlenecks in the control module, such as slow initialization operations and low audio file loading efficiency, and thus make targeted optimizations.

[0021] By recording the timestamps of user-sent playback commands and calls to the audio data writing interface, and calculating the difference between the two, the response speed and processing efficiency of the player control module can be accurately evaluated. This not only helps to identify performance bottlenecks but also provides data support for optimizing the audio playback system, thereby improving the user experience.

[0022] Step S120: Calculate the time taken from the start of the audio framework to the time it sends the audio data to the audio hardware abstraction layer, in order to obtain the second processing latency information.

[0023] Specifically, the audio framework is the core part of the audio processing system, responsible for managing and scheduling the audio data processing flow. When it receives audio data from the player control module, it performs a series of processes, such as decoding, format conversion, and volume adjustment, and then sends the processed audio data to the audio hardware abstraction layer, also known as Audio HAL.

[0024] When the audio framework is started by the player control module calling the write audio data interface, the audio framework is activated and begins initialization when the player control module prepares the audio data and calls the write audio data interface. The audio framework allocates necessary system resources, loads audio processing modules such as decoders, mixers, and sound effect processors, configures audio processing parameters according to the audio data format, and records a third timestamp t3 when the audio framework completes initialization and officially begins processing audio data. This timestamp is used to measure the starting point of the second processing delay.

[0025] The audio framework receives audio data from the player control module. The audio framework calls the decoder module to decode the encoded audio data into raw audio data in PCM format. The processed audio data is then cached in a temporary buffer, waiting to be sent to the audio hardware abstraction layer.

[0026] It should be noted that in the above embodiments, if the audio data format does not meet the requirements of the audio hardware, the audio framework will perform format conversion, for example, converting the sampling rate from 44.1kHz to 48kHz, or converting mono audio to stereo.

[0027] The audio framework sends the processed audio data from the buffer to the Audio Hardware Abstraction Layer (Audio HAL). This involves inter-process communication (IPC) because the audio framework and the Audio Hardware Abstraction Layer may run in different processes or modules. When the audio framework successfully sends the audio data to the Audio Hardware Abstraction Layer, another fourth timestamp t4 is recorded. This timestamp is the end point for measuring the second processing delay.

[0028] The second processing delay information is t4-t3, which reflects the time taken for the audio framework to complete audio data processing and send it to the audio hardware abstraction layer from startup.

[0029] As such, the second processing latency directly reflects the processing efficiency of the audio framework. If the latency is too long, it may cause audio playback delays, affecting the user experience. Moreover, by measuring the second processing latency, developers can discover performance bottlenecks in the audio framework, such as low decoder efficiency, complex format conversion, and time-consuming sound effect processing, and thus make targeted optimizations.

[0030] Step S130: Write the audio data from the audio hardware abstraction layer to the audio driver for processing, and calculate the time taken for the audio driver to write the audio data to the memory access area from receiving the audio data to obtaining the third processing latency information.

[0031] Specifically, the Audio Hardware Abstraction Layer (HAL) connects software and hardware in the audio processing system. Specifically, it receives audio data from the audio framework and passes it to the audio driver, which acts as the interface between the operating system and the audio hardware, responsible for writing the audio data into the hardware device's memory access area. The HAL encapsulates the processed audio data into a format suitable for the audio driver's processing and transmits the data to the audio driver via system calls or inter-process communication. At the instant the HAL transmits the audio data to the audio driver, a fifth timestamp t5 is recorded. This fifth timestamp marks the starting point for measuring the third processing latency.

[0032] It should be noted that the audio driver in this embodiment of the invention maintains a receive buffer for receiving audio data from the audio hardware abstraction layer. The audio driver verifies the received audio data to ensure its integrity. In addition, the audio driver may perform further format adaptation on the audio data to ensure that it meets the requirements of the hardware device.

[0033] The audio driver converts the audio data from a software-level format to a format that the hardware device can process. The audio driver configures the parameters of the audio hardware device according to the characteristics of the audio data, such as sampling rate and bit depth. The audio driver writes the processed audio data into the memory access area of ​​the audio hardware device. When the audio driver successfully writes the audio data into the memory access area, it records the sixth timestamp t6, which is the end point of measuring the third processing delay.

[0034] The third processing latency information is t6-t5, which reflects the time taken for the audio driver to receive audio data and write the audio data into the memory access area, including the total time taken for data reception, format adaptation, hardware configuration and data writing.

[0035] This setting allows the processing efficiency of the audio driver to be directly reflected through the third processing latency, helping developers to identify performance bottlenecks in the audio driver, such as low data conversion efficiency, complex hardware configuration, and time-consuming write operations, so as to carry out targeted optimization.

[0036] It is understood that the memory access area in this embodiment of the invention is a dedicated memory area used by the audio hardware device to store audio data, which is directly accessed by the audio chip.

[0037] Step S140: Calculate the time taken for the data processing module to complete the processing of the audio data in the memory access area, so as to obtain the fourth processing delay information.

[0038] Specifically, in an audio playback system, the memory access area is a dedicated memory region for audio hardware devices, used to store audio data to be processed. The data processing module is responsible for further processing this audio data. The audio driver writes the processed audio data into the memory access area of ​​the audio hardware device. At the moment the audio data is successfully written to the memory access area, a seventh timestamp t7 is recorded. This seventh timestamp marks the starting point for measuring the fourth processing latency. The data processing module then reads the audio data from the memory access area. For example, data can be read directly from the memory access area via the controller.

[0039] Since the data processing module maintains a receive buffer to receive audio data transmitted from the memory access area, when the data processing module successfully receives the audio data and is ready to start processing, it records the eighth timestamp t8, which is also the end point for measuring the fourth processing delay.

[0040] The fourth processing latency information is t8-t7, which reflects the time taken for the audio data to be transferred from the memory access area to the data processing module.

[0041] The fourth processing latency directly reflects the data transmission efficiency of audio hardware devices between the memory access area and the data processing module. If this latency is too long, it will also cause audio processing delays and affect the user experience. Moreover, by measuring the fourth processing latency, developers can help identify bottlenecks in hardware design, such as slow memory access speed, insufficient bus bandwidth, and complex data verification, so as to carry out targeted optimizations.

[0042] In step S150, the first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information are all uploaded to the test terminal.

[0043] Specifically, during the latency measurement process of the audio playback system, first processing latency information, second processing latency information, third processing latency information, and fourth processing latency information were calculated respectively. These data reflect the processing efficiency and latency at different stages. For example, by conducting statistical analysis on a large amount of data through a test terminal, bottlenecks and problems in system performance can be identified, providing data support for developers and helping to formulate optimization strategies to improve user experience.

[0044] In some specific embodiments, the step of calculating the time elapsed between receiving the audio playback command from the user terminal and calling the write audio data interface to obtain the first processing latency information includes the following steps: Obtain the first timestamp when the user sends the audio playback command; obtain the second timestamp from the start of the audio playback application to the call to the write audio data interface; calculate the difference between the second timestamp and the first timestamp to obtain the first processing delay information.

[0045] Specifically, in an audio playback system, the user sends a playback command through the player interface. After a series of processing steps, the audio data is written to the audio processing module. Specifically, the user triggers playback through the player's user interface on the in-vehicle display, for example, by clicking the play button. At the moment the user triggers playback, the player application records a timestamp t1. This first timestamp can be obtained through a high-precision clock function of the system, such as System.nanoTime in Android. Alternatively, the first timestamp can be recorded in the player's front-end interface code, for example, in the button click event handler.

[0046] Once the player control module receives a playback command from the user, it begins a series of processing operations, such as parsing the playback command, determining the path of the audio file to be played, the playback mode, loading the metadata of the audio file, and preparing the audio data.

[0047] After completing the above preparations, the player control module calls the write audio data interface to pass the audio data to the audio processing framework. At the moment the write audio data interface is called, the player control module records the second timestamp t2. The second timestamp is also obtained through the high-precision clock function provided by the system.

[0048] At this point, the delay calculation formula is used, such as the first processing delay information being t2-t1.

[0049] By recording the first timestamp when the user sends a playback command and the second timestamp when the player calls the audio data writing interface, and calculating the difference between the two, the response speed and processing efficiency of the player control module can be accurately evaluated.

[0050] In some specific embodiments, the step of calculating the time elapsed from the start of the audio framework to the transmission of audio data to the audio hardware abstraction layer, in order to obtain second processing latency information, includes: Get the third timestamp of the audio framework at startup.

[0051] Specifically, the audio framework is started by the control module calling the write audio data interface. When the player control module prepares the audio data and calls the write audio data interface, the audio framework is activated and begins initialization. A timestamp t3 is recorded when the audio framework completes initialization and officially begins processing audio data.

[0052] It should be noted that during the initialization process, the audio framework allocates necessary system resources, such as memory and threads, loads audio processing modules, such as decoders, mixers, and sound effect processors, and configures audio processing parameters according to the audio data format, such as sampling rate, bit depth, and number of channels.

[0053] Get the fourth timestamp when the audio framework sends audio data to the audio hardware abstraction layer when it starts.

[0054] Specifically, the audio framework receives audio data from the player control module. This audio data is usually encoded audio streams, such as MP3 and AAC formats. The audio framework calls the decoder module to decode the encoded audio data into raw audio data in PCM (Pulse Code Modulation) format. If the audio data format does not meet the requirements of the audio hardware, the audio framework will perform format conversion, such as converting the sampling rate from 44.1kHz to 48kHz, or converting mono audio to stereo. The audio framework can also adjust the volume and add sound effects to the audio data, such as echo and reverb. The processed audio data is cached in a temporary buffer, waiting to be sent to the audio hardware abstraction layer.

[0055] After the audio framework sends the processed audio data from the buffer to the audio hardware abstraction layer, since the audio framework and the audio hardware abstraction layer run in different processes or modules, cross-process communication is also required. When the audio framework successfully sends the audio data to the audio hardware abstraction layer, a fourth timestamp t4 is recorded as the end point for measuring the second processing delay.

[0056] The difference between the fourth timestamp and the third timestamp is calculated to obtain the second processing delay information.

[0057] Specifically, the difference between two timestamps, t4-t3, is calculated. This difference is the second processing latency information. Thus, by recording the timestamps when the audio framework starts up and when the audio data is sent to the audio hardware abstraction layer, and calculating the difference between the two, the processing efficiency of the audio framework can be accurately evaluated. This not only helps to identify performance bottlenecks, but also provides data support for optimizing the audio processing flow.

[0058] In some specific embodiments, the step of calculating the time it takes for the audio driver to write audio data to the memory access area to obtain third processing latency information includes the following steps: Get the fifth timestamp of the audio driver when it receives audio data.

[0059] Specifically, the audio hardware abstraction layer passes the processed audio data to the audio driver through system calls or inter-process communication. The audio driver maintains a receive buffer to temporarily store the audio data received from the audio hardware abstraction layer. At the moment when the audio driver successfully receives the audio data and puts it into the receive buffer, a timestamp t5 is recorded as the starting point for measuring the third processing latency.

[0060] Get the sixth timestamp from when the audio driver receives the audio data to when it writes the audio data to the memory access area.

[0061] Specifically, during audio data processing and writing, the audio driver verifies the received audio data to ensure its integrity. The audio driver also performs further format adaptation on the audio data to ensure it meets the requirements of the hardware device, such as adjusting the sampling rate, bit depth, or number of channels. Based on the characteristics of the audio data, such as sampling rate and bit depth, the audio driver configures the parameters of the audio hardware device. The audio driver then writes the processed audio data into the memory access area of ​​the audio hardware device. At the instant the audio driver successfully writes the audio data into the memory access area, another timestamp, t6, is recorded as the end point for measuring the third processing latency.

[0062] Calculate the difference between the sixth timestamp and the fifth timestamp to obtain the third processing delay information.

[0063] Specifically, the fifth timestamp is the timestamp when the audio driver receives the audio data, and the sixth timestamp is the timestamp when the audio driver writes the audio data to the memory access area. These two timestamps record the start and end points of the audio driver's processing of the audio data, respectively. The third processing delay information can be obtained by calculating the difference between the sixth and fifth timestamps, that is, the third processing delay information t = t6 - t5, where t6 is the timestamp when the audio driver writes the audio data to the memory access area, and t5 is the timestamp when the audio driver receives the audio data.

[0064] This setup allows us to obtain the third processing latency information by calculating the difference between the sixth and fifth timestamps. This enables us to quantify the processing efficiency of the audio driver from receiving audio data to writing it into the memory access area, providing data support for optimizing the audio driver design.

[0065] In some specific embodiments, the data processing module includes a digital signal processor and a power amplifier; the step involves calculating the time taken for the data processing module to complete processing of the audio data located in the memory access area to obtain the fourth processing delay information, specifically including the following steps: The oscilloscope's two channels are electrically connected to the GPIO pins of the digital signal processor and the power amplifier, respectively, to obtain the seventh timestamp when the GPIO signal is obtained and the eighth timestamp when the power amplifier output signal is obtained.

[0066] Specifically, two channels of the oscilloscope are connected to the GPIO pins of the digital signal processor (DSP) and the output of the power amplifier, respectively. The GPIO pins are used to send control or synchronization signals, while the power amplifier outputs the processed audio signal. The GPIO signal indicates the start of audio data transmission or the completion of a certain processing stage. The GPIO signal is monitored through one channel of the oscilloscope. The power amplifier output signal, which is the audio signal processed by the DSP, is monitored through the other channel of the oscilloscope. When audio data is transferred from the memory access area to the DSP, the DSP generates a GPIO signal, such as a pulse signal or a level change, indicating that audio data processing has begun. The trigger point of this GPIO signal is captured through the first channel of the oscilloscope, and its timestamp t7 is recorded. When the audio data, after being processed by the DSP, is transmitted to the power amplifier and outputs from the power amplifier, the power amplifier generates an audio signal. The trigger point of the power amplifier's output signal is captured through the second channel of the oscilloscope, and its timestamp t8 is recorded.

[0067] It's important to note that a digital signal processor (DSP) is responsible for performing digital signal processing on audio data, such as filtering, modulation, and sound enhancement. The GPIO (General Purpose Input / Output) of a DSP is used to output synchronization or status signals, which can serve as reference points for audio data processing. A power amplifier amplifies the processed audio signal to drive speakers or headphones; the output signal of the power amplifier is the final audio signal and can be directly used for measurement. An oscilloscope is an electronic testing instrument used to measure and display the waveform and time characteristics of electrical signals.

[0068] Calculate the difference between the eighth timestamp and the seventh timestamp to obtain the fourth processing delay information.

[0069] Specifically, the fourth processing delay information can be obtained by calculating the difference between the eighth timestamp and the seventh timestamp, that is, the fourth processing delay information = t8 - t7.

[0070] The fourth processing latency directly reflects the efficiency of audio data transmission from the memory access area to the data processing module. If this latency is too long, it can easily lead to audio playback delays and affect the user experience. Therefore, by measuring the fourth processing latency, developers can identify bottlenecks in hardware design, such as slow memory access speed, insufficient bus bandwidth, and complex digital signal processor processing, and thus make targeted optimizations.

[0071] In a further embodiment, the steps involve electrically connecting the GPIO pins of the digital signal processor and the power amplifier via two channels of an oscilloscope, respectively, and acquiring the seventh timestamp when acquiring the GPIO signal and the eighth timestamp when acquiring the power amplifier output signal. Specifically, this includes the following steps: One of the oscilloscope channels is used to record the level transition times of the GPIO pins and serve as the seventh timestamp.

[0072] In this embodiment of the invention, the GPIO pin is used to output a synchronization signal or a status signal, indicating the start of audio data. The first channel of the oscilloscope is connected to the GPIO pin of the digital signal processor. The output of the power amplifier outputs the final audio signal for measurement. The second channel of the oscilloscope is connected to the output of the power amplifier. The oscilloscope's trigger mode is set to "edge-triggered," and the first channel is selected as the trigger source. The trigger edge is set to "rising edge" or "falling edge," depending on the characteristics of the GPIO signal. The oscilloscope's time range is adjusted to ensure that the complete waveforms of the GPIO signal and the PA output signal can be captured. The time range can be set from a few milliseconds to tens of milliseconds, depending on the frequency of the audio signal and the expected delay. By adjusting the voltage range of each channel, the GPIO signal and the power amplifier's output signal can be clearly displayed.

[0073] When audio data is transferred from the memory access area to the digital signal processor (DSP), the DSP generates a GPIO signal (such as a pulse signal or a level change) to indicate that audio data processing has begun. The oscilloscope captures the transition moment of this GPIO signal using its first channel. For example, if the GPIO signal transitions from low to high, the oscilloscope records this transition moment. The oscilloscope automatically marks the GPIO signal transition moment with a timestamp t7.

[0074] Another channel of the oscilloscope was used to record the start transition moment of the audio signal and serve as the eighth timestamp.

[0075] Specifically, when audio data is processed by a digital signal processor and transmitted to a power amplifier, and output from the power amplifier, an audio signal is generated by the power amplifier. Then, the second channel of the oscilloscope captures the initial transition moment of the power amplifier's output signal. For example, when the power amplifier's output signal starts to rise from zero level, the oscilloscope records this transition moment. That is, the oscilloscope automatically marks the timestamp t8 of the power amplifier's output signal transition moment.

[0076] By capturing the transition times of the GPIO signals of the digital signal processor and the output signals of the power amplifier through two channels of the oscilloscope, the seventh and eighth timestamps can be accurately obtained. These timestamps are used to calculate the fourth processing delay information, thereby evaluating the efficiency of audio data transfer from the memory access area to the data processing module.

[0077] In some specific embodiments, before the steps of measuring the GPIO signal and the power amplifier output signal through two channels of an oscilloscope respectively, and calculating the time interval between the GPIO signal and the power amplifier output signal to obtain the fourth processing delay information, the following steps are also included: Generate an audio file with amplitude jumps from the audio data.

[0078] Specifically, an amplitude jump refers to an audio signal suddenly jumping from zero (or a low amplitude) to a higher amplitude at a certain moment. This jump can be used as the starting point of the audio signal, making it easy to capture accurately on an oscilloscope. For example, an audio file containing short pulse signals or square wave signals can be generated. These signals have obvious jump characteristics in the time domain. Some audio editing software, such as Audacity and Adobe Audition, can be used to generate a simple audio signal and create a short pulse signal or square wave signal to ensure that its amplitude jumps from zero to a high value, such as 50% or higher of the maximum amplitude. Finally, the audio file is saved as a temporary format, such as MP3.

[0079] Convert the audio file to be tested to WAV format.

[0080] Specifically, since WAV format is a lossless audio format, it is widely supported and easy to process. Moreover, WAV files contain the original sample points of audio data, making them suitable for precise measurement and analysis. By opening the generated audio file and using the export function of audio editing software, the file format can be converted to WAV format, ensuring that parameters such as sampling rate and bit depth are compatible with the target hardware.

[0081] Generating an audio file with amplitude jumps and converting it to WAV format is a crucial preparatory step for audio processing delay measurement. By generating an audio signal with clear amplitude jumps and saving it as a WAV file, it is possible to accurately capture changes in key signals during subsequent hardware processing, thereby precisely measuring the time delay of audio data from digital signal processor processing to power amplifier output.

[0082] This invention also provides a segmented measurement device 100 for audio playback delay. The segmented measurement device 100 is disposed in the control module of the player, and the control module is connected to the test terminal for signal transmission. The segmented measurement device 100 is used to perform any embodiment of the aforementioned segmented measurement method for audio playback delay.

[0083] Specifically, the following describes in detail the specific structure of an audio playback delay segmentation measurement device 100 provided by an embodiment of the present invention, according to the appendix. Figure 2 As shown, the segmented measuring device 100 specifically includes the following: The first calculation module 110 is used to receive audio playback instructions sent by the user terminal and calculate the time consumed by the audio playback application from startup to calling the write audio data interface, so as to obtain the first processing delay information. The second calculation module 120 is used to calculate the time from the start of the audio framework to the time when the audio framework sends the audio data to the audio hardware abstraction layer, so as to obtain the second processing delay information. The third calculation module 130 is used to write the audio data from the audio hardware abstraction layer into the audio driver for processing, and to calculate the time taken by the audio driver from receiving the audio data to writing the audio data into the memory access area, so as to obtain the third processing latency information. The fourth calculation module 140 calculates the time taken for the data processing module to process the audio data located in the memory access area, so as to obtain the fourth processing delay information; The data transmission module 150 uploads the first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information to the test terminal.

[0084] The present invention further provides a computer device, which can be used to perform the segmented measurement method for audio playback delay in any of the above embodiments.

[0085] See Figure 3 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a communication bus 501. The memory may include a storage medium 503 and internal memory 504.

[0086] The storage medium 503 may store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, it causes the processor 502 to execute a segmented measurement method for audio playback delay. The storage medium 503 may be a volatile storage medium or a non-volatile storage medium.

[0087] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.

[0088] The internal memory 504 provides an environment for the operation of the computer program 5032 in the storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a segmented measurement method for audio playback delay.

[0089] This network interface 505 is used for network communication, such as providing data transmission. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device 500 to which the present invention is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0090] The processor 502 is used to run the computer program 5032 stored in the memory to implement the corresponding function in the above-mentioned segmented measurement method for audio playback delay.

[0091] Those skilled in the art will understand that Figure 3 The embodiments of the computer device shown do not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. For example, in some embodiments, the computer device may include only memory and a processor. In such embodiments, the structure and function of the memory and processor are different from those shown. Figure 3 The embodiments shown are consistent and will not be repeated here.

[0092] It should be understood that, in this embodiment of the invention, the processor 502 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0093] In another embodiment of the invention, a computer-readable storage medium is provided. This computer-readable storage medium may be volatile or non-volatile. The computer-readable storage medium stores a computer program, wherein when executed by a processor, the computer program implements the steps included in the segmented measurement method for audio playback delay described above.

[0094] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.

[0095] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Units with the same function may be grouped into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, or it may be an electrical, mechanical, or other form of connection.

[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.

[0097] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0098] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a computer-readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, a data transmitter, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned computer-readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks.

[0099] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A segmented measurement method for audio playback delay, characterized in that, The segmented measurement method is applied to the control module of the player, the control module being connected to the signal transmission of the test terminal, and the segmented measurement method includes: Receive audio playback instructions sent by the user client and calculate the time consumed between the start of the audio playback application and the call to the write audio data interface to obtain the first processing latency information; The time taken from the start of the audio framework to the transmission of audio data to the audio hardware abstraction layer is calculated to obtain the second processing latency information. The audio data is written from the audio hardware abstraction layer to the audio driver for processing, and the time taken by the audio driver from receiving the audio data to writing the audio data to the memory access area is calculated to obtain the third processing latency information; The calculation data processing module takes time to process the audio data located in the memory access area to obtain the fourth processing delay information; The first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information are all uploaded to the test terminal.

2. The segmented measurement method for audio playback delay according to claim 1, characterized in that, The process of receiving audio playback commands sent by the user terminal and calculating the time elapsed between the start of the audio playback application and the call to the write audio data interface to obtain first processing latency information includes: Obtain the first timestamp when the user sends the audio playback command; Obtain the second timestamp from when the audio playback application starts up until when the write audio data interface is called; The difference between the second timestamp and the first timestamp is calculated to obtain the first processing delay information.

3. The segmented measurement method for audio playback delay according to claim 1, characterized in that, The computational audio framework calculates the time elapsed from startup to sending audio data to the audio hardware abstraction layer, to obtain second processing latency information, including: Obtain the third timestamp of the audio framework at startup; Obtain the fourth timestamp when the audio framework starts up and the audio data is sent to the audio hardware abstraction layer; The difference between the fourth timestamp and the third timestamp is calculated to obtain the second processing delay information.

4. The segmented measurement method for audio playback delay according to claim 1, characterized in that, The calculation of the time taken from receiving the audio data to writing the audio data into the memory access area by the audio driver, in order to obtain third processing latency information, includes: Obtain the fifth timestamp of the audio driver when it receives the audio data; Obtain the sixth timestamp from when the audio driver receives the audio data to when it writes the audio data into the memory access area; The difference between the sixth timestamp and the fifth timestamp is calculated to obtain the third processing delay information.

5. The segmented measurement method for audio playback delay according to claim 1, characterized in that, The data processing module includes a digital signal processor and a power amplifier; The computational data processing module completes the processing of the audio data located in the memory access area, resulting in fourth processing latency information, including: The two channels of the oscilloscope are electrically connected to the GPIO pin of the digital signal processor and the power amplifier, respectively, to obtain the seventh timestamp when acquiring the GPIO signal and the eighth timestamp when acquiring the power amplifier output signal. The difference between the eighth timestamp and the seventh timestamp is calculated to obtain the fourth processing delay information.

6. The segmented measurement method for audio playback delay according to claim 5, characterized in that, The two channels of the oscilloscope are electrically connected to the GPIO pins of the digital signal processor and the power amplifier, respectively, to obtain a seventh timestamp when acquiring the GPIO signal and an eighth timestamp when acquiring the power amplifier output signal, including: One of the channels of the oscilloscope is used to record the level transition times of the GPIO pins and serve as the seventh timestamp; Another channel of the oscilloscope is used to record the start transition time of the audio signal and serve as the eighth timestamp.

7. The segmented measurement method for audio playback delay according to claim 5, characterized in that, Before the computational data processing module completes processing of the audio data in the memory access area to obtain the fourth processing delay information, it further includes: The audio data is used to generate an audio file to be tested with amplitude jumps; Convert the audio file to be tested to WAV format.

8. A segmented measurement device for audio playback delay, characterized in that, The segmented measurement device is installed in the control module of the player, and the control module is connected to the test terminal for signal transmission. The segmented measurement device includes: The first calculation module is used to receive audio playback instructions sent by the user terminal and calculate the time consumed by the audio playback application from startup to calling the write audio data interface, so as to obtain the first processing delay information. The second calculation module is used to calculate the time from the start of the audio framework to the time it takes for the audio framework to send audio data to the audio hardware abstraction layer, so as to obtain the second processing delay information. The third calculation module is used to write the audio data from the audio hardware abstraction layer to the audio driver for processing, and to calculate the time taken for the audio driver to write the audio data to the memory access area from receiving the audio data, so as to obtain the third processing latency information. The fourth calculation module calculates the time taken for the data processing module to process the audio data located in the memory access area, so as to obtain the fourth processing delay information; The data transmission module uploads the first processing delay information, the second processing delay information, the third processing delay information, and the fourth processing delay information to the test terminal.

9. A computer device, characterized in that, The computer device includes a processor, a network interface, a memory, and a communication bus, wherein the processor, network interface, and memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the segmented measurement method for audio playback delay according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the segmented measurement method for audio playback delay as described in any one of claims 1-7.