audio/mp3, audio/vorbis, audio/wav: add comments about cache

This commit is contained in:
Hajime Hoshi 2024-05-04 17:30:15 +09:00
parent c3b9afe8c4
commit 322ad99568
3 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
d, err := mp3.NewDecoder(src)
if err != nil {

View File

@ -182,6 +182,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
decoded, channelCount, origSampleRate, err := decode(src)
if err != nil {

View File

@ -134,6 +134,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
s, origSampleRate, err := decode(src)
if err != nil {