Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
1a9bda43
Commit
1a9bda43
authored
Apr 20, 2014
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speex: assume default settings if header is missing
Fixes #2973
parent
68ecc0b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
1 deletion
+69
-1
modules/codec/speex.c
modules/codec/speex.c
+69
-1
No files found.
modules/codec/speex.c
View file @
1a9bda43
...
...
@@ -265,6 +265,64 @@ static int OpenPacketizer( vlc_object_t *p_this )
return
i_ret
;
}
static
int
CreateDefaultHeader
(
decoder_t
*
p_dec
)
{
ogg_packet
oggpacket
;
SpeexHeader
*
p_header
=
malloc
(
sizeof
(
SpeexHeader
)
);
if
(
!
p_header
)
return
VLC_ENOMEM
;
const
int
rate
=
p_dec
->
fmt_in
.
audio
.
i_rate
;
const
unsigned
i_mode
=
(
rate
/
8000
)
>>
1
;
const
SpeexMode
*
mode
;
int
ret
=
VLC_SUCCESS
;
oggpacket
.
packet
=
NULL
;
switch
(
rate
)
{
case
8000
:
case
16000
:
case
32000
:
mode
=
speex_lib_get_mode
(
i_mode
);
break
;
default:
msg_Err
(
p_dec
,
"Unexpected rate %d"
,
rate
);
ret
=
VLC_EGENERIC
;
goto
cleanup
;
}
speex_init_header
(
p_header
,
rate
,
p_dec
->
fmt_in
.
audio
.
i_channels
,
mode
);
p_header
->
frames_per_packet
=
160
<<
i_mode
;
oggpacket
.
packet
=
(
unsigned
char
*
)
speex_header_to_packet
(
p_header
,
(
int
*
)
&
oggpacket
.
bytes
);
if
(
!
oggpacket
.
packet
)
{
ret
=
VLC_ENOMEM
;
goto
cleanup
;
}
oggpacket
.
b_o_s
=
1
;
oggpacket
.
e_o_s
=
0
;
oggpacket
.
granulepos
=
-
1
;
oggpacket
.
packetno
=
0
;
ret
=
ProcessInitialHeader
(
p_dec
,
&
oggpacket
);
if
(
ret
!=
VLC_SUCCESS
)
{
msg_Err
(
p_dec
,
"default Speex header is corrupted"
);
}
cleanup:
free
(
oggpacket
.
packet
);
free
(
p_header
);
return
ret
;
}
/****************************************************************************
* DecodeBlock: the whole thing
****************************************************************************
...
...
@@ -300,7 +358,17 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Check for headers */
if
(
!
p_sys
->
b_has_headers
)
{
if
(
ProcessHeaders
(
p_dec
)
)
if
(
!
p_dec
->
fmt_in
.
p_extra
)
{
msg_Warn
(
p_dec
,
"Header missing, using default settings"
);
if
(
CreateDefaultHeader
(
p_dec
)
)
{
block_Release
(
*
pp_block
);
return
NULL
;
}
}
else
if
(
ProcessHeaders
(
p_dec
)
)
{
block_Release
(
*
pp_block
);
return
NULL
;
...
...
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