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
57fa6824
Commit
57fa6824
authored
Jul 08, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audiotrack: factorize resetting of the internal state
parent
20337e73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
modules/audio_output/audiotrack.c
modules/audio_output/audiotrack.c
+22
-15
No files found.
modules/audio_output/audiotrack.c
View file @
57fa6824
...
@@ -505,6 +505,25 @@ AudioTrack_ResetPositions( JNIEnv *env, audio_output_t *p_aout )
...
@@ -505,6 +505,25 @@ AudioTrack_ResetPositions( JNIEnv *env, audio_output_t *p_aout )
p_sys
->
smoothpos
.
i_latency_us
=
0
;
p_sys
->
smoothpos
.
i_latency_us
=
0
;
}
}
/**
* Reset all AudioTrack positions and internal state
*/
static
void
AudioTrack_Reset
(
JNIEnv
*
env
,
audio_output_t
*
p_aout
)
{
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
if
(
p_sys
->
p_bytebuffer
)
{
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
p_bytebuffer
);
p_sys
->
p_bytebuffer
=
NULL
;
}
AudioTrack_ResetPositions
(
env
,
p_aout
);
AudioTrack_ResetPlaybackHeadPosition
(
env
,
p_aout
);
p_sys
->
i_samples_written
=
0
;
}
/**
/**
* Get a smooth AudioTrack position
* Get a smooth AudioTrack position
*
*
...
@@ -1030,12 +1049,10 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
...
@@ -1030,12 +1049,10 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
p_sys
->
i_write_type
=
WRITE
;
p_sys
->
i_write_type
=
WRITE
;
}
}
AudioTrack_Reset
(
env
,
p_aout
);
JNI_AT_CALL_VOID
(
play
);
JNI_AT_CALL_VOID
(
play
);
CHECK_AT_EXCEPTION
(
"play"
);
CHECK_AT_EXCEPTION
(
"play"
);
AudioTrack_ResetPositions
(
env
,
p_aout
);
AudioTrack_ResetPlaybackHeadPosition
(
env
,
p_aout
);
p_sys
->
i_samples_written
=
0
;
*
p_fmt
=
p_sys
->
fmt
;
*
p_fmt
=
p_sys
->
fmt
;
aout_SoftVolumeStart
(
p_aout
);
aout_SoftVolumeStart
(
p_aout
);
...
@@ -1385,9 +1402,9 @@ Pause( audio_output_t *p_aout, bool b_pause, mtime_t i_date )
...
@@ -1385,9 +1402,9 @@ Pause( audio_output_t *p_aout, bool b_pause, mtime_t i_date )
CHECK_AT_EXCEPTION
(
"pause"
);
CHECK_AT_EXCEPTION
(
"pause"
);
}
else
}
else
{
{
AudioTrack_ResetPositions
(
env
,
p_aout
);
JNI_AT_CALL_VOID
(
play
);
JNI_AT_CALL_VOID
(
play
);
CHECK_AT_EXCEPTION
(
"play"
);
CHECK_AT_EXCEPTION
(
"play"
);
AudioTrack_ResetPositions
(
env
,
p_aout
);
}
}
}
}
...
@@ -1438,19 +1455,9 @@ Flush( audio_output_t *p_aout, bool b_wait )
...
@@ -1438,19 +1455,9 @@ Flush( audio_output_t *p_aout, bool b_wait )
return
;
return
;
}
}
}
}
AudioTrack_Reset
(
env
,
p_aout
);
JNI_AT_CALL_VOID
(
play
);
JNI_AT_CALL_VOID
(
play
);
CHECK_AT_EXCEPTION
(
"play"
);
CHECK_AT_EXCEPTION
(
"play"
);
if
(
p_sys
->
p_bytebuffer
)
{
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
p_bytebuffer
);
p_sys
->
p_bytebuffer
=
NULL
;
}
AudioTrack_ResetPositions
(
env
,
p_aout
);
AudioTrack_ResetPlaybackHeadPosition
(
env
,
p_aout
);
p_sys
->
i_samples_written
=
0
;
}
}
static
int
static
int
...
...
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