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
7be2a7d8
Commit
7be2a7d8
authored
Jul 21, 2012
by
Samuel Pitoiset
Committed by
Martin Storsjö
Jul 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtmp: Factorize the code by adding handle_chunk_size
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
0ffd5161
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
rtmpproto.c
libavformat/rtmpproto.c
+30
-15
No files found.
libavformat/rtmpproto.c
View file @
7be2a7d8
...
...
@@ -880,6 +880,34 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
return
0
;
}
static
int
handle_chunk_size
(
URLContext
*
s
,
RTMPPacket
*
pkt
)
{
RTMPContext
*
rt
=
s
->
priv_data
;
int
ret
;
if
(
pkt
->
data_size
!=
4
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Chunk size change packet is not 4 bytes long (%d)
\n
"
,
pkt
->
data_size
);
return
-
1
;
}
if
(
!
rt
->
is_input
)
{
if
((
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
chunk_size
,
rt
->
prev_pkt
[
1
]))
<
0
)
return
ret
;
}
rt
->
chunk_size
=
AV_RB32
(
pkt
->
data
);
if
(
rt
->
chunk_size
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Incorrect chunk size %d
\n
"
,
rt
->
chunk_size
);
return
-
1
;
}
av_log
(
s
,
AV_LOG_DEBUG
,
"New chunk size = %d
\n
"
,
rt
->
chunk_size
);
return
0
;
}
static
int
handle_ping
(
URLContext
*
s
,
RTMPPacket
*
pkt
)
{
RTMPContext
*
rt
=
s
->
priv_data
;
...
...
@@ -943,21 +971,8 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
switch
(
pkt
->
type
)
{
case
RTMP_PT_CHUNK_SIZE
:
if
(
pkt
->
data_size
!=
4
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Chunk size change packet is not 4 bytes long (%d)
\n
"
,
pkt
->
data_size
);
return
-
1
;
}
if
(
!
rt
->
is_input
)
if
((
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
chunk_size
,
rt
->
prev_pkt
[
1
]))
<
0
)
return
ret
;
rt
->
chunk_size
=
AV_RB32
(
pkt
->
data
);
if
(
rt
->
chunk_size
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Incorrect chunk size %d
\n
"
,
rt
->
chunk_size
);
return
-
1
;
}
av_log
(
s
,
AV_LOG_DEBUG
,
"New chunk size = %d
\n
"
,
rt
->
chunk_size
);
if
((
ret
=
handle_chunk_size
(
s
,
pkt
))
<
0
)
return
ret
;
break
;
case
RTMP_PT_PING
:
if
((
ret
=
handle_ping
(
s
,
pkt
))
<
0
)
...
...
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