Summary of the invention
Embodiment of the disclosure proposes the method and apparatus for buffered audio data.
In a first aspect, embodiment of the disclosure provides a kind of method for buffered audio data, comprising: in response to obtaining
It gets to buffered audio segment, obtains caching range set related with target audio fragment sequence, wherein to buffered audio piece
The corresponding first caching range of section, the caching range cached in range set correspond to the audio fragment in target audio fragment sequence;
If caching at least one of range set caching range has intersection with the first caching range respectively, at least one is slow from above-mentioned
It deposits and selects a caching range in range as the first item to be processed, cache range as the second item to be processed for first, hold
The following caching of row: based on the first item to be processed and the corresponding audio fragment of the second item to be processed, new audio piece is determined
Section;Audio fragment corresponding with the first item to be processed in target audio fragment sequence is replaced with into new audio fragment.
In some embodiments, based on the first item to be processed and the corresponding audio fragment of the second item to be processed, really
Before fixed new audio fragment, the above method further include: be based on the first item to be processed and the second item to be processed, determine new caching model
It encloses;And based on the first item to be processed and the corresponding audio fragment of the second item to be processed, determine new audio fragment, comprising:
Based on the first item to be processed and the corresponding audio fragment of the second item to be processed, determining new audio corresponding with range is newly cached
Segment.
In some embodiments, it is replaced by audio fragment corresponding with the first item to be processed in target audio fragment sequence
It is changed to after new audio fragment, the above method further include: if there is also unselected to delay at least one above-mentioned caching range
Range is deposited, then chooses a caching range from unselected caching range, using the caching range as the first item to be processed,
And new audio fragment is extracted from target audio fragment sequence, using new caching range corresponding to new audio fragment as second
Item to be processed, continues to execute caching.
In some embodiments, it is replaced by audio fragment corresponding with the first item to be processed in target audio fragment sequence
It is changed to after new audio fragment, the above method further include: if there is no unselected to delay at least one above-mentioned caching range
Range is deposited, then terminates above-mentioned caching.
In some embodiments, it is based on the first item to be processed and the second item to be processed, determines new caching range, comprising: will
Minimum starting point in the starting point of first item to be processed and the second item to be processed is determined as newly caching the starting point of range;By first wait locate
The starting point of item and the summation of length are managed as the first value, using the summation of the starting point of the second item to be processed and length as second value,
It is determined as the difference of maximum value and minimum starting point in the first value and second value newly to cache the length of range.
In some embodiments, the above method further include: if there is no have with the first caching range in caching range set
The caching range of intersection, but the caching range there are starting point less than the starting point of the first caching range, it is determined that caching range set
In first object caching range and the first caching range with the presence or absence of joining end to end situation, wherein first object caches range
Starting point with first caching range starting point close on and less than first caching range starting point;If first object caches range and the
There is the situation that joins end to end in one caching range, then splice audio fragment corresponding to first object caching range and to buffered audio
Segment is obtained through spliced first audio fragment, will be corresponding with first object caching range in target audio fragment sequence
Audio fragment replace with the first audio fragment.
In some embodiments, the above method further include: if first object caching range and the first caching range are not present
Join end to end situation, then in target audio fragment sequence, first object caching range institute will be inserted into buffered audio segment
First designated position of corresponding audio fragment.
In some embodiments, the above method further include: if there is no have with the first caching range in caching range set
The caching range of intersection, but there are the caching ranges that starting point is greater than the starting point of the first caching range, it is determined that caching range set
In the second target cache range and the first caching range with the presence or absence of joining end to end situation, wherein the second target cache range
Starting point with first caching range starting point close on and be greater than first caching range starting point;If the second target cache range and
There is the situation that joins end to end in one caching range, then splice audio fragment corresponding to the second target cache range and to buffered audio
Segment is obtained through spliced second audio fragment, will be corresponding with the second target cache range in target audio fragment sequence
Audio fragment replace with the second audio fragment.
In some embodiments, the above method further include: if the second target cache range and the first caching range are not present
Join end to end situation, then in target audio fragment sequence, the second target cache range institute will be inserted into buffered audio segment
Second designated position of corresponding audio fragment.
Second aspect, embodiment of the disclosure provide a kind of device for buffered audio data, which includes: to obtain
Unit is taken, is configured in response to get to buffered audio segment, obtains caching model related with target audio fragment sequence
Enclose set, wherein to the corresponding first caching range of buffered audio segment, the caching range cached in range set corresponds to target sound
Audio fragment in frequency fragment sequence;Cache unit, if being configured to cache at least one of range set caching range point
Not with first caching range have intersection, then from it is above-mentioned at least one caching range in select a caching range as first to
Processing item executes following caching: based on the first item to be processed and second using the first caching range as the second item to be processed
The corresponding audio fragment of item to be processed, determines new audio fragment;It will be to be processed with first in target audio fragment sequence
The corresponding audio fragment of item replaces with new audio fragment.
In some embodiments, cache unit is further configured to: it is based on the first item to be processed and the second item to be processed,
Determine new caching range;It is determining with new caching based on the first item to be processed and the corresponding audio fragment of the second item to be processed
The corresponding new audio fragment of range.
In some embodiments, cache unit is still further configured to: by target audio fragment sequence with
After the corresponding audio fragment of one item to be processed replaces with new audio fragment, if there is also not at least one above-mentioned caching range
The caching range being selected then chooses a caching range from unselected caching range, using the caching range as the
One item to be processed, and new audio fragment is extracted from target audio fragment sequence, by new caching corresponding to new audio fragment
Range continues to execute above-mentioned caching as the second item to be processed.
In some embodiments, cache unit is still further configured to: by target audio fragment sequence with
After the corresponding audio fragment of one item to be processed replaces with new audio fragment, if there is no not at least one above-mentioned caching range
The caching range being selected, then terminate above-mentioned caching.
In some embodiments, cache unit is further configured to: by the first item to be processed and the second item to be processed
Minimum starting point in starting point is determined as newly caching the starting point of range;Using the summation of the starting point of the first item to be processed and length as
One value, using the summation of the starting point of the second item to be processed and length as second value, by the first value and second value maximum value with
The difference of minimum starting point is determined as newly caching the length of range.
In some embodiments, above-mentioned apparatus further include: the first determination unit, if being configured to cache in range set not
The caching range that range has intersection, but the caching model there are starting point less than the starting point of the first caching range are cached in the presence of with first
It encloses, it is determined that first object caching range and the first caching range in caching range set whether there is the situation that joins end to end,
Wherein, the starting point of the starting point of first object caching range and the first caching range closes on and less than the starting point of the first caching range;
First cache unit splices if being configured to first object caching range and the first caching range in the presence of the situation that joins end to end
First object caches audio fragment corresponding to range and to buffered audio segment, obtains through spliced first audio fragment,
Audio fragment corresponding with first object caching range in target audio fragment sequence is replaced with into the first audio fragment.
In some embodiments, above-mentioned apparatus further include: the second cache unit, if being configured to first object caching range
There is no the situations that joins end to end will be inserted into buffered audio segment then in target audio fragment sequence with the first caching range
To the first designated position of audio fragment corresponding to first object caching range.
In some embodiments, above-mentioned apparatus further include: the second determination unit, if being configured to cache in range set not
In the presence of the caching range for having intersection with the first caching range, but there are the caching models that starting point is greater than the starting point of the first caching range
It encloses, it is determined that the second target cache range and the first caching range in caching range set whether there is the situation that joins end to end,
Wherein, the starting point of the starting point of the second target cache range and the first caching range closes on and is greater than the starting point of the first caching range;
Third cache unit splices if being configured to the second target cache range and the first caching range in the presence of the situation that joins end to end
Audio fragment corresponding to second target cache range and to buffered audio segment, obtains through spliced second audio fragment,
Audio fragment corresponding with the second target cache range in target audio fragment sequence is replaced with into the second audio fragment.
In some embodiments, above-mentioned apparatus further include: the 4th cache unit, if being configured to the second target cache range
There is no the situations that joins end to end will be inserted into buffered audio segment then in target audio fragment sequence with the first caching range
To the second designated position of audio fragment corresponding to the second target cache range.
The third aspect, embodiment of the disclosure provide a kind of electronic equipment, which includes: one or more places
Manage device;Storage device is stored thereon with one or more programs;When the one or more program is by the one or more processors
It executes, so that the one or more processors realize the method as described in implementation any in first aspect.
Fourth aspect, embodiment of the disclosure provide a kind of computer-readable medium, are stored thereon with computer program,
The method as described in implementation any in first aspect is realized when the program is executed by processor.
The method and apparatus provided by the above embodiment for buffered audio data of the disclosure, by response to getting
To buffered audio segment, caching range set related with target audio fragment sequence is obtained, wherein to buffered audio segment pair
The first caching range is answered, the caching range cached in range set corresponds to the audio fragment in target audio fragment sequence, so as to
When caching at least one of range set caching range has intersection with the first caching range respectively, from this, at least one is cached
A caching range is selected in range as the first item to be processed to execute using the first caching range as the second item to be processed
Following caching: based on the first item to be processed and the corresponding audio fragment of the second item to be processed, new audio fragment is determined;
Audio fragment corresponding with the first item to be processed in target audio fragment sequence is replaced with into new audio fragment.The disclosure it is upper
Stating embodiment realizes Segment-based caching to audio data.In addition, replacing target audio segment sequence by using new audio fragment
Audio fragment corresponding with the first item to be processed in column, compared to the prior art directly will be to buffered audio fragment buffer to referring to
Fixed storage location can save spatial cache.
Specific embodiment
The disclosure is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining that correlation is open, rather than the restriction to the disclosure.It also should be noted that in order to
Convenient for description, is illustrated only in attached drawing and disclose relevant part to related.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the disclosure can phase
Mutually combination.The disclosure is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can the method for buffered audio data using the disclosure or the dress for buffered audio data
The exemplary system architecture 100 for the embodiment set.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105.
Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out
Send message etc..Various telecommunication customer end applications, such as audio broadcast message class application can be installed on terminal device 101,102,103
Etc..
Terminal device 101,102,103 can be hardware, be also possible to software.When terminal device 101,102,103 is hard
When part, it can be the various electronic equipments with display screen, including but not limited to smart phone, tablet computer etc..Work as end
When end equipment 101 is software, it may be mounted in above-mentioned cited electronic equipment.Multiple softwares or software may be implemented into it
Module (such as providing Distributed Services), also may be implemented into single software or software module.It is not specifically limited herein.
Server 105 can be to provide the server of various services, such as to playing on terminal device 101,102,103
Audio provides the background server supported.The background server can store the audio played on terminal device.It needs to illustrate
, server can be hardware, is also possible to software.When server is hardware, multiple server compositions may be implemented into
Distributed server cluster, individual server also may be implemented into.When server is software, multiple softwares may be implemented into
Or software module (such as providing Distributed Services), single software or software module also may be implemented into.It does not do and has herein
Body limits.
Terminal device 101,102,103 can be segmented down target audio (such as user currently playing audio)
It carries, such as downloads the audio fragment of target audio from server 105, and the audio fragment that downloading is completed is as to buffered audio
Segment executes corresponding caching.
It should be noted that the method for buffered audio data that some embodiments of the present disclosure provide is generally by terminal
Equipment 101,102,103 executes, correspondingly, the device for buffered audio data be generally positioned at terminal device 101,102,
In 103.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, it illustrates according to one embodiment of the method for buffered audio data of the disclosure
Process 200.This for buffered audio data method can be applied to terminal device (such as terminal device shown in FIG. 1 101,
102,103), comprising the following steps:
Step 201, in response to getting to buffered audio segment, caching model related with target audio fragment sequence is obtained
Enclose set.
In the present embodiment, it can be the audio fragment in target audio to buffered audio segment.Target audio for example may be used
To be the audio etc. of the currently used terminal device broadcasting of user.Terminal device can carry out segmentation downloading to target audio, such as
From the respective audio segment of server (such as server 105 shown in FIG. 1) the downloading target audio connected, and will download
At audio fragment be used as to buffered audio segment.Wherein, the first caching range can be corresponded to buffered audio segment.
It should be noted that the caching range in the disclosure may include starting point and length.Starting point can represent audio piece
Play position of the section in the target audio belonged to.Length can represent the playout length of audio fragment.
In the present embodiment, terminal device is being got after buffered audio segment, available and target audio segment
The related caching range set of sequence.Wherein, target audio fragment sequence can be the sound to be cached got with terminal device
The associated sequence of the target audio that frequency segment is belonged to, the sequence may include one or more audio pieces of the target audio
Section.Caching range in caching range set can correspond to the audio fragment in target audio fragment sequence.In addition, target audio
Audio fragment in fragment sequence can be arranged according to the ascending sequence of the starting point of corresponding caching range.
In practice, target audio fragment sequence and caching range set conjunction be can store in terminal device.Specifically, target
Audio fragment sequence can store in the caching of terminal device.Optionally, caching range set can store in terminal device
Hard disk, in caching or memory.
Step 202, if at least one of caching range set caching range is respectively and to corresponding to buffered audio segment
The first caching range have intersection, then to select a caching range to be processed as first from least one caching range
, using the first caching range as the second item to be processed.
In the present embodiment, terminal device can traverse in caching range set after getting caching range set
Range is cached, to determine in caching range set with the presence or absence of the caching range for having intersection with the first caching range.If caching model
Enclose set at least one of caching range respectively with first caching range have intersection, then terminal device can from this at least one
A caching range is selected in caching range as the first item to be processed, using the first caching range as the second item to be processed.
Here, terminal device can randomly select out a caching range as the from least one above-mentioned caching range
One item to be processed.Optionally, terminal device can choose the smallest caching range of starting point from least one above-mentioned caching range
As the first item to be processed.
Step 203, based on the first item to be processed and the corresponding audio fragment of the second item to be processed, new audio piece is determined
Section.
In the present embodiment, terminal device can be based on the first item to be processed and the corresponding audio of the second item to be processed
Segment determines new audio fragment.
As an example, the lap of item to be processed for first and the second item to be processed, terminal device can be from first
It crops and is somebody's turn to do in any one of audio fragment corresponding to audio fragment corresponding to item to be processed and the second item to be processed
The corresponding audio content of lap, obtains audio fragment after cropped.Then terminal device can according to starting point by it is small to
Big sequence, to after cropped audio fragment and another audio fragment not being cut splice, and will be after splicing
Audio fragment as new audio fragment.
Step 204, audio fragment corresponding with the first item to be processed in target audio fragment sequence is replaced with into new sound
Frequency segment.
In the present embodiment, terminal device can be by sound corresponding with the first item to be processed in target audio fragment sequence
Frequency segment replaces with new audio fragment.This way it is possible to avoid target audio segment sequence will be directly inserted into buffered audio segment
In column, spatial cache can be effectively saved.
The method provided by the above embodiment of the disclosure, by response to getting to buffered audio segment, acquisition and mesh
The related caching range set of mark with phonetic symbols frequency fragment sequence, wherein to the corresponding first caching range of buffered audio segment, cache range
Caching range in set corresponds to the audio fragment in target audio fragment sequence, so as at least one in caching range set
When a caching range has intersection with the first caching range respectively, a caching range is selected at least one caching range from this
Following caching is executed: based on first wait locate using the first caching range as the second item to be processed as the first item to be processed
Item and the corresponding audio fragment of the second item to be processed are managed, determines new audio fragment;By in target audio fragment sequence with
The corresponding audio fragment of first item to be processed replaces with new audio fragment.The disclosure above example implements to audio data
Segment-based caching.In addition, by using corresponding with the first item to be processed in new audio fragment replacement target audio fragment sequence
Audio fragment, will can directly be saved slow to buffered audio fragment buffer to specified storage location compared to the prior art
Deposit space.
With further reference to Fig. 3, it illustrates one embodiment according to the method for buffered audio data of the disclosure
Process 300.The method for buffered audio data can be applied to terminal device (such as terminal device shown in FIG. 1
101,102,103), comprising the following steps:
Step 301, in response to getting to buffered audio segment, caching model related with target audio fragment sequence is obtained
Enclose set.
In the present embodiment, it can be the audio fragment in target audio to buffered audio segment.Target audio for example may be used
To be the audio etc. of the currently used terminal device broadcasting of user.Terminal device can carry out segmentation downloading to target audio, such as
From the respective audio segment of server (such as server 105 shown in FIG. 1) the downloading target audio connected, and will download
At audio fragment be used as to buffered audio segment.Wherein, the first caching range can be corresponded to buffered audio segment.
It should be noted that the caching range in the disclosure may include starting point and length.Starting point can represent audio piece
Play position of the section in the target audio belonged to.Length can represent the playout length of audio fragment.
In the present embodiment, terminal device is being got after buffered audio segment, available and target audio segment
The related caching range set of sequence.Wherein, target audio fragment sequence can be the sound to be cached got with terminal device
The associated sequence of the target audio that frequency segment is belonged to, the sequence may include one or more audio pieces of the target audio
Section.Caching range in caching range set can correspond to the audio fragment in target audio fragment sequence.In addition, target audio
Audio fragment in fragment sequence can be arranged according to the ascending sequence of the starting point of corresponding caching range.
In practice, target audio fragment sequence and caching range set conjunction be can store in terminal device.Specifically, target
Audio fragment sequence can store in the caching of terminal device.Optionally, caching range set can store in terminal device
Hard disk, in caching or memory.
Step 302, if at least one of caching range set caching range is respectively and to corresponding to buffered audio segment
The first caching range have intersection, then to select a caching range to be processed as first from least one caching range
, using the first caching range as the second item to be processed.
In the present embodiment, terminal device can traverse in caching range set after getting caching range set
Range is cached, to determine in caching range set with the presence or absence of the caching range for having intersection with the first caching range.
If at least one of caching range set caching range has intersection, terminal device with the first caching range respectively
A caching range can be selected at least one caching range from this as the first item to be processed, the first caching range is made
For the second item to be processed.
Here, terminal device can randomly select out a caching range as the from least one above-mentioned caching range
One item to be processed.Optionally, terminal device can choose the smallest caching range of starting point from least one above-mentioned caching range
As the first item to be processed.
Step 303, it is based on the first item to be processed and the second item to be processed, determines new caching range.
In the present embodiment, terminal device can be based on first after determining the first item to be processed and the second item to be processed
Item to be processed and the second item to be processed determine new caching range.
As an example, terminal device can be by the first item to be processed if the caching range in the disclosure further includes terminal
It is determined as newly caching the starting point of range with the minimum starting point in the starting point of the second item to be processed.Moreover, terminal device can be by
Maximum terminal in the terminal of one item to be processed and the second item to be processed is determined as newly caching the terminal of range.
In some optional implementations of the present embodiment, terminal device can determine new caching model in the following ways
It encloses: the minimum starting point in the starting point of the first item to be processed and the second item to be processed being determined as newly to cache the starting point of range;By
The starting point of one item to be processed and the summation of length are as the first value, using the summation of the starting point of the second item to be processed and length as
The difference of maximum value and the minimum starting point in first value and second value is determined as newly caching the length of range by two-value.
Step 304, determining with new caching based on the first item to be processed and the corresponding audio fragment of the second item to be processed
The corresponding new audio fragment of range.
In the present embodiment, terminal device can be based on the first item to be processed and the corresponding audio of the second item to be processed
Segment, determining new audio fragment corresponding with new caching range.
As an example, the lap of item to be processed for first and the second item to be processed, terminal device can be from first
It crops and is somebody's turn to do in any one of audio fragment corresponding to audio fragment corresponding to item to be processed and the second item to be processed
The corresponding audio content of lap, obtains audio fragment after cropped.Then terminal device can according to starting point by it is small to
Big sequence, to after cropped audio fragment and another audio fragment not being cut splice.Then terminal device
Audio fragment can be extracted from through spliced audio fragment as new audio based on the starting point and length of new caching range
Segment.
Step 305, audio fragment corresponding with the first item to be processed in target audio fragment sequence is replaced with into new sound
Frequency segment.
In the present embodiment, terminal device can be by sound corresponding with the first item to be processed in target audio fragment sequence
Frequency segment replaces with new audio fragment.This way it is possible to avoid target audio segment sequence will be directly inserted into buffered audio segment
In column, spatial cache can be effectively saved.
It is the application scenarios of the method for buffered audio data of embodiment shown in Fig. 3 with continued reference to Fig. 4, Fig. 4
One schematic diagram.In the application scenarios of Fig. 4, user can be used smart phone and play song A.In the process for playing song A
In, smart phone can carry out segmentation downloading to song A, and cache the audio fragment that downloading is completed.In addition, playing song A
During, user can adjust the playback progress of song A by dragging progress bar.Smart phone can be in response to user couple
The drag operation of progress bar redefines current caching range, and obtains audio fragment corresponding with the caching range.This
In, which can be known as that the caching range is known as the first caching to buffered audio segment (as shown in label 401)
Range (as shown in label 402).Then, smart phone is available related with audio fragment sequence associated by song A slow
Deposit range set.Wherein, audio fragment sequence may include audio fragment A1 cached, in song A (such as 403 institute of label
Show).Caching range set may include caching range B1 corresponding to audio fragment A1 (as shown in label 404).Audio fragment
Sequence and caching range set conjunction can store in the caching of smart phone.Later, if the caching range of caching range B1 and first
There is intersection, then smart phone can determine new caching range (such as 405 institute of label based on the first caching range and caching range B1
Show), and based on to buffered audio segment and audio fragment A1, determining new audio fragment corresponding with new caching range is (as marked
Shown in numbers 406).Then, the audio fragment A1 in audio fragment sequence can be replaced with new audio fragment by smart phone.
The method that embodiment shown in Fig. 3 provides, by response to getting to buffered audio segment, acquisition and target sound
The related caching range set of frequency fragment sequence, wherein to the corresponding first caching range of buffered audio segment, cache range set
In caching range correspond to the audio fragment in target audio fragment sequence, so as to slow in caching at least one of range set
When depositing range has intersection with the first caching range respectively, a caching range conduct is selected at least one caching range from this
First item to be processed executes following caching: based on the first item to be processed using the first caching range as the second item to be processed
With the second item to be processed, new caching range is determined;Based on the first item to be processed and the corresponding audio piece of the second item to be processed
Section, determining new audio fragment corresponding with new caching range;It will be corresponding with the first item to be processed in target audio fragment sequence
Audio fragment replace with new audio fragment.The Segment-based caching to audio data may be implemented in embodiment shown in Fig. 3.In addition,
By using the audio fragment corresponding with the first item to be processed in new audio fragment replacement target audio fragment sequence, Ke Yijie
Save spatial cache.
With further reference to Fig. 5, it illustrates the processes 500 of another embodiment of the method for buffered audio data.
The method for being used for buffered audio data can be applied to terminal device (such as terminal device shown in FIG. 1 101,102,103),
The following steps are included:
Step 501, in response to getting to buffered audio segment, caching model related with target audio fragment sequence is obtained
Enclose set.
In the present embodiment, terminal device can obtain and target audio piece in response to getting to buffered audio segment
The related caching range set of Duan Xulie.Wherein, the first caching range can be corresponded to buffered audio segment.Cache range set
In caching range can correspond to the audio fragment in target audio fragment sequence.Caching range may include starting point and length.
Starting point can represent play position of the audio fragment in the target audio belonged to.Length can represent the broadcasting of audio fragment
Length.
Target audio fragment sequence can be the target sound belonged to buffered audio segment got with terminal device
Frequently associated sequence, the sequence may include one or more audio fragments of the target audio.In addition, target audio segment
Audio fragment in sequence can be arranged according to the ascending sequence of the starting point of corresponding caching range.
Step 502, if at least one of caching range set caching range is respectively and to corresponding to buffered audio segment
The first caching range have intersection, then to select a caching range to be processed as first from least one caching range
, using the first caching range as the second item to be processed.
In the present embodiment, if at least one of caching range set caching range has friendship with the first caching range respectively
Collection, then terminal device can select a caching range as the first item to be processed at least one caching range from this, incite somebody to action
First caching range is as the second item to be processed.Here, terminal device can be from choosing at least one above-mentioned caching range
The smallest caching range of point is as the first item to be processed.
Step 503, it is based on the first item to be processed and the second item to be processed, determines new caching range.
In the present embodiment, terminal device can be based on first after determining the first item to be processed and the second item to be processed
Item to be processed and the second item to be processed determine new caching range.
As an example, terminal device can be true by the minimum starting point in the starting point of the first item to be processed and the second item to be processed
It is set to the starting point of new caching range.Terminal device can also be using the summation of the starting point of the first item to be processed and length as first
Value, and using the summation of the starting point of the second item to be processed and length as second value, and by the maximum in the first value and second value
The difference of value and the minimum starting point is determined as newly caching the length of range.
Step 504, determining with new caching based on the first item to be processed and the corresponding audio fragment of the second item to be processed
The corresponding new audio fragment of range.
In the present embodiment, terminal device can be based on the first item to be processed and the corresponding audio of the second item to be processed
Segment, determining new audio fragment corresponding with new caching range.It here, can institute referring to Fig. 3 for the explanation of step 504
Show the related description of the step 304 in embodiment, details are not described herein.
Step 505, audio fragment corresponding with the first item to be processed in target audio fragment sequence is replaced with into new sound
Frequency segment.
In the present embodiment, terminal device can be by sound corresponding with the first item to be processed in target audio fragment sequence
Frequency segment replaces with new audio fragment.
Step 506, if there is also unselected caching ranges at least one caching range, delay from unselected
One caching range of selection in range is deposited, using the caching range as the first item to be processed, and from target audio fragment sequence
New audio fragment is extracted, using new caching range corresponding to new audio fragment as the second item to be processed.
In the present embodiment, terminal device is by audio corresponding with the first item to be processed in target audio fragment sequence
After segment replaces with new audio fragment, if there is also unselected caching range at least one above-mentioned caching range set,
Then terminal device can choose a caching range from the unselected caching range, using the caching range as first to
Processing item.For example, terminal device can choose the smallest caching range of starting point as from the unselected caching range
One item to be processed.Terminal device can also extract the new audio fragment from target audio fragment sequence, and by the new audio
New caching range is as the second item to be processed corresponding to segment.Later, terminal device can turn to execute step 503.
It should be noted that after extracting the new audio fragment in target audio fragment sequence, target audio segment sequence
Column no longer include the new audio fragment.
Step 507, if unselected caching range is not present at least one caching range, terminate and sound to be cached
The related caching of frequency segment.
In the present embodiment, terminal device is by audio corresponding with the first item to be processed in target audio fragment sequence
After segment replaces with new audio fragment, if unselected caching range is not present at least one above-mentioned caching range, eventually
End equipment can terminate with to the related caching of buffered audio segment.
From figure 5 it can be seen that compared with the corresponding embodiment of Fig. 3, in the present embodiment for buffered audio data
The process 500 of method is highlighted to be replaced with by audio fragment corresponding with the first item to be processed in target audio fragment sequence
Processing step after new audio fragment.The scheme of the present embodiment description can include at least two in caching range set as a result,
When a and the first caching range has the caching range of intersection, different new audio fragment replacement target audio segment sequences is used for multiple times
Corresponding caching range in column has the audio fragment of intersection with the first caching range, to avoid in target audio fragment sequence
There are the audio fragments that corresponding caching range has intersection, can further save spatial cache in this way.
In some optional of the method for buffered audio data that the embodiment that Fig. 2, Fig. 3 and Fig. 5 are respectively shown in provides
Implementation in, if but there are starting points there is no having the caching range of intersection with the first caching range in caching range set
Less than the caching range of the starting point of the first caching range, then the use that terminal device can be provided using embodiment as shown in FIG. 6
In the method for buffered audio data.
In some optional of the method for buffered audio data that the embodiment that Fig. 2, Fig. 3 and Fig. 5 are respectively shown in provides
Implementation in, if but there are starting points there is no having the caching range of intersection with the first caching range in caching range set
Greater than the caching range of the starting point of the first caching range, then the use that terminal device can be provided using embodiment as shown in Figure 7
In the method for buffered audio data.
As shown in fig. 6, it illustrates the processes 600 of the further embodiment of the method for buffered audio data.The use
In the method for buffered audio data, comprising the following steps:
Step 601, determine that the first object caching range in caching range set and the first caching range whether there is head
Tail is connected situation.
In the present embodiment, if being not present and sound to be cached in caching range set related with target audio fragment sequence
First caching range corresponding to frequency segment has the caching range of intersection, but the starting point there are starting point less than the first caching range
Range is cached, then terminal device can determine whether the first object caching range and first in caching range set caches range
In the presence of the situation that joins end to end.Wherein, the starting point of first object caching range and the starting point of the first caching range are closed on and less than the
The starting point of one caching range.
Here, terminal device can cache the terminal of range and the starting point of the first caching range based on first object, determine
First object caching range and the first caching range are with the presence or absence of the situation that joins end to end.For example, being belonged to buffered audio segment
Target audio can correspond to time shaft.On the time shaft, if next play position of the terminal is the starting point, terminal
Equipment can determine that first object caching range and the first caching range have the situation that joins end to end;Otherwise, terminal device can be with
Determine that there is no the situations that joins end to end for first object caching range and the first caching range.
It should be noted that the terminal of first object caching range may be embodied in first object caching range, alternatively,
The terminal can cache the starting point of range based on first object and length computation obtains.
In the present embodiment, if first object caching range and the first caching range have the situation that joins end to end, terminal
Equipment can execute step 602-603;Otherwise, terminal device can execute step 604.
Step 602, if first object caching range and the first caching range have the situation that joins end to end, splice the first mesh
Mark caches audio fragment corresponding to range and to buffered audio segment, obtains through spliced first audio fragment.
In the present embodiment, if first object caching range and the first caching range have the situation that joins end to end, terminal
Equipment can splice audio fragment and to buffered audio segment corresponding to first object caching range, obtain through spliced the
One audio fragment.Wherein, the run-out of the first audio fragment is in buffered audio segment.
Step 603, the audio fragment corresponding with first object caching range in target audio fragment sequence is replaced with
First audio fragment.
In the present embodiment, terminal device is after obtaining the first audio fragment, can will be in target audio fragment sequence
Audio fragment corresponding with first object caching range replaces with the first audio fragment.
Step 604, if there is no the situations that joins end to end for first object caching range and the first caching range, in target sound
In frequency fragment sequence, specified being inserted into first of audio fragment corresponding to first object caching range to buffered audio segment
Position.
In the present embodiment, if the situation that joins end to end is not present in first object caching range and the first caching range,
In target audio fragment sequence, terminal device can will be inserted into corresponding to first object caching range to buffered audio segment
First designated position of audio fragment.
For example, if the audio fragment in target audio fragment sequence is from left to right according to the starting point of corresponding caching range
Ascending sequence arrangement, then the first designated position can be right side.Terminal device can will be inserted into buffered audio segment
To the right side of audio fragment corresponding to first object caching range.
If the audio fragment in target audio fragment sequence is from top to bottom according to the starting point of corresponding caching range by small
It is arranged to big sequence, then the first designated position can be lower section.Terminal device can will be inserted into buffered audio segment
The lower section of audio fragment corresponding to one target cache range.
From fig. 6 it can be seen that the process 600 of the method for buffered audio data in the present embodiment is highlighted slow
The caching range for being not present in range set and having intersection with the first caching range is deposited, but there are starting points less than the first caching range
Processing step when the caching range of starting point.The diversity of information processing may be implemented in the scheme of the present embodiment description as a result,.And
And when first object caching range and the first caching range exist and join end to end situation, passes through splicing first object and cache model
It encloses corresponding audio fragment and replaces target audio piece to buffered audio segment, and using resulting first audio fragment is spliced
Audio fragment corresponding with first object caching range in Duan Xulie, it is possible to reduce the audio piece in target audio fragment sequence
The quantity of section, in this way it is subsequent get again it is new to buffered audio segment and corresponding for that should be executed to buffered audio segment
It, being capable of speed up processing when caching.
As shown in fig. 7, it illustrates the processes 700 of another embodiment of the method for buffered audio data.The use
In the method for buffered audio data, comprising the following steps:
Step 701, determine that the second target cache range in caching range set and the first caching range whether there is head
Tail is connected situation.
In the present embodiment, if being not present and sound to be cached in caching range set related with target audio fragment sequence
First caching range corresponding to frequency segment has the caching range of intersection, but there are starting points to be greater than the starting point of the first caching range
Range is cached, then terminal device can determine whether the second target cache range and first in caching range set caches range
In the presence of the situation that joins end to end.Wherein, the starting point of the starting point of the second target cache range and the first caching range closes on and is greater than the
The starting point of one caching range.
Here, terminal device can based on first caching range terminal and the second target cache range starting point, determine
Second target cache range and the first caching range are with the presence or absence of the situation that joins end to end.For example, being belonged to buffered audio segment
Target audio can correspond to time shaft.On the time shaft, if next play position of the terminal is the starting point, terminal
Equipment can determine that the second target cache range and the first caching range have the situation that joins end to end;Otherwise, terminal device can be with
Determine that there is no the situations that joins end to end for the second target cache range and the first caching range.
It should be noted that the terminal of the first caching range may be embodied in the first caching range, alternatively, the terminal can
With based on first caching range starting point and length computation obtain.
In the present embodiment, if the second target cache range and the first caching range have the situation that joins end to end, terminal
Equipment can execute step 702-703;Otherwise, terminal device can execute step 704.
Step 702, if the second target cache range and the first caching range have the situation that joins end to end, splice the second mesh
Mark caches audio fragment corresponding to range and to buffered audio segment, obtains through spliced second audio fragment.
In the present embodiment, if the second target cache range and the first caching range have the situation that joins end to end, terminal
Equipment can splice audio fragment corresponding to the second target cache range and to buffered audio segment, obtain through spliced
Two audio fragments.Wherein, the head of the second audio fragment are in buffered audio segment.
Step 703, the audio fragment corresponding with the second target cache range in target audio fragment sequence is replaced with
Second audio fragment.
In the present embodiment, terminal device is after obtaining the second audio fragment, can will be in target audio fragment sequence
Audio fragment corresponding with the second target cache range replaces with the second audio fragment.
Step 704, if there is no the situations that joins end to end for the second target cache range and the first caching range, in target sound
In frequency fragment sequence, specified being inserted into second of audio fragment corresponding to the second target cache range to buffered audio segment
Position.
In the present embodiment, if the situation that joins end to end is not present in the second target cache range and the first caching range,
In target audio fragment sequence, terminal device can will be inserted into corresponding to the second target cache range to buffered audio segment
Second designated position of audio fragment.
For example, if the audio fragment in target audio fragment sequence is from left to right according to the starting point of corresponding caching range
Ascending sequence arrangement, then the second designated position can be left side.Terminal device can will be inserted into buffered audio segment
To the left side of audio fragment corresponding to the second target cache range.
If the audio fragment in target audio fragment sequence is from top to bottom according to the starting point of corresponding caching range by small
It is arranged to big sequence, then the first designated position can be top.Terminal device can will be inserted into buffered audio segment
The top of audio fragment corresponding to two target cache ranges.
It can be seen from figure 7 that the process 700 of the method for buffered audio data in the present embodiment is highlighted slow
The caching range for being not present in range set and having intersection with the first caching range is deposited, but there are starting points to be greater than the first caching range
Processing step when the caching range of starting point.The diversity of information processing may be implemented in the scheme of the present embodiment description as a result,.And
And when the second target cache range and the first caching range exist and join end to end situation, by splicing the second target cache model
It encloses corresponding audio fragment and replaces target audio piece to buffered audio segment, and using resulting second audio fragment is spliced
Audio fragment corresponding with the second target cache range in Duan Xulie, it is possible to reduce the audio piece in target audio fragment sequence
The quantity of section, in this way it is subsequent get again it is new to buffered audio segment and corresponding for that should be executed to buffered audio segment
It, being capable of speed up processing when caching.
With further reference to Fig. 8, as the realization to method shown in above-mentioned each figure, present disclose provides one kind for caching sound
One embodiment of the device of frequency evidence, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which specifically may be used
To be applied in various electronic equipments.
As shown in figure 8, the device 800 for buffered audio data of the present embodiment includes: that acquiring unit 801 is configured to
In response to getting to buffered audio segment, caching range set related with target audio fragment sequence is obtained, wherein to slow
The first caching range can be corresponded to by depositing audio fragment, and the caching range cached in range set can correspond to target audio segment sequence
Audio fragment in column;If cache unit 802 is configured to cache at least one of range set caching range respectively with the
One caching range has intersection, then it is to be processed as first to select a caching range from least one above-mentioned caching range
, using the first caching range as the second item to be processed, execute following caching: based on the first item to be processed and second wait locate
The corresponding audio fragment of item is managed, determines new audio fragment;It will be right with the first item to be processed in target audio fragment sequence
The audio fragment answered replaces with new audio fragment.
In the present embodiment, in the device of buffered audio data 800: the tool of acquiring unit 801 and cache unit 802
Body processing and its brought technical effect can be respectively with reference to step 201, the steps 202, step 203 in Fig. 2 corresponding embodiment
With the related description of step 204, details are not described herein.
In some optional implementations of the present embodiment, cache unit 802 can be further configured to: based on the
One item to be processed and the second item to be processed determine new caching range;It is right respectively based on the first item to be processed and the second item to be processed
The audio fragment answered, determining new audio fragment corresponding with new caching range.
In some optional implementations of the present embodiment, cache unit 802 can also be further configured to: incited somebody to action
After audio fragment corresponding with the first item to be processed in target audio fragment sequence replaces with new audio fragment, if it is above-mentioned extremely
There is also unselected caching ranges in a few caching range, then a caching is chosen from unselected caching range
Range using the caching range as the first item to be processed, and extracts new audio fragment from target audio fragment sequence, will be new
New caching range corresponding to audio fragment continues to execute above-mentioned caching as the second item to be processed.
In some optional implementations of the present embodiment, cache unit 802 can also be further configured to: incited somebody to action
After audio fragment corresponding with the first item to be processed in target audio fragment sequence replaces with new audio fragment, if it is above-mentioned extremely
Unselected caching range is not present in a few caching range, then terminates above-mentioned caching.
In some optional implementations of the present embodiment, cache unit 802 can be further configured to: by first
Minimum starting point in the starting point of item to be processed and the second item to be processed is determined as newly caching the starting point of range;By the first item to be processed
Starting point and length summation as the first value, using the summation of the starting point of the second item to be processed and length as second value, by
The difference of maximum value and minimum starting point in one value and second value is determined as newly caching the length of range.
In some optional implementations of the present embodiment, above-mentioned apparatus 800 can also include: the first determination unit
(not shown), if being configured to cache in range set, there is no the caching ranges for having intersection with the first caching range, but
Caching range there are starting point less than the starting point of the first caching range, it is determined that the first object in caching range set caches model
It encloses with the first caching range with the presence or absence of the situation that joins end to end, wherein first object caches the starting point and the first caching model of range
The starting point enclosed closes on and less than the starting point of the first caching range;First cache unit (not shown), if being configured to first
There is the situation that joins end to end in target cache range and the first caching range, then splice audio corresponding to first object caching range
Segment and to buffered audio segment, obtain through spliced first audio fragment, by target audio fragment sequence with first
The corresponding audio fragment of target cache range replaces with the first audio fragment.
In some optional implementations of the present embodiment, above-mentioned apparatus 800 can also include: the second cache unit
(not shown), if being configured to, first object caches range and the situation that joins end to end is not present in the first caching range,
In target audio fragment sequence, the of audio fragment corresponding to first object caching range will be inserted into buffered audio segment
One designated position.
In some optional implementations of the present embodiment, above-mentioned apparatus 800 can also include: the second determination unit
(not shown), if being configured to cache in range set, there is no the caching ranges for having intersection with the first caching range, but
There are the caching ranges that starting point is greater than the starting point of the first caching range, it is determined that the second target cache model in caching range set
It encloses with the first caching range with the presence or absence of the situation that joins end to end, wherein the starting point of the second target cache range and the first caching model
The starting point enclosed closes on and is greater than the starting point of the first caching range;Third cache unit (not shown), if being configured to second
There is the situation that joins end to end in target cache range and the first caching range, then splice audio corresponding to the second target cache range
Segment and to buffered audio segment, obtain through spliced second audio fragment, by target audio fragment sequence with second
The corresponding audio fragment of target cache range replaces with the second audio fragment.
In some optional implementations of the present embodiment, above-mentioned apparatus 800 can also include: the 4th cache unit
(not shown), if being configured to the second target cache range and the first caching range there is no joining end to end situation,
In target audio fragment sequence, of audio fragment corresponding to the second target cache range will be inserted into buffered audio segment
Two designated positions.
The device provided by the above embodiment of the disclosure, by response to getting to buffered audio segment, acquisition and mesh
The related caching range set of mark with phonetic symbols frequency fragment sequence, wherein to the corresponding first caching range of buffered audio segment, cache range
Caching range in set corresponds to the audio fragment in target audio fragment sequence, so as at least one in caching range set
When a caching range has intersection with the first caching range respectively, a caching range is selected at least one caching range from this
Following caching is executed: based on first wait locate using the first caching range as the second item to be processed as the first item to be processed
Item and the corresponding audio fragment of the second item to be processed are managed, determines new audio fragment;By in target audio fragment sequence with
The corresponding audio fragment of first item to be processed replaces with new audio fragment.Above-described embodiment of the disclosure may be implemented to audio number
According to Segment-based caching.In addition, by using right with the first item to be processed in new audio fragment replacement target audio fragment sequence
The audio fragment answered can save spatial cache.
Below with reference to Fig. 9, it illustrates the electronic equipment that is suitable for being used to realize embodiment of the disclosure, (example is as shown in figure 1
Terminal device) 900 structural schematic diagram.Terminal device in embodiment of the disclosure can include but is not limited to such as move electricity
Words, laptop, digit broadcasting receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable multimedia
Player), the mobile terminal and such as number TV, desktop computer etc. of car-mounted terminal (such as vehicle mounted guidance terminal) etc.
Fixed terminal.Electronic equipment shown in Fig. 9 is only an example, function to embodiment of the disclosure and should not use model
Shroud carrys out any restrictions.
As shown in figure 9, electronic equipment 900 may include processing unit (such as central processing unit, graphics processor etc.)
901, random access can be loaded into according to the program being stored in read-only memory (ROM) 902 or from storage device 908
Program in memory (RAM) 903 and execute various movements appropriate and processing.In RAM 903, it is also stored with electronic equipment
Various programs and data needed for 900 operations.Processing unit 901, ROM 902 and RAM 903 pass through the phase each other of bus 904
Even.Input/output (I/O) interface 905 is also connected to bus 904.
In general, following device can connect to I/O interface 905: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph
As the input unit 906 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration
The output device 907 of dynamic device etc.;Storage device 908 including such as hard disk etc.;And communication device 909.Communication device 909 can
To allow electronic equipment 900 wirelessly or non-wirelessly to be communicated with other equipment to exchange data.Although Fig. 9 is shown with various
The electronic equipment 900 of device, it should be understood that being not required for implementing or having all devices shown.It can be alternatively
Implement or have more or fewer devices.Each box shown in Fig. 9 can represent a device, also can according to need
Represent multiple devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communication device 909, or from storage device 908
It is mounted, or is mounted from ROM 902.When the computer program is executed by processing unit 901, the implementation of the disclosure is executed
The above-mentioned function of being limited in the method for example.
It is situated between it should be noted that computer-readable medium described in embodiment of the disclosure can be computer-readable signal
Matter or computer readable storage medium either the two any combination.Computer readable storage medium for example can be with
System, device or the device of --- but being not limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or it is any more than
Combination.The more specific example of computer readable storage medium can include but is not limited to: have one or more conducting wires
Electrical connection, portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type are programmable
Read-only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic are deposited
Memory device or above-mentioned any appropriate combination.In embodiment of the disclosure, computer readable storage medium, which can be, appoints
What include or the tangible medium of storage program that the program can be commanded execution system, device or device use or and its
It is used in combination.And in embodiment of the disclosure, computer-readable signal media may include in a base band or as carrier wave
The data-signal that a part is propagated, wherein carrying computer-readable program code.The data-signal of this propagation can be adopted
With diversified forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal is situated between
Matter can also be any computer-readable medium other than computer readable storage medium, which can be with
It sends, propagate or transmits for by the use of instruction execution system, device or device or program in connection.Meter
The program code for including on calculation machine readable medium can transmit with any suitable medium, including but not limited to: electric wire, optical cable,
RF (radio frequency) etc. or above-mentioned any appropriate combination.
Above-mentioned computer-readable medium can be included in above-mentioned electronic equipment;It is also possible to individualism, and not
It is fitted into the electronic equipment.Above-mentioned computer-readable medium carries one or more program, when said one or more
When a program is executed by the electronic equipment, so that the electronic equipment: in response to getting to buffered audio segment, acquisition and target
The related caching range set of audio fragment sequence, wherein the first caching range can be corresponded to buffered audio segment, cache model
Audio fragment in target audio fragment sequence can be corresponded to by enclosing the caching range in set;If caching in range set at least
One caching range has intersection with the first caching range respectively, then selects a caching from least one above-mentioned caching range
Range executes following caching: based on first using the first caching range as the second item to be processed as the first item to be processed
Item to be processed and the corresponding audio fragment of the second item to be processed, determine new audio fragment;It will be in target audio fragment sequence
Audio fragment corresponding with the first item to be processed replace with new audio fragment.
The behaviour for executing embodiment of the disclosure can be write with one or more programming languages or combinations thereof
The computer program code of work, described program design language include object oriented program language-such as Java,
Smalltalk, C++ further include conventional procedural programming language-such as " C " language or similar program design language
Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence
Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or
It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet
It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit
It is connected with ISP by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the disclosure, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in the embodiment of the present disclosure can be realized by way of software, can also be by hard
The mode of part is realized.Wherein, the title of unit does not constitute the restriction to the unit itself under certain conditions, for example, obtaining
Unit is taken to be also described as " obtaining related with target audio fragment sequence in response to getting to buffered audio segment
Cache the unit of range set ".
Above description is only the preferred embodiment of the disclosure and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that the open scope involved in the disclosure, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from design disclosed above, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed in the disclosure
Can technical characteristic replaced mutually and the technical solution that is formed.