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
9901e531
Commit
9901e531
authored
Jul 15, 2015
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/rtpenc_jpeg: Fix sending multiple quantization tables.
parent
99b0cadd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
rtpenc_jpeg.c
libavformat/rtpenc_jpeg.c
+12
-5
No files found.
libavformat/rtpenc_jpeg.c
View file @
9901e531
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
void
ff_rtp_send_jpeg
(
AVFormatContext
*
s1
,
const
uint8_t
*
buf
,
int
size
)
void
ff_rtp_send_jpeg
(
AVFormatContext
*
s1
,
const
uint8_t
*
buf
,
int
size
)
{
{
RTPMuxContext
*
s
=
s1
->
priv_data
;
RTPMuxContext
*
s
=
s1
->
priv_data
;
const
uint8_t
*
qtables
=
NULL
;
const
uint8_t
*
qtables
[
4
]
=
{
NULL
}
;
int
nb_qtables
=
0
;
int
nb_qtables
=
0
;
uint8_t
type
;
uint8_t
type
;
uint8_t
w
,
h
;
uint8_t
w
,
h
;
...
@@ -64,18 +64,25 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
...
@@ -64,18 +64,25 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
continue
;
continue
;
if
(
buf
[
i
+
1
]
==
DQT
)
{
if
(
buf
[
i
+
1
]
==
DQT
)
{
int
tables
,
j
;
if
(
buf
[
i
+
4
]
&
0xF0
)
if
(
buf
[
i
+
4
]
&
0xF0
)
av_log
(
s1
,
AV_LOG_WARNING
,
av_log
(
s1
,
AV_LOG_WARNING
,
"Only 8-bit precision is supported.
\n
"
);
"Only 8-bit precision is supported.
\n
"
);
/* a quantization table is 64 bytes long */
/* a quantization table is 64 bytes long */
nb_q
tables
=
AV_RB16
(
&
buf
[
i
+
2
])
/
65
;
tables
=
AV_RB16
(
&
buf
[
i
+
2
])
/
65
;
if
(
i
+
4
+
nb_q
tables
*
65
>
size
)
{
if
(
i
+
5
+
tables
*
65
>
size
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
"Too short JPEG header. Aborted!
\n
"
);
av_log
(
s1
,
AV_LOG_ERROR
,
"Too short JPEG header. Aborted!
\n
"
);
return
;
return
;
}
}
if
(
nb_qtables
+
tables
>
4
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
"Invalid number of quantisation tables
\n
"
);
return
;
}
qtables
=
&
buf
[
i
+
4
];
for
(
j
=
0
;
j
<
tables
;
j
++
)
qtables
[
nb_qtables
+
j
]
=
buf
+
i
+
5
+
j
*
65
;
nb_qtables
+=
tables
;
}
else
if
(
buf
[
i
+
1
]
==
SOF0
)
{
}
else
if
(
buf
[
i
+
1
]
==
SOF0
)
{
if
(
buf
[
i
+
14
]
!=
17
||
buf
[
i
+
17
]
!=
17
)
{
if
(
buf
[
i
+
14
]
!=
17
||
buf
[
i
+
17
]
!=
17
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
av_log
(
s1
,
AV_LOG_ERROR
,
...
@@ -150,7 +157,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
...
@@ -150,7 +157,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
bytestream_put_be16
(
&
p
,
64
*
nb_qtables
);
bytestream_put_be16
(
&
p
,
64
*
nb_qtables
);
for
(
i
=
0
;
i
<
nb_qtables
;
i
++
)
for
(
i
=
0
;
i
<
nb_qtables
;
i
++
)
bytestream_put_buffer
(
&
p
,
&
qtables
[
65
*
i
+
1
],
64
);
bytestream_put_buffer
(
&
p
,
qtables
[
i
],
64
);
}
}
/* copy payload data */
/* copy payload data */
...
...
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