Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
3b0ef2d8
Commit
3b0ef2d8
authored
Jun 26, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testhls: reduce prev/next context to 3 seconds
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
9358bbf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
testhls.cc
src/testhls.cc
+12
-15
wavdata.hh
src/wavdata.hh
+5
-0
No files found.
src/testhls.cc
View file @
3b0ef2d8
...
...
@@ -165,26 +165,17 @@ hls_embed_context (const string& in_dir, const string& out_dir, const string& fi
}
fclose
(
pts
);
/* store 3 seconds of the context before this segment and after this segment (if available) */
size_t
ctx_3sec
=
3
*
out
.
sample_rate
();
segment
.
vars
[
"start_pos"
]
=
string_printf
(
"%zd"
,
start_pos
);
segment
.
vars
[
"size"
]
=
string_printf
(
"%zd"
,
segment
.
size
);
segment
.
vars
[
"prev_size"
]
=
string_printf
(
"%zd"
,
min
<
size_t
>
(
start_pos
,
ctx_3sec
));
segment
.
vars
[
"next_size"
]
=
string_printf
(
"%zd"
,
min
<
size_t
>
(
audio_master_data
.
n_frames
()
-
(
segment
.
size
+
start_pos
),
ctx_3sec
));
start_pos
+=
segment
.
size
;
}
/* fill out next/prev size fields */
for
(
size_t
i
=
0
;
i
<
segments
.
size
();
i
++
)
{
if
(
i
>
0
)
segments
[
i
].
vars
[
"prev_size"
]
=
string_printf
(
"%zd"
,
segments
[
i
-
1
].
size
);
else
segments
[
i
].
vars
[
"prev_size"
]
=
"0"
;
if
(
i
+
1
<
segments
.
size
())
segments
[
i
].
vars
[
"next_size"
]
=
string_printf
(
"%zd"
,
segments
[
i
+
1
].
size
);
else
segments
[
i
].
vars
[
"next_size"
]
=
"0"
;
}
/* write audio segments with context */
for
(
auto
&
segment
:
segments
)
{
...
...
@@ -375,7 +366,13 @@ hls_mark (const string& infile, const string& outfile, const string& bits)
int
zrc
=
add_stream_watermark
(
&
in_stream
,
&
out_stream
,
bits
,
start_pos
-
prev_size
);
if
(
zrc
!=
0
)
return
zrc
;
{
info
(
"hls_time_abort_enc %f
\n
"
,
(
get_time
()
-
start_time1
)
*
1000
/* ms */
);
double
end_time
=
get_time
();
info
(
"hls_time_abort %f %f
\n
"
,
start_pos
/
double
(
out_stream
.
sample_rate
()),
(
end_time
-
start_time
)
*
1000
/* ms */
);
return
zrc
;
}
info
(
"hls_time_elapsed_aac_enc %f
\n
"
,
(
get_time
()
-
start_time1
)
*
1000
/* ms */
);
...
...
src/wavdata.hh
View file @
3b0ef2d8
...
...
@@ -52,6 +52,11 @@ public:
{
return
m_samples
.
size
();
}
size_t
n_frames
()
const
{
return
m_samples
.
size
()
/
m_n_channels
;
}
const
std
::
vector
<
float
>&
samples
()
const
{
...
...
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