Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
ae7c5c3a
Commit
ae7c5c3a
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
#5765: Add maximum iteration for finding fmt and data "chunck"
parent
197978d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sflphone-common/src/audio/sound/audiofile.cpp
+8
-7
8 additions, 7 deletions
sflphone-common/src/audio/sound/audiofile.cpp
with
8 additions
and
7 deletions
sflphone-common/src/audio/sound/audiofile.cpp
+
8
−
7
View file @
ae7c5c3a
...
...
@@ -250,6 +250,8 @@ bool WaveFile::isFileOpened()
bool
WaveFile
::
openExistingWaveFile
(
const
std
::
string
&
fileName
,
int
audioSamplingRate
)
{
int
maxIteration
=
0
;
_debug
(
"WaveFile: Opening %s"
,
fileName
.
c_str
());
_file_stream
.
open
(
fileName
.
c_str
(),
std
::
ios
::
in
|
std
::
ios
::
binary
);
...
...
@@ -262,9 +264,10 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl
// Find the "fmt " chunk
char
fmt
[
4
]
=
{};
while
(
strncmp
(
"fmt "
,
fmt
,
4
)
!=
0
)
{
maxIteration
=
10
;
while
((
maxIteration
>
0
)
&&
strncmp
(
"fmt "
,
fmt
,
4
))
{
_file_stream
.
read
(
fmt
,
4
);
_debug
(
"Searching...
\"
fmt
\"
"
)
;
maxIteration
--
;
}
SINT32
chunk_size
;
// fmt chunk size
unsigned
short
format_tag
;
// data compression tag
...
...
@@ -280,8 +283,6 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl
return
false
;
}
// Get number of channels from the header.
SINT16
chan
;
_file_stream
.
read
(
(
char
*
)
&
chan
,
2
);
...
...
@@ -324,9 +325,10 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl
// Find the "data" chunk
char
data
[
4
]
=
{};
while
(
strncmp
(
"data"
,
data
,
4
))
{
maxIteration
=
10
;
while
((
maxIteration
>
0
)
&&
strncmp
(
"data"
,
data
,
4
))
{
_file_stream
.
read
(
data
,
4
);
_debug
(
"Searching... data"
)
;
maxIteration
--
;
}
...
...
@@ -453,7 +455,6 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl
bool
WaveFile
::
loadFile
(
const
std
::
string
&
filename
,
AudioCodec
*
codec
,
unsigned
int
sampleRate
)
{
openFile
(
filename
,
sampleRate
);
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment