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
faee5bbb
Commit
faee5bbb
authored
Jul 01, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/opus: implement End Trimming (RFC7845 4.4)
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/867
parent
7befab7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
NEWS
NEWS
+1
-1
OpusDecoderPlugin.cxx
src/decoder/plugins/OpusDecoderPlugin.cxx
+17
-0
No files found.
NEWS
View file @
faee5bbb
...
...
@@ -5,7 +5,7 @@ ver 0.21.25 (not yet released)
- file: detect premature end of file
- smbclient: don't send credentials to MPD clients
* decoder
- opus: apply pre-skip
- opus: apply pre-skip
and end trimming
- opus: fix memory leak
* output
- osx: improve sample rate selection
...
...
src/decoder/plugins/OpusDecoderPlugin.cxx
View file @
faee5bbb
...
...
@@ -286,6 +286,23 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
AddGranulepos
(
skip
);
skip
=
0
;
if
(
packet
.
e_o_s
&&
packet
.
granulepos
>
0
&&
granulepos
>=
0
)
{
/* End Trimming (RFC7845 4.4): "The page with the 'end
of stream' flag set MAY have a granule position
that indicates the page contains less audio data
than would normally be returned by decoding up
through the final packet. This is used to end the
stream somewhere other than an even frame
boundary. [...] The remaining samples are
discarded. */
ogg_int64_t
remaining
=
packet
.
granulepos
-
granulepos
;
if
(
remaining
<=
0
)
return
;
if
(
remaining
<
nframes
)
nframes
=
remaining
;
}
/* submit decoded samples to the DecoderClient */
const
size_t
nbytes
=
nframes
*
frame_size
;
auto
cmd
=
client
.
SubmitData
(
input_stream
,
...
...
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