Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
91b1ea7c
Commit
91b1ea7c
authored
Jul 09, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audiotrack: update 4.4.2 hack
Wait for a fixed time since the sleep duration is not constant anymore.
parent
92f33654
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
modules/audio_output/audiotrack.c
modules/audio_output/audiotrack.c
+21
-9
No files found.
modules/audio_output/audiotrack.c
View file @
91b1ea7c
...
...
@@ -1373,7 +1373,7 @@ Play( audio_output_t *p_aout, block_t *p_buffer )
{
JNIEnv
*
env
;
size_t
i_buffer_offset
=
0
;
int
i_nb_try
=
0
;
mtime_t
i_last_time_blocked
=
0
;
mtime_t
i_play_wait
=
0
;
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
...
...
@@ -1386,23 +1386,35 @@ Play( audio_output_t *p_aout, block_t *p_buffer )
while
(
i_buffer_offset
<
p_buffer
->
i_buffer
&&
!
p_sys
->
b_error
)
{
int
i_ret
;
bool
b_forced
;
if
(
i_play_wait
!=
0
)
msleep
(
i_play_wait
);
/* HACK: AudioFlinger can drop frames without notifying us and there is
* no way to know it. If it happens, i_audiotrack_pos won't move and
* the current code will be stuck because it'll assume that audiotrack
* internal buffer is full when it's not. It may happen only after
* Android 4.4.2 if we send frames too quickly. To fix this issue,
* force the writting of the buffer after a certain delay. */
if
(
i_last_time_blocked
!=
0
)
{
b_forced
=
mdate
()
-
i_last_time_blocked
>
FRAMES_TO_US
(
p_sys
->
i_max_audiotrack_samples
)
*
2
;
}
else
b_forced
=
false
;
i_ret
=
AudioTrack_Play
(
env
,
p_aout
,
p_buffer
,
&
i_buffer_offset
,
i_nb_try
>
100
);
b_forced
);
if
(
i_ret
<
0
)
p_sys
->
b_error
=
true
;
else
if
(
p_sys
->
i_write_type
==
WRITE
)
{
/* HACK: AudioFlinger can drop frames without notifying us and
* there is no way to know it. It it happens, i_audiotrack_pos
* won't move and the current code will be stuck because it'll
* assume that audiotrack internal buffer is full when it's not. It
* can happen only after Android 4.4.2 if we send frames too
* quickly. */
i_nb_try
=
i_ret
==
0
?
i_nb_try
+
1
:
0
;
if
(
i_ret
!=
0
)
i_last_time_blocked
=
0
;
else
if
(
i_last_time_blocked
==
0
)
i_last_time_blocked
=
mdate
();
}
if
(
p_buffer
->
i_buffer
-
i_buffer_offset
>
0
)
...
...
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