Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
62bfb1a2
Commit
62bfb1a2
authored
Oct 19, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: reduce memory usage while scanning tags
Allocate the frame pointers only when actually decoding the file.
parent
38e86af7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
NEWS
NEWS
+1
-0
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+11
-3
No files found.
NEWS
View file @
62bfb1a2
...
...
@@ -14,6 +14,7 @@ ver 0.20 (not yet released)
* decoder
- ffmpeg: support ReplayGain and MixRamp
- ffmpeg: support stream tags
- mad: reduce memory usage while scanning tags
- mpcdec: read the bit rate
* playlist
- cue: don't skip pregap
...
...
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
62bfb1a2
...
...
@@ -167,6 +167,15 @@ struct MadDecoder {
bool
DecodeFirstFrame
(
Tag
**
tag
);
void
AllocateBuffers
()
{
assert
(
max_frames
>
0
);
assert
(
frame_offsets
==
nullptr
);
assert
(
times
==
nullptr
);
frame_offsets
=
new
long
[
max_frames
];
times
=
new
mad_timer_t
[
max_frames
];
}
gcc_pure
long
TimeToFrame
(
SongTime
t
)
const
;
...
...
@@ -819,9 +828,6 @@ MadDecoder::DecodeFirstFrame(Tag **tag)
return
false
;
}
frame_offsets
=
new
long
[
max_frames
];
times
=
new
mad_timer_t
[
max_frames
];
return
true
;
}
...
...
@@ -1049,6 +1055,8 @@ mp3_decode(Decoder &decoder, InputStream &input_stream)
return
;
}
data
.
AllocateBuffers
();
Error
error
;
AudioFormat
audio_format
;
if
(
!
audio_format_init_checked
(
audio_format
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment