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
4f4b7984
Commit
4f4b7984
authored
Mar 22, 2014
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auhal: implement failure for stream format change and fix possible deadlock and crash
close #8962
parent
2e497105
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
modules/audio_output/auhal.c
modules/audio_output/auhal.c
+9
-6
No files found.
modules/audio_output/auhal.c
View file @
4f4b7984
...
@@ -1682,9 +1682,11 @@ static OSStatus StreamListener(AudioObjectID inObjectID, UInt32 inNumberAddress
...
@@ -1682,9 +1682,11 @@ static OSStatus StreamListener(AudioObjectID inObjectID, UInt32 inNumberAddress
for
(
unsigned
int
i
=
0
;
i
<
inNumberAddresses
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
inNumberAddresses
;
i
++
)
{
if
(
inAddresses
[
i
].
mSelector
==
kAudioStreamPropertyPhysicalFormat
)
{
if
(
inAddresses
[
i
].
mSelector
==
kAudioStreamPropertyPhysicalFormat
)
{
int
canc
=
vlc_savecancel
();
vlc_mutex_lock
(
&
w
->
lock
);
vlc_mutex_lock
(
&
w
->
lock
);
vlc_cond_signal
(
&
w
->
cond
);
vlc_cond_signal
(
&
w
->
cond
);
vlc_mutex_unlock
(
&
w
->
lock
);
vlc_mutex_unlock
(
&
w
->
lock
);
vlc_restorecancel
(
canc
);
break
;
break
;
}
}
}
}
...
@@ -1861,7 +1863,7 @@ static int AudioStreamSupportsDigital(audio_output_t *p_aout, AudioStreamID i_st
...
@@ -1861,7 +1863,7 @@ static int AudioStreamSupportsDigital(audio_output_t *p_aout, AudioStreamID i_st
static
int
AudioStreamChangeFormat
(
audio_output_t
*
p_aout
,
AudioStreamID
i_stream_id
,
AudioStreamBasicDescription
change_format
)
static
int
AudioStreamChangeFormat
(
audio_output_t
*
p_aout
,
AudioStreamID
i_stream_id
,
AudioStreamBasicDescription
change_format
)
{
{
OSStatus
err
=
noErr
;
OSStatus
err
=
noErr
;
int
retValue
=
tru
e
;
int
retValue
=
fals
e
;
AudioObjectPropertyAddress
physicalFormatAddress
=
{
kAudioStreamPropertyPhysicalFormat
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
AudioObjectPropertyAddress
physicalFormatAddress
=
{
kAudioStreamPropertyPhysicalFormat
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
...
@@ -1893,11 +1895,11 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
...
@@ -1893,11 +1895,11 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
/* The AudioStreamSetProperty is not only asynchronious (requiring the locks)
/* The AudioStreamSetProperty is not only asynchronious (requiring the locks)
* it is also not atomic in its behaviour.
* it is also not atomic in its behaviour.
* Therefore we check
5
times before we really give up.
* Therefore we check
9
times before we really give up.
*
FIXME: failing isn't actually implemented yet. *
/
*/
AudioStreamBasicDescription
actual_format
;
AudioStreamBasicDescription
actual_format
;
UInt32
i_param_size
=
sizeof
(
AudioStreamBasicDescription
);
UInt32
i_param_size
=
sizeof
(
AudioStreamBasicDescription
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
9
;
i
++
)
{
/* Callback is not always invoked. So first check if format is already set. */
/* Callback is not always invoked. So first check if format is already set. */
if
(
i
>
0
)
{
if
(
i
>
0
)
{
mtime_t
timeout
=
mdate
()
+
500000
;
mtime_t
timeout
=
mdate
()
+
500000
;
...
@@ -1912,6 +1914,7 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
...
@@ -1912,6 +1914,7 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
actual_format
.
mFormatID
==
change_format
.
mFormatID
&&
actual_format
.
mFormatID
==
change_format
.
mFormatID
&&
actual_format
.
mFramesPerPacket
==
change_format
.
mFramesPerPacket
)
{
actual_format
.
mFramesPerPacket
==
change_format
.
mFramesPerPacket
)
{
/* The right format is now active */
/* The right format is now active */
retValue
=
true
;
break
;
break
;
}
}
...
@@ -1919,6 +1922,8 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
...
@@ -1919,6 +1922,8 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
}
}
out:
out:
vlc_mutex_unlock
(
&
w
.
lock
);
/* Removing the property listener */
/* Removing the property listener */
err
=
AudioObjectRemovePropertyListener
(
i_stream_id
,
&
physicalFormatAddress
,
StreamListener
,
(
void
*
)
&
w
);
err
=
AudioObjectRemovePropertyListener
(
i_stream_id
,
&
physicalFormatAddress
,
StreamListener
,
(
void
*
)
&
w
);
if
(
err
!=
noErr
)
{
if
(
err
!=
noErr
)
{
...
@@ -1926,8 +1931,6 @@ out:
...
@@ -1926,8 +1931,6 @@ out:
retValue
=
false
;
retValue
=
false
;
}
}
/* Destroy the lock and condition */
vlc_mutex_unlock
(
&
w
.
lock
);
vlc_mutex_destroy
(
&
w
.
lock
);
vlc_mutex_destroy
(
&
w
.
lock
);
vlc_cond_destroy
(
&
w
.
cond
);
vlc_cond_destroy
(
&
w
.
cond
);
...
...
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