Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
5028c30b
Commit
5028c30b
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
audiofile: count samples with resampled format
Change-Id: I451c66a9b9a8f806daa82406ca24936d4345b068
parent
ce188250
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/media/audio/sound/audiofile.cpp
+5
-5
5 additions, 5 deletions
src/media/audio/sound/audiofile.cpp
with
5 additions
and
5 deletions
src/media/audio/sound/audiofile.cpp
+
5
−
5
View file @
5028c30b
...
...
@@ -66,9 +66,9 @@ AudioFile::AudioFile(const std::string& fileName, unsigned int sampleRate, AVSam
Resampler
r
{};
auto
decoder
=
std
::
make_unique
<
MediaDecoder
>
(
[
&
r
,
this
,
&
buf
,
&
total_samples
](
const
std
::
shared_ptr
<
MediaFrame
>&
frame
)
mutable
{
auto
autoFrame
=
std
::
static_pointer_cast
<
AudioFrame
>
(
frame
);
total_samples
+=
autoFrame
->
getFrameSize
();
buf
.
emplace_back
(
r
.
resample
(
std
::
move
(
autoFrame
),
format_
));
auto
resampled
=
r
.
resample
(
std
::
move
(
std
::
static_pointer_cast
<
AudioFrame
>
(
frame
)
),
format_
)
;
total_samples
+=
resampled
->
getFrameSize
();
buf
.
emplace_back
(
std
::
move
(
resampled
));
});
DeviceParams
dev
;
dev
.
input
=
fileName
;
...
...
@@ -79,10 +79,10 @@ AudioFile::AudioFile(const std::string& fileName, unsigned int sampleRate, AVSam
if
(
decoder
->
setupAudio
()
<
0
)
throw
AudioFileException
(
"Decoder setup failed: "
+
fileName
);
while
(
decoder
->
decode
()
!=
MediaDemuxer
::
Status
::
EndOfFile
)
;
buffer_
->
nb_samples
=
total_samples
;
buffer_
->
format
=
format_
.
sampleFormat
;
buffer_
->
sample_rate
=
format_
.
sample_rate
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment