Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b5050539
Commit
b5050539
authored
Oct 23, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tta: use correct frame_length calculation.
using a floating-point calculation is not necessary.
parent
c6056d40
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
tta.c
libavcodec/tta.c
+6
-7
No files found.
libavcodec/tta.c
View file @
b5050539
...
@@ -217,10 +217,6 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
...
@@ -217,10 +217,6 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
avctx
->
bits_per_coded_sample
=
get_bits
(
&
s
->
gb
,
16
);
avctx
->
bits_per_coded_sample
=
get_bits
(
&
s
->
gb
,
16
);
s
->
bps
=
(
avctx
->
bits_per_coded_sample
+
7
)
/
8
;
s
->
bps
=
(
avctx
->
bits_per_coded_sample
+
7
)
/
8
;
avctx
->
sample_rate
=
get_bits_long
(
&
s
->
gb
,
32
);
avctx
->
sample_rate
=
get_bits_long
(
&
s
->
gb
,
32
);
if
(
avctx
->
sample_rate
>
1000000
){
//prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check
av_log
(
avctx
,
AV_LOG_ERROR
,
"sample_rate too large
\n
"
);
return
-
1
;
}
s
->
data_length
=
get_bits_long
(
&
s
->
gb
,
32
);
s
->
data_length
=
get_bits_long
(
&
s
->
gb
,
32
);
skip_bits
(
&
s
->
gb
,
32
);
// CRC32 of header
skip_bits
(
&
s
->
gb
,
32
);
// CRC32 of header
...
@@ -238,9 +234,12 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
...
@@ -238,9 +234,12 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
// FIXME: horribly broken, but directly from reference source
// prevent overflow
#define FRAME_TIME 1.04489795918367346939
if
(
avctx
->
sample_rate
>
0x7FFFFF
)
{
s
->
frame_length
=
(
int
)(
FRAME_TIME
*
avctx
->
sample_rate
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"sample_rate too large
\n
"
);
return
AVERROR
(
EINVAL
);
}
s
->
frame_length
=
256
*
avctx
->
sample_rate
/
245
;
s
->
last_frame_length
=
s
->
data_length
%
s
->
frame_length
;
s
->
last_frame_length
=
s
->
data_length
%
s
->
frame_length
;
s
->
total_frames
=
s
->
data_length
/
s
->
frame_length
+
s
->
total_frames
=
s
->
data_length
/
s
->
frame_length
+
...
...
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