CN109905752B - Audio data processing method and device, electronic equipment and storage medium - Google Patents

Audio data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109905752B
CN109905752B CN201910194879.0A CN201910194879A CN109905752B CN 109905752 B CN109905752 B CN 109905752B CN 201910194879 A CN201910194879 A CN 201910194879A CN 109905752 B CN109905752 B CN 109905752B
Authority
CN
China
Prior art keywords
audio data
time stamp
module
timestamp
corrected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910194879.0A
Other languages
Chinese (zh)
Other versions
CN109905752A (en
Inventor
陈春晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Visual Technology Co Ltd
Original Assignee
Hisense Visual Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Visual Technology Co Ltd filed Critical Hisense Visual Technology Co Ltd
Priority to CN201910194879.0A priority Critical patent/CN109905752B/en
Publication of CN109905752A publication Critical patent/CN109905752A/en
Application granted granted Critical
Publication of CN109905752B publication Critical patent/CN109905752B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention provides an audio data processing method, an audio data processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: reading audio data from a buffer module; determining whether the audio data is audio data of a timestamp to be corrected; if so, reading a first parameter from the first functional module, wherein the first parameter is used for indicating an initial timestamp of the audio data; and correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data. The invention can correct the time stamp of the audio data and realize the sound and picture synchronization.

Description

Audio data processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of audio data processing technologies, and in particular, to an audio data processing method and apparatus, an electronic device, and a storage medium.
Background
The intelligent terminal can realize the function of playing audio and video files, wherein the multimedia synchronization function in the intelligent terminal is to play the multimedia data with the same timestamp (pts) in the multiple multimedia data such as video data and audio data at the same time, namely to realize the audio and video synchronization.
The Gstreamer is a current universal open source multimedia framework for realizing the multimedia synchronization function, caches audio data by using a Gstaff audioingbuffer module, and realizes sound and picture synchronization control by providing a clock for the transmission of the audio data. In order to reduce the transitional consumption of the whole machine performance when audio and video data are transmitted, a new audio and video playing mode is provided: tunnel Mode (Tunnel Mode). When the mode is adopted to play the audio and video file, the audio data stored in the Gstaudioringbuffer module does not carry timestamp information; the Gstaudioflingersink module is required to calculate the time stamp of the audio data according to the parameters of the audio data cached in the Gstaudiringing buffer module, and extra header information is added to the audio data, wherein the header information comprises the time stamp obtained by calculation; the Gstaudioflingersink module transmits the audio data containing the head information to the AudioTrack module, so that the AudioTrack module realizes the synchronous playing of the audio and the video according to the timestamp information.
However, in this audio/video playing mode, when a user switches the audio track (for example, chinese is switched to english) of the audio/video played by the intelligent terminal to play the audio/video, the gstaudioring buffer module is to destroy and reconstruct, wherein the parameters of the cached audio data are changed correspondingly; if the Gstaudioflingersink module directly calculates the time stamp according to the parameters of the audio data reconstructed in the Gstaudiovingbuffer module, the time stamp has an error with the time stamp of the audio data before the audio track is switched, and the sound and the picture are not synchronous.
Disclosure of Invention
The invention provides an audio data processing method, an audio data processing device, electronic equipment and a storage medium, which can correct the time stamp of audio data and realize sound and picture synchronization.
A first aspect of the present invention provides an audio data processing method applied to a second functional module, where the second functional module is configured to add a timestamp to audio data to be sent to an audio module, and the method includes:
reading audio data from a buffer module;
determining whether the audio data is audio data of a timestamp to be corrected;
if so, reading a first parameter from the first functional module, wherein the first parameter is used for indicating an initial timestamp of the audio data;
and correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
Optionally, the determining whether the audio data is audio data of a timestamp to be corrected includes:
judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
Optionally, before determining whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the method further includes:
and reading a second parameter from the first functional module, wherein the second parameter is used for indicating that the cache module is in a reconstruction completion state.
Optionally, after determining whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the method further includes:
if not, judging whether the audio data is the first frame of audio data transmitted after the cache module empties the cache;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
Optionally, before determining whether the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the method further includes:
and receiving a notification message, wherein the notification message is used for indicating that the cache module is in a cache emptying state.
Optionally, the correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data includes:
and taking the initial time stamp of the audio data as the corrected time stamp of the audio data.
Optionally, the correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data includes:
determining a timestamp estimate for the audio data;
determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data;
and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Optionally, the determining a timestamp correction value of the audio data according to the timestamp estimation value of the audio data and the initial timestamp of the audio data includes:
and taking the difference value obtained by subtracting the time stamp estimation value of the audio data from the initial time stamp of the audio data as the time stamp correction value of the audio data.
Optionally, the correcting the timestamp of the audio data according to the timestamp estimation value of the audio data and the timestamp correction value of the audio data to obtain the timestamp of the audio data after correction includes:
and adding the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Optionally, after determining the timestamp correction value of the audio data according to the timestamp estimation value of the audio data and the initial timestamp of the audio data, the method further includes:
and taking the time stamp correction value of the audio data as the time stamp correction value of other audio data of the section where the audio data is located, and correcting the time stamps of the other audio data.
Optionally, after obtaining the corrected time stamp of the audio data, the method further includes:
adding header information to the audio data, the header information including: a timestamp of the audio data after correction;
and sending the audio data added with the header information to the audio module.
A second aspect of the present invention provides an audio data processing method applied to a first functional module, where the first functional module is configured to write audio data into a cache module, and the method includes:
receiving audio data, the audio data including an initial timestamp of the audio data;
determining whether the audio data is audio data of a timestamp to be corrected;
if so, setting a first parameter according to the initial timestamp of the audio data, wherein the first parameter is used for indicating the initial timestamp of the audio data.
Optionally, the determining whether the audio data is audio data of a timestamp to be corrected includes:
judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
Optionally, before determining whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the method further includes:
reconstructing the cache module;
and setting a second parameter after the cache module is rebuilt, wherein the second parameter is used for indicating that the cache module is in a rebuilt completion state.
Optionally, after determining whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the method further includes:
if not, judging whether the audio data is the first frame of audio data transmitted after the cache module empties the cache;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
Optionally, before determining whether the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the method further includes:
and receiving a notification message, wherein the notification message is used for indicating that the cache module is in a cache emptying state.
A third aspect of the present invention provides an audio data processing apparatus comprising:
the reading unit is used for reading the audio data from the cache module;
the judging unit is used for determining whether the audio data is audio data of the timestamp to be corrected;
the reading unit is specifically configured to read a first parameter from the first functional module if the audio data is audio data of a timestamp to be corrected, where the first parameter is used to indicate an initial timestamp of the audio data;
and the correcting unit is used for correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
Optionally, the determining unit is further configured to determine whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
Optionally, the apparatus further comprises: a determination unit;
the determining unit is configured to determine that the audio data is audio data of a timestamp to be corrected if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed.
Optionally, the reading unit is further configured to read a second parameter from the first functional module, where the second parameter is used to indicate that the cache module is in a reconstruction completion state.
Optionally, the determining unit is configured to determine whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer if it is determined that the audio data is not the first frame of audio data transmitted after the buffer module has completed reconstructing.
Optionally, the determining unit is configured to determine that the audio data is the audio data of the timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the buffer module empties the buffer.
Optionally, the apparatus further comprises: a notification message receiving unit;
the notification message receiving unit is configured to receive a notification message, where the notification message is used to indicate that the cache module is in a cache empty state.
Optionally, the correcting unit is specifically configured to use an initial timestamp of the audio data as the timestamp of the audio data after correction.
Optionally, the correction unit is specifically configured to determine an estimated time stamp value of the audio data; determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Optionally, the correcting unit is specifically configured to use a difference obtained by subtracting the time stamp estimation value of the audio data from the initial time stamp of the audio data as the time stamp correction value of the audio data.
Optionally, the correcting unit is specifically configured to add the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain a time stamp after the audio data is corrected.
Optionally, the correcting unit is specifically configured to use the time stamp correction value of the audio data as a time stamp correction value of other audio data of the segment where the audio data is located, and correct the time stamp of the other audio data.
Optionally, the apparatus further comprises: a header information transmitting unit;
the header information sending unit is configured to add header information to the audio data, where the header information includes: a timestamp of the audio data after correction; and sending the audio data added with the header information to an audio module.
A fourth aspect of the present invention provides an audio data processing apparatus comprising:
an audio data receiving unit for receiving audio data including an initial time stamp of the audio data;
the judging unit is used for determining whether the audio data is audio data of the timestamp to be corrected;
and the setting unit is used for setting a first parameter according to the initial timestamp of the audio data if the audio data is the audio data of the timestamp to be corrected, wherein the first parameter is used for indicating the initial timestamp of the audio data.
Optionally, the determining unit is specifically configured to determine whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
Optionally, the apparatus further comprises: a determination unit;
the determining unit is configured to determine that the audio data is audio data of a timestamp to be corrected if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed.
Optionally, the apparatus further comprises: a reconstruction unit;
the reconstruction unit is used for reconstructing the cache module.
Optionally, the setting unit is further configured to set a second parameter after the cache module is completely reconstructed, where the second parameter is used to indicate that the cache module is in a state of being completely reconstructed.
Optionally, the determining unit is specifically configured to determine whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer if the audio data is not the first frame of audio data transmitted after the buffer module has completed reconstructing.
Optionally, the determining unit is configured to determine that the audio data is the audio data of the timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the buffer module empties the buffer.
Optionally, the apparatus further comprises: a notification message receiving unit;
the notification message receiving unit is configured to receive a notification message, where the notification message is used to indicate that the cache module is in a cache empty state.
A fifth aspect of the present invention provides an electronic apparatus comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in the memory, performing the method steps of any of the preceding claims.
A sixth aspect of the invention provides a readable storage medium having stored therein a computer program for executing the method according to any one of the preceding claims.
The invention provides an audio data processing method, an audio data processing device, electronic equipment and a storage medium, wherein when the audio data is determined to be audio data of a timestamp to be corrected, the timestamp of the audio data is corrected according to a first parameter read in a first functional module; the first parameter is used to indicate an initial timestamp of the audio data. The invention can correct the time stamp of the audio data and realize the sound and picture synchronization on the basis of not changing the open source multimedia frame structure in the prior art, namely on the basis of not carrying the time stamp in the audio data transmission process.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings needed to be used in the description of the embodiments or the prior art, and obviously, the drawings in the following description are some embodiments of the present invention, and those skilled in the art can obtain other drawings according to the drawings without inventive labor.
FIG. 1 is a schematic structural diagram of functional modules for implementing an audio data processing method according to the present invention;
FIG. 2 is a first schematic signaling flow diagram of an audio data processing method according to the present invention;
FIG. 3 is a schematic signaling flow diagram of a method for processing audio data according to the present invention;
FIG. 4 is a schematic signaling flow diagram of a third audio data processing method according to the present invention;
FIG. 5 is a first flowchart illustrating an audio data processing method according to the present invention;
FIG. 6 is a second flowchart illustrating an audio data processing method according to the present invention;
FIG. 7 is a first schematic structural diagram of an audio data processing apparatus according to the present invention;
FIG. 8 is a second schematic structural diagram of an audio data processing apparatus according to the present invention;
FIG. 9 is a first schematic structural diagram of another audio data processing apparatus according to the present invention;
FIG. 10 is a second schematic structural diagram of another audio data processing apparatus according to the present invention;
fig. 11 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The intelligent terminal in the invention adopts the open source multimedia framework Gstreamer in the prior art, processes the audio data after the audio data is decoded and before the audio data is rendered, and further realizes the multimedia synchronization function. Fig. 1 is a schematic structural diagram of functional modules for implementing an audio data processing method according to the present invention, where the functional modules may be existing functional modules in a Gstreamer, and specifically include: the system comprises a first functional module (such as a Gstaudiobiasesink module), a cache module (such as a Gstaudioringbuffer module), a second functional module (such as a Gstaudioflingersink module) and an audio module (such as an Audio track module).
The first functional module is used for writing the received audio data into the cache module. For example, the first functional module writes the audio data into the buffer module in units of buffers. With the buffer as 300k, the first functional module writes 300k of audio data into the buffer module each time. It should be understood that, in this embodiment, each frame of audio data received by the first functional module includes Pulse Code Modulation (PCM) data and an initial time stamp of the frame of audio data. The audio data written by the first functional module to the buffer module only includes PCM data.
And the buffer module is used for buffering the audio data, namely buffering the PCM data, and outputting the buffered PCM data to the second functional module in the audio playing process. The PCM data is divided and stored in a plurality of segments (segments) according to the time sequence, one segment stores one segment of audio data in the audio data, and one segment contains a plurality of buffers, namely one segment of audio data contains a plurality of sub-audio data.
And the second functional module is used for adding a time stamp to the audio data to be sent to the audio module. The second functional module may calculate a duration of audio data that has been played by the buffer module according to the read audio sample number (sample) and audio sample rate (rate) corresponding to a segment of audio data (i.e., a segment) output by the buffer module, where the duration of the audio data is a quotient of the audio sample number and the audio sample rate, i.e., (duration/rate); then, a time stamp estimate (current + seg.start-base _ time) of the piece of audio data is obtained by conversion with a system clock, and the time stamp estimate is used as a time stamp pts of the piece of audio data. Start represents the initial time stamp in all the sub audio data included in the piece of audio data, and base _ time represents a reference amount with respect to the system clock. Specifically, the first functional module may store base _ time and segment _ time of each piece of audio data, and the second functional module may read segment _ time and base _ time in the first functional module when obtaining the time stamp estimation value of each piece of audio data.
After the second functional module calculates the time stamp of the section of audio data, adding header information to the read audio data, wherein the header information comprises the time stamp; furthermore, the segment of audio data containing the header information is written into the audio module.
And the audio module is used for transmitting the acquired audio data out to the audio hardware for playing the audio.
The first functional module, the cache module, the second functional module and the audio module in the method for processing the audio data can realize the same functions as those in the prior art.
When the audio track of the played audio file is switched, if the Chinese is converted into English, the cache module destroys the cached Chinese PCM data and reconstructs the PCM data of the English audio data, and parameters corresponding to the English PCM data, such as audio sampling number and audio sampling rate, are reset. Because the buffer module destroys and reconstructs the switched audio tracks, and the audio sampling number is reset, although the audio on the terminal is continuously played, the audio sampling number is not continuously recorded, the estimated time stamp value is smaller, and the time stamp estimated by the method has an error with the real time stamp.
In order to solve the above problems, the present invention provides an audio data processing method, which can correct a timestamp and implement audio and video synchronization. The audio data processing method provided by the present invention is described below from the perspective of interaction between the first functional module, the cache module, and the second functional module, fig. 2 is a schematic signaling flow diagram of the audio data processing method provided by the present invention, and as shown in fig. 2, the audio data processing method provided by this embodiment includes:
s201, the first functional module receives audio data, and the audio data comprises an initial time stamp of the audio data.
In this embodiment, the first functional module may receive audio data, where the audio data may be audio data that needs to be continuously played, or audio data that is received after switching audio tracks. Wherein the audio data is decoded PCM data.
The audio data received by the first functional module in this embodiment may be local audio data stored in the terminal, or may be audio data acquired by the terminal from a server. When the received audio data is played, for example, playing to 10 s; illustratively, when the user clicks or otherwise selects an icon for switching the audio track on the terminal, if the user starts playing the chinese language, and the user switches to english at 10s, the first functional module receives english audio data.
Specifically, the audio data received by the first functional module includes an initial timestamp of the audio data. Illustratively, an initial time stamp of english audio data after switching tracks, such as a time stamp of english audio data of the first frame after 10s, may be included in the audio data.
S202, the first functional module determines whether the audio data is audio data of the time stamp to be corrected.
In the prior art, a time stamp estimation value obtained according to an audio sampling number and an audio sampling rate of audio data buffered in a buffer module is used as a time stamp of the audio data. If the audio track is switched, the first functional module destroys and reconstructs the cache module; if the fast forward and fast backward occur, the first functional module clears the audio data cached in the cache module; if fast forward and fast backward occur after switching the audio track, the first functional module also needs to destroy and rebuild the cache module; or due to other external factors, the audio data cached in the caching module is changed (such as deleting part of the audio data or modifying the audio data).
In the above situations, parameters of the audio data cached in the cache module are changed, and further, an estimated value of the timestamp of the audio data acquired by the second functional module is inaccurate. The audio data of the timestamp to be corrected in this embodiment may be changed audio data in the buffer module.
In this embodiment, the first functional module may determine whether the audio data is the audio data of the timestamp to be corrected according to the audio data cached in the caching module. Specifically, the first functional module may determine that the audio data is the audio data of the timestamp to be corrected when it is determined that the audio data cached in the caching module is changed.
S203, if the audio data is the audio data of the time stamp to be corrected, the first functional module sets a first parameter according to the initial time stamp of the audio data, and the first parameter is used for indicating the initial time stamp of the audio data.
When the audio data are determined to be audio data of the timestamp to be corrected, the first functional module sets a first parameter according to the initial timestamp of the received audio data and stores the first parameter; the first parameter is used for indicating an initial time stamp of the audio data, and the initial time stamp of the audio data is a time stamp of a first frame of audio data in the audio data received by the first functional module.
Optionally, in this embodiment, the first parameter may include a timestamp of the first frame of audio data received after the reconstruction of the caching module is completed, for example, the first parameter may be ringbuffer _ freed _ pts. Illustratively, when the audio/video file played on the terminal reaches 10s, a user triggers the terminal to switch the audio track, and the first function module calls a function to reconstruct the cache module; the first functional module may record a timestamp, such as 11s, of the first frame of audio data received after the reconstruction of the cache module is completed; illustratively, the first parameter may be ringbuffer _ freed _ 11.
S204, the first functional module writes the audio data into the cache module.
S205, the second functional module reads the audio data from the buffer module.
The second functional module can read audio data from the cache module, specifically, read PCM data corresponding to the audio data; the audio sampling number and the audio sampling rate corresponding to the audio data cached after the reconstruction of the caching module can be obtained.
Illustratively, when the terminal plays an audio/video file, and the audio sampling number is 2000, the audio track is switched, and then the audio sampling number reconstructed by the cache module starts to be calculated from 0 again. The second functional module may obtain the number of audio samples corresponding to the audio data that is cached after the reconstruction by the caching module.
And S206, the second functional module determines whether the audio data is audio data of the time stamp to be corrected.
As in the above S203, in this embodiment, the audio data of the time stamp to be corrected is the audio data that has changed in the buffer module. Correspondingly, when the audio data in the cache module changes, the first functional module may add a mark corresponding to the change of the audio data in the first functional module. For example, the corresponding flag may be added according to the type of the audio data in the buffer module. For example, after the cache module rebuilding is completed, the first functional module may add a second parameter to the cache module rebuilding completion status flag, which may be ring buffer _ freed.
Optionally, after adding the mark corresponding to the change of the audio data, the first functional module may store an initial timestamp of the audio data received after adding the mark. The first functional module may store the initial timestamp ringbuffer _ freed _ pts of the received audio data after adding the second parameter thereto, for example, after the reconstruction of the buffer module is completed.
In this embodiment, the second functional module may read the flag in the first functional module to determine whether the audio data is the audio data of the time stamp to be corrected. When the second functional module can read the added mark in the first functional module, the audio data is determined to be the audio data of the time stamp to be corrected.
And S207, if the audio data is the audio data of the timestamp to be corrected, the second functional module reads the first parameter from the first functional module.
And if the audio data is the audio data of the timestamp to be corrected, the second functional module reads the first parameter from the first functional module, wherein the second functional module can acquire the initial timestamp of the audio data of the timestamp to be corrected in the first parameter.
Illustratively, if the second functional module determines that the audio data is the audio data of the timestamp to be corrected, the first parameter, which is ringbuffer _ freed _11, is read from the first functional module.
And S208, the second functional module corrects the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
In this embodiment, the second functional module may obtain the timestamp of the audio data by a method in the prior art according to the audio sampling number and the audio sampling rate corresponding to the audio data; after the buffer module is reconstructed, the number of audio samples in the audio data is changed, and if the number of audio samples in the audio data is reset to 0, the time stamp of the audio data acquired by the second functional module is an inaccurate time stamp. It should be noted that the second functional module may obtain the time stamp of each frame of audio data in the audio data according to the audio sampling number and the audio sampling rate corresponding to the audio data.
In this embodiment, the second functional module corrects the time stamp of the audio data according to the initial time stamp of the audio data to obtain a corrected time stamp of the audio data; for the first frame of audio data in the audio data, the initial timestamp of the audio data read by the second functional module in the first functional module may be directly used as the timestamp of the corrected first frame of audio data in the audio data.
Optionally, for each frame of audio data of the audio data, the time stamp of the first frame of audio data in the audio data calculated by the second functional module may be subtracted from the initial time stamp of the audio data read in the first functional module, so as to obtain a time stamp difference value; and after the time stamp of each frame of audio data is calculated by the second functional module, adding the time stamp difference value to obtain the time stamp after each frame of audio data is corrected.
In this embodiment, an audio data processing method is provided, where the method includes: reading audio data from a buffer module; determining whether the audio data is audio data of a timestamp to be corrected; if so, reading a first parameter from the first functional module, wherein the first parameter is used for indicating an initial timestamp of the audio data; and correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data. The invention can correct the time stamp of the audio data and realize the sound and picture synchronization on the basis of not changing the open source multimedia frame structure in the prior art, namely on the basis of not carrying the time stamp in the audio data transmission process.
The audio data processing method provided by the present invention is further described below with reference to fig. 3 from the perspective of interaction between the first function module, the buffer module, the first function module, and the audio module, where fig. 3 is a schematic signaling flow diagram of the audio data processing method provided by the present invention, and as shown in fig. 3, the audio data processing method provided by this embodiment includes:
s301, the first functional module receives audio data, and the audio data comprises an initial time stamp of the audio data.
S302, the first functional module reconstructs the cache module; and after the cache module is rebuilt, the first functional module sets a second parameter, wherein the second parameter is used for indicating that the cache module is in a rebuilt completion state.
In this embodiment, when switching audio tracks, the first functional module may call a function to reconstruct the cache module.
The first functional module may obtain a reconstructed state of the cache module, and set a second parameter after the reconstruction of the cache module is completed, that is, add the second parameter to the first functional module, where the second parameter is used to indicate that the cache module is in the reconstructed state, and for example, the second parameter is ringbuffer _ recovered.
And S303, the first function module judges whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
In this embodiment, the first functional module receives the audio data and determines whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
Specifically, after the cache module is completely reconstructed, the first functional module may obtain a timestamp of the completion of the reconstruction of the cache module; and judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is finished according to the timestamp of each frame of audio data of the received audio data and the timestamp of the reconstruction of the cache module.
And S304, if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, the first function module determines that the audio data is the audio data of the timestamp to be corrected.
In this embodiment, due to the reconstruction of the buffer module, the parameter of the buffered audio data may be reset, which may further cause the inaccuracy of the time stamp of the audio data calculated by the second functional module. And when the first functional module determines that the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed, determining that the audio data is the audio data of the timestamp to be corrected.
S305, if the audio data is the audio data of the time stamp to be corrected, the first functional module sets a first parameter according to the initial time stamp of the audio data.
S306, the first functional module writes the audio data into the cache module.
S307, the second functional module reads the audio data from the buffer module.
S308, the second functional module reads the second parameter from the first functional module.
The first functional module stores a second parameter, where the second parameter is used to indicate that the cache module is in a reconstruction completion state, such as ringbuffer _ freed stored in the first functional module.
And the second functional module reads the second parameter from the first functional module and determines that the cache module is in a reconstruction completion state.
S309, the second function module judges whether the audio data is the first frame audio data transmitted after the reconstruction of the buffer module is completed.
In this embodiment, the second functional module reads the second parameter and the first parameter from the first functional module to determine whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed. Since the second parameter is used to indicate that the cache module is in the reconstruction completion state, if the second parameter is ringbuffer _ freed; the first parameter is used to indicate an initial time stamp of the audio data, such as ringbuffer _ freed _ pts; if the second functional module can read the newly added second parameter and the first parameter in the first functional module, the audio data can be determined as the first frame of audio data transmitted after the reconstruction of the cache module is completed.
And S310, if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, the second function module determines that the audio data is the audio data of the timestamp to be corrected.
S311, if the audio data is the audio data of the timestamp to be corrected, the second functional module reads the first parameter from the first functional module.
And S312, the second functional module corrects the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
In this embodiment, if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, the initial timestamp of the audio data is used as the timestamp after the audio data is corrected. Alternatively, the second functional module may determine an estimated time stamp value of the audio data, where the estimated time stamp value may be obtained by calculation according to current _ duration + seg.start _ base _ time; determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Specifically, the difference obtained by subtracting the time stamp estimation value of the audio data from the initial time stamp of the audio data may be used as the time stamp correction value of the audio data. And adding the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Illustratively, the time stamp estimate of the first frame of audio data is pts1, and the difference obtained by subtracting the time stamp estimate of the audio data from the initial time stamp of the audio data is pts _ diff, then the corrected time stamp of the audio data is pts1' (pts1 ═ pts1+ pts _ diff).
In this embodiment, the second functional module may further correct the time stamps of other audio data by using the time stamp correction value of the audio data as the time stamp correction value of other audio data of the segment where the audio data is located.
Illustratively, the timestamp of other audio data of the segment in which the audio data is located, such as the second frame of audio data, is estimated to be pts2, then the corrected timestamp pts2' of the second frame of audio data is pts2 ═ pts2+ pts _ diff.
S313, the second functional module adds header information to the audio data, the header information including: corrected time stamp of audio data.
In this embodiment, after acquiring the timestamp information after the audio data is corrected, the second functional module adds header information to the audio data, where the header information includes: corrected time stamp of audio data. Optionally, in this embodiment, a timestamp corrected for each frame of audio data in the audio data may be added to the header information.
And S314, the second functional module sends the audio data added with the header information to the audio module.
In this embodiment, after the audio data after the second functional module will add the header information is sent to the audio module, the audio module can acquire the timestamp after the correction of the audio data, and according to the timestamp after the correction of the audio data included in this header information, the audio and video data is played synchronously, so that the sound and picture synchronization is realized.
The implementation manners in S301 and S305 to S307 in this embodiment may refer to the related descriptions in S201 and S203 to S205 in the above embodiments, which are not described herein again.
In this embodiment, if the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, it is determined that the audio data is the audio data of the timestamp to be corrected, and the initial timestamp of the audio data read in the first functional module can be directly used as the timestamp of the audio data after the correction; or determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data, the time stamp of the audio data is corrected to obtain the corrected time stamp of the audio data, the time stamp of each frame of audio data in the audio data can be corrected, and sound and picture synchronization is achieved.
In this embodiment, in the case of switching the audio track, if the audio/video file is also subjected to fast-backward or fast-forward operation after the audio track is switched, the cache module further clears the cached audio data correspondingly. Due to the reconstruction of the buffer module, the parameters of the buffered audio data can be reset; the time stamp of the audio data calculated by the second functional module is also inaccurate.
The following further describes the audio data processing method provided by the present invention from the perspective of interaction between the first function module, the buffer module, the first function module, and the audio module with reference to fig. 4, where fig. 4 is a schematic signaling flow diagram of the audio data processing method provided by the present invention, and as shown in fig. 4, the audio data processing method provided by this embodiment includes:
s401, the first functional module receives audio data, wherein the audio data comprises an initial time stamp of the audio data.
S402, the first functional module rebuilds the cache module; and after the cache module is rebuilt, the first functional module sets a second parameter, wherein the second parameter is used for indicating that the cache module is in a rebuilt completion state.
S404, the first function module judges whether the audio data is the first frame audio data transmitted after the reconstruction of the buffer module is completed.
S405, the first functional module receives a notification message, wherein the notification message is used for indicating that the cache module is in a cache emptying state.
In this embodiment, after the audio/video file is fast-backed or fast-forwarded, each module receives a notification message flush _ stop indicating that fast-backing or fast-forwarding is completed; the notification message is used for indicating that the cache module is in a cache clearing state, and correspondingly, the cache module clears the cached audio data and is in the cache clearing state.
Specifically, after receiving the notification message, the first functional module determines that fast rewinding or fast forwarding is completed, and may set a third parameter, where the third parameter is used to represent that fast rewinding or fast forwarding is completed, such as sink _ flush.
S406, if the audio data is not the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the first function module determines whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer.
In this embodiment, when the first functional module determines that the audio data is not the first frame of audio data transmitted after the reconstruction of the buffer module is completed, it is determined whether the audio data is the first frame of audio data transmitted after the buffer module clears the buffer.
The first functional module acquires a timestamp of the reconstruction completion of the cache module after the cache module clears the cache, and judges whether the audio data is the first frame of audio data transmitted after the cache module clears the cache according to the timestamp of each frame of audio data of the received audio data and the timestamp of the reconstruction completion of the cache module.
The first functional module determines that the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, and may store a timestamp of the first frame of audio data transmitted after the buffer module empties the buffer, such as flush _ pts.
S407, if the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the first function module determines that the audio data is the audio data of the timestamp to be corrected.
The audio data is the first frame of audio data transmitted after the buffer module empties the buffer, and the timestamp of the audio data calculated by the second functional module is inaccurate due to the reconstruction of the buffer module; therefore, when the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the audio data is the audio data of the timestamp to be corrected.
S408, if the audio data is the audio data of the time stamp to be corrected, the first functional module sets a first parameter according to the initial time stamp of the audio data.
And S409, the first functional module writes the audio data into the cache module.
And S410, the second functional module reads the audio data from the buffer module.
S411, the second function module reads the second parameter from the first function module.
S412, the second function module determines whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
S413, the second functional module receives the notification message.
In this embodiment, after the audio/video file is fast-backed or fast-forwarded, each module receives a notification message (e.g., flush _ stop) indicating that fast-backing or fast-forwarding is completed; the notification message is used for indicating that the cache module is in a cache clearing state, and correspondingly, the cache module clears the cached audio data and is in the cache clearing state. Specifically, the second functional module may receive the notification message.
S414, if the audio data is not the first frame of audio data transmitted after the reconstruction of the buffer module is completed, the second function module determines whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer.
In this embodiment, when the second functional module determines that the audio data is not the first frame of audio data transmitted after the reconstruction of the cache module is completed, it determines whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed by reading the third parameter and the timestamp of the first frame of audio data transmitted after the cache module clears the cache in the first functional module. The third parameter is used for representing the completion of fast backward or fast forward, and also represents the completion of emptying the cache by the cache module, for example, the third parameter is sink _ flush; the cache module clears the timestamp of the first frame of audio data transmitted after caching, such as the flushed _ pts; if the second functional module can read the newly added third parameter and the timestamp of the first frame of audio data transmitted after the cache module empties the cache in the first functional module, it can be determined that the audio data is the first frame of audio data transmitted after the cache module empties the cache.
S415, if the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the second functional module determines that the audio data is the audio data of the timestamp to be corrected.
S416, if the audio data is the audio data of the timestamp to be corrected, the second functional module reads the first parameter from the first functional module.
And S417, the second functional module corrects the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
Correspondingly, in this embodiment, if the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the initial timestamp of the audio data may be used as the timestamp after the audio data is corrected.
Alternatively, the second functional module may determine an estimated time stamp value of the audio data, where the estimated time stamp value may be obtained by calculation according to a formula of a time stamp pts (duration + seg.start-base _ time); determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Specifically, the difference obtained by subtracting the time stamp estimation value of the audio data from the initial time stamp of the audio data may be used as the time stamp correction value of the audio data. And adding the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
In this embodiment, the second functional module may further correct the time stamps of other audio data by using the time stamp correction value of the audio data as the time stamp correction value of other audio data of the segment where the audio data is located.
It is noted that the initial timestamp is flush _ pts.
S418, the second functional module adds header information to the audio data, where the header information includes: corrected time stamp of audio data.
And S419, the second functional module sends the audio data added with the header information to the audio module.
The implementation manners in S401 to S404, S408 to S412, and S416 to S419 in this embodiment may refer to the related descriptions in S301 to S304, S305 to S309, and S311 to S314 in the foregoing embodiments, which are not described herein again.
In this embodiment, if the audio data is the first frame of audio data transmitted after the buffer module clears the buffer, it is determined that the audio data is the audio data of the timestamp to be corrected, and the initial timestamp of the audio data read in the first functional module may be directly used as the timestamp of the audio data after correction; or determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data, the time stamp of the audio data is corrected to obtain the corrected time stamp of the audio data, the time stamp of each frame of audio data in the audio data can be corrected, and sound and picture synchronization is achieved.
In summary, the following describes the audio data processing method according to the present invention from the perspective of the first functional module and the second functional module, respectively.
The following describes the audio data processing method from the perspective of the second functional module with reference to fig. 5; fig. 5 is a first schematic flowchart of an audio data processing method provided by the present invention, and as shown in fig. 5, the audio data processing method provided by this embodiment includes:
s501, reading audio data from the buffer module.
S502, judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed; if yes, go to S504, otherwise go to S503.
S503, judging whether the audio data is the first frame audio data transmitted after the buffer module empties the buffer; if so, go to S504, otherwise, go to S505.
And S504, determining the audio data as the audio data of the time stamp to be corrected.
And S505, correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
In this embodiment, for the first frame of audio data transmitted after the reconstruction of the buffer module is completed and the first frame of audio data transmitted after the buffer module clears the buffer (hereinafter, both referred to as first frame of audio data), the initial timestamp of the audio data may be directly used as the timestamp after the audio data is corrected; the time stamp correction value of the initial time stamp of the first frame of audio data and the time stamp estimated value of the time stamp of the first frame of audio data may be obtained, and the sum of the difference value and the initial time stamp of the first frame of audio data may be used as the time stamp after the first frame of audio data is corrected according to the difference value between the time stamp estimated value of the audio data and the time stamp correction value of the audio data.
For non-first frame audio data, a time stamp estimation value of each frame audio data and a time stamp correction value of an initial time stamp of each frame audio data may be acquired, and a sum of a difference value of the time stamp estimation value of the audio data and the time stamp correction value of the audio data and the initial time stamp of each frame audio data may be used as a time stamp after correction of each frame audio data.
S506, adding header information to the audio data, the header information including: corrected time stamp of audio data.
And S507, sending the audio data added with the header information to an audio module.
The following describes the audio data processing method from the perspective of the first functional module with reference to fig. 6; fig. 6 is a schematic flowchart of a second audio data processing method according to the present invention, and as shown in fig. 6, the audio data processing method according to the present embodiment includes:
s601, receiving audio data.
S602, judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed; if yes, go to step S604, otherwise go to step S603.
S603, judging whether the audio data is the first frame audio data transmitted after the buffer module empties the buffer; if yes, go to S604, otherwise go to S605.
S604, determining that the audio data is the audio data with the timestamp to be corrected, and recording the initial timestamp of the audio data.
And S605, writing the audio data into the cache module.
It is to be understood that, although the above embodiments all use the first functional module and the second functional module as execution subjects, the audio data processing method provided by the embodiments of the present invention has been described and illustrated. However, it will be understood by those skilled in the art that the above operations may also be understood as: the intelligent television calls the functional modules to complete and realize the operation, and the operation is not described again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
FIG. 7 is a first schematic structural diagram of an audio data processing apparatus according to the present invention; the audio data processing apparatus may implement part or all of an electronic device (e.g., a smart television) by software, hardware, or a combination of both. As shown in fig. 7, the audio data processing apparatus 700 may include: a reading unit 701, a judgment unit 702, and a correction unit 703.
A reading unit 701, configured to read audio data from the buffer module.
A judging unit 702, configured to determine whether the audio data is audio data of a timestamp to be corrected.
The reading unit 701 is specifically configured to read a first parameter from the first functional module if the audio data is the audio data of the time stamp to be corrected, where the first parameter is used to indicate an initial time stamp of the audio data.
The correcting unit 703 is configured to correct the time stamp of the audio data according to the initial time stamp of the audio data, so as to obtain a time stamp after the audio data is corrected.
Optionally, fig. 8 is a schematic structural diagram of an audio data processing apparatus provided by the present invention, and as shown in fig. 8, the audio data processing apparatus 700 may further include: a determination unit 704, a notification message receiving unit 705, and a header information transmitting unit 706.
Optionally, the determining unit 702 is further configured to determine whether the audio data is the first frame of audio data transmitted after the reconstruction of the buffer module is completed.
The determining unit 704 is configured to determine that the audio data is the audio data of the timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the reconstruction of the buffer module is completed.
Optionally, the reading unit 701 is further configured to read a second parameter from the first functional module, where the second parameter is used to indicate that the cache module is in a reconstruction completion state.
Optionally, the determining unit 702 is configured to determine whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer if it is determined that the audio data is not the first frame of audio data transmitted after the buffer module has completed reconstructing.
Optionally, the determining unit 704 is configured to determine that the audio data is the audio data of the timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the buffer module empties the buffer.
The notification message receiving unit 705 is configured to receive a notification message, where the notification message is used to indicate that the cache module is in a cache empty state.
Optionally, the correcting unit 703 is specifically configured to use an initial timestamp of the audio data as the timestamp of the audio data after being corrected.
Optionally, the correcting unit 703 is specifically configured to determine an estimated time stamp value of the audio data; determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data; and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
Optionally, the correcting unit 703 is specifically configured to use a difference obtained by subtracting the initial timestamp of the audio data from the timestamp estimate of the audio data as the timestamp correction value of the audio data.
Optionally, the correcting unit 703 is specifically configured to add the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain a corrected time stamp of the audio data.
Optionally, the correcting unit 703 is specifically configured to use the timestamp correction value of the audio data as a timestamp correction value of other audio data of the segment where the audio data is located, and correct the timestamp of the other audio data.
A header information sending unit 706, configured to add header information to the audio data, where the header information includes: a timestamp of the audio data after correction; and sending the audio data added with the header information to an audio module.
The audio data processing apparatus provided by the present invention can execute the actions of the second functional module in the above method embodiments, and the implementation principle and technical effect are similar, which are not described herein again.
FIG. 9 is a first schematic structural diagram of another audio data processing apparatus according to the present invention; the audio data processing apparatus may implement part or all of an electronic device (e.g., a smart television) by software, hardware, or a combination of both. As shown in fig. 9, the audio data processing apparatus 900 may include: an audio data receiving unit 901, a judging unit 902, and a setting unit 903.
An audio data receiving unit 901 for receiving audio data, the audio data including an initial time stamp of the audio data.
A judging unit 902, configured to determine whether the audio data is audio data of a timestamp to be corrected.
A setting unit 903, configured to set a first parameter according to an initial timestamp of the audio data if the audio data is audio data of a timestamp to be corrected, where the first parameter is used to indicate the initial timestamp of the audio data.
Fig. 10 is a schematic structural diagram of another audio data processing apparatus provided by the present invention, and as shown in fig. 10, the audio data processing apparatus 900 may further include: a determination unit 904, a reconstruction unit 905 and a notification message receiving unit 906.
Optionally, the determining unit 902 is specifically configured to determine whether the audio data is the first frame of audio data transmitted after the buffer module completes reconstruction.
The determining unit 904 is configured to determine that the audio data is audio data of a timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the reconstruction of the buffer module is completed.
A reconstructing unit 905 is configured to reconstruct the buffer module.
Optionally, the setting unit 903 is further configured to set a second parameter after the cache module is rebuilt, where the second parameter is used to indicate that the cache module is in a rebuilt complete state.
Optionally, the determining unit 902 is specifically configured to determine whether the audio data is the first frame of audio data transmitted after the buffer module has emptied the buffer if the audio data is not the first frame of audio data transmitted after the buffer module completes reconstruction.
Optionally, the determining unit 904 is configured to determine that the audio data is the audio data of the timestamp to be corrected, if the audio data is the first frame of audio data that is transmitted after the buffer module empties the buffer.
A notification message receiving unit 906, configured to receive a notification message, where the notification message is used to indicate that the cache module is in a cache empty state.
The audio data processing apparatus provided by the present invention can execute the actions of the first functional module in the above method embodiments, and the implementation principle and technical effect are similar, which are not described herein again.
Fig. 11 is a schematic structural diagram of an electronic device provided in the present invention. As shown in fig. 11, the electronic device may include: at least one processor 1101 and memory 1102. Fig. 11 shows an electronic device as an example of a processor, wherein,
the memory 1102 stores programs. In particular, the program may include program code comprising computer operating instructions. Memory 1102 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 1101 is configured to execute the computer execution instructions stored in the memory 1102 to implement the key processing method in the foregoing embodiment, which has similar implementation principles and technical effects, and is not described herein again.
The processor 1101 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present invention.
Alternatively, in a specific implementation, if the communication interface, the memory 1102 and the processor 1101 are implemented independently, the communication interface, the memory 1102 and the processor 1101 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The buses may be divided into address buses, data buses, control buses, etc., but do not represent only one bus or one type of bus.
Optionally, in a specific implementation, if the communication interface, the memory 1102 and the processor 1101 are integrated on a single chip, the communication interface, the memory 1102 and the processor 1101 may complete the same communication through an internal interface.
The present invention also provides a computer-readable storage medium, which may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. Specifically, the computer-readable storage medium stores therein program instructions for the method in the above-described embodiment.
The invention also provides a computer program product comprising a computer program or instructions which, when executed, may implement the method of the above embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (18)

1. An audio data processing method is applied to a second functional module, and the second functional module is used for adding a time stamp to audio data to be sent to an audio module, and the method comprises the following steps:
reading audio data from a buffer module;
judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed;
if so, determining the audio data as the audio data of the timestamp to be corrected;
reading a first parameter from a first functional module, the first parameter indicating an initial timestamp of the audio data;
and correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
2. The method of claim 1, wherein before determining whether the audio data is the first frame of audio data transmitted after the buffer module completes reconstruction, the method further comprises:
and reading a second parameter from the first functional module, wherein the second parameter is used for indicating that the cache module is in a reconstruction completion state.
3. The method of claim 1, wherein after determining whether the audio data is the first frame of audio data transmitted after the buffer module completes reconstructing, the method further comprises:
if not, judging whether the audio data is the first frame of audio data transmitted after the cache module empties the cache;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
4. The method according to claim 3, wherein before the determining whether the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the method further comprises:
and receiving a notification message, wherein the notification message is used for indicating that the cache module is in a cache emptying state.
5. The method of claim 1, wherein the correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data comprises:
and taking the initial time stamp of the audio data as the corrected time stamp of the audio data.
6. The method of claim 1, wherein the correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data comprises:
determining a timestamp estimate for the audio data;
determining a time stamp correction value of the audio data according to the time stamp estimation value of the audio data and the initial time stamp of the audio data;
and correcting the time stamp of the audio data according to the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
7. The method of claim 6, wherein determining a timestamp correction value for the audio data based on the timestamp estimate for the audio data and the initial timestamp for the audio data comprises:
and taking the difference value obtained by subtracting the time stamp estimation value of the audio data from the initial time stamp of the audio data as the time stamp correction value of the audio data.
8. The method of claim 7, wherein the correcting the time stamp of the audio data based on the time stamp estimate of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data comprises:
and adding the time stamp estimation value of the audio data and the time stamp correction value of the audio data to obtain the corrected time stamp of the audio data.
9. The method of claim 6, wherein after determining the timestamp correction value for the audio data based on the timestamp estimate for the audio data and the initial timestamp for the audio data, the method further comprises:
and taking the time stamp correction value of the audio data as the time stamp correction value of other audio data of the section where the audio data is located, and correcting the time stamps of the other audio data.
10. The method of any of claims 1-9, wherein after obtaining the audio data corrected time stamp, the method further comprises:
adding header information to the audio data, the header information including: a timestamp of the audio data after correction;
and sending the audio data added with the header information to the audio module.
11. An audio data processing method is applied to a first functional module, and the first functional module is used for writing audio data into a cache module, and is characterized in that the method comprises the following steps:
receiving audio data, the audio data including an initial timestamp of the audio data;
judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed;
if so, determining the audio data as the audio data of the timestamp to be corrected;
setting a first parameter according to the initial timestamp of the audio data, wherein the first parameter is used for indicating the initial timestamp of the audio data.
12. The method of claim 11, wherein before determining whether the audio data is the first frame of audio data transmitted after the buffer module completes reconstructing, the method further comprises:
reconstructing the cache module;
and setting a second parameter after the cache module is rebuilt, wherein the second parameter is used for indicating that the cache module is in a rebuilt completion state.
13. The method of claim 11, wherein after determining whether the audio data is the first frame of audio data transmitted after the buffer module completes reconstructing, further comprising:
if not, judging whether the audio data is the first frame of audio data transmitted after the cache module empties the cache;
and if so, determining the audio data as the audio data of the timestamp to be corrected.
14. The method of claim 13, wherein before determining whether the audio data is the first frame of audio data transmitted after the buffer module empties the buffer, the method further comprises:
and receiving a notification message, wherein the notification message is used for indicating that the cache module is in a cache emptying state.
15. An audio data processing apparatus, comprising:
the reading unit is used for reading the audio data from the cache module;
the judging unit is used for judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, and if so, determining that the audio data is the audio data of the timestamp to be corrected;
the reading unit is further configured to read a first parameter from a first functional module if the audio data is audio data of a timestamp to be corrected, where the first parameter is used to indicate an initial timestamp of the audio data;
and the correcting unit is used for correcting the time stamp of the audio data according to the initial time stamp of the audio data to obtain the corrected time stamp of the audio data.
16. An audio data processing apparatus, comprising:
an audio data receiving unit for receiving audio data including an initial time stamp of the audio data;
the judging unit is used for judging whether the audio data is the first frame of audio data transmitted after the reconstruction of the cache module is completed, and if so, determining that the audio data is the audio data of the timestamp to be corrected;
and the setting unit is used for setting a first parameter according to the initial timestamp of the audio data if the audio data is the audio data of the timestamp to be corrected, wherein the first parameter is used for indicating the initial timestamp of the audio data.
17. An electronic device, comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in said memory for performing the method steps of any of claims 1-14.
18. A readable storage medium, characterized in that a computer program is stored in the readable storage medium for performing the method of any of claims 1-14.
CN201910194879.0A 2019-03-14 2019-03-14 Audio data processing method and device, electronic equipment and storage medium Active CN109905752B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910194879.0A CN109905752B (en) 2019-03-14 2019-03-14 Audio data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910194879.0A CN109905752B (en) 2019-03-14 2019-03-14 Audio data processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109905752A CN109905752A (en) 2019-06-18
CN109905752B true CN109905752B (en) 2021-06-08

Family

ID=66953198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910194879.0A Active CN109905752B (en) 2019-03-14 2019-03-14 Audio data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109905752B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153447B (en) * 2020-09-27 2022-06-14 海信视像科技股份有限公司 Display device and sound and picture synchronous control method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237586A (en) * 2008-02-22 2008-08-06 上海华平信息技术股份有限公司 Synchronous playing method for audio and video buffer
CN104269182A (en) * 2014-09-18 2015-01-07 歌尔声学股份有限公司 Synchronized audio playing method, device and system
CN107566890A (en) * 2017-09-15 2018-01-09 深圳国微技术有限公司 Handle audio stream broadcasting abnormal method, apparatus, computer installation and computer-readable recording medium
CN107566889A (en) * 2017-09-15 2018-01-09 深圳国微技术有限公司 Audio stream flow rate error processing method, device, computer installation and computer-readable recording medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9001216B2 (en) * 2012-10-12 2015-04-07 Sony Corporation Method and apparatus for video streaming
AU2018269790B2 (en) * 2017-05-15 2022-12-22 MIXHalo Corp. Systems and methods for providing real-time audio and data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237586A (en) * 2008-02-22 2008-08-06 上海华平信息技术股份有限公司 Synchronous playing method for audio and video buffer
CN104269182A (en) * 2014-09-18 2015-01-07 歌尔声学股份有限公司 Synchronized audio playing method, device and system
CN107566890A (en) * 2017-09-15 2018-01-09 深圳国微技术有限公司 Handle audio stream broadcasting abnormal method, apparatus, computer installation and computer-readable recording medium
CN107566889A (en) * 2017-09-15 2018-01-09 深圳国微技术有限公司 Audio stream flow rate error processing method, device, computer installation and computer-readable recording medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Gstreamer媒体播放器的研究与设计;贺志强;《中国优秀硕士学位论文全文数据库(电子期刊)》;20091115;全文 *

Also Published As

Publication number Publication date
CN109905752A (en) 2019-06-18

Similar Documents

Publication Publication Date Title
EP1111612B1 (en) Method and device for managing multimedia file
US8374480B2 (en) Method and apparatus for video image data recording and playback
CN109936763B (en) Video processing and publishing method
TWI287398B (en) Recorder, player, and recording medium for displaying image, and methods therefor
CN110418186B (en) Audio and video playing method and device, computer equipment and storage medium
CN108848414A (en) The switching method and player of a kind of playback method of video, clarity
EP1486979A1 (en) Data recording method, data recording device, data recording medium, data reproduction method, and data reproduction device
CN108111997A (en) Bluetooth equipment audio synchronization method and system
CN109905752B (en) Audio data processing method and device, electronic equipment and storage medium
CN108156500B (en) Multimedia data time correction method, computer device and computer readable storage medium
CN114025202B (en) Video processing method, device and storage medium
JP2015029231A (en) Recording apparatus and control method therefor
US8185815B1 (en) Live preview
CN110234029B (en) Playing processing method, device, equipment and storage medium of multi-sensor data
CN113014981A (en) Video playing method and device, electronic equipment and readable storage medium
CN111263211B (en) Method for caching video data and terminal equipment
CN113473215B (en) Screen recording method, device, terminal and storage medium
WO2018139283A1 (en) Image processing device, method and program
WO2018076899A1 (en) Data switching method, device, terminal and computer-readable storage medium
US8761573B2 (en) Recording device, imaging and recording device, recording method, and program
CN115426501A (en) Audio and video code stream time calibration method and electronic equipment
US8442376B2 (en) Image data recording/playback device, system, and method
CN108335706B (en) Seamless playing method of multimedia file, terminal equipment and storage medium
US7672402B2 (en) Data processing apparatus and method and encoding device
JP4270281B2 (en) Apparatus, method, and program for image processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218

Applicant after: Hisense Visual Technology Co., Ltd.

Address before: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218

Applicant before: QINGDAO HISENSE ELECTRONICS Co.,Ltd.

GR01 Patent grant
GR01 Patent grant