Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f5ce90f2
Commit
f5ce90f2
authored
Aug 10, 2012
by
Jordi Ortiz
Committed by
Martin Storsjö
Aug 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtmp: split chunk_size var into in_chunk_size and out_chunk_size
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
a8103503
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
rtmpproto.c
libavformat/rtmpproto.c
+17
-10
No files found.
libavformat/rtmpproto.c
View file @
f5ce90f2
...
...
@@ -68,7 +68,8 @@ typedef struct RTMPContext {
const
AVClass
*
class
;
URLContext
*
stream
;
///< TCP stream used in interactions with RTMP server
RTMPPacket
prev_pkt
[
2
][
RTMP_CHANNELS
];
///< packet history used when reading and sending packets
int
chunk_size
;
///< size of the chunks RTMP packets are divided into
int
in_chunk_size
;
///< size of the chunks incoming RTMP packets are divided into
int
out_chunk_size
;
///< size of the chunks outgoing RTMP packets are divided into
int
is_input
;
///< input/output flag
char
*
playpath
;
///< stream identifier to play (with possible "mp4:" prefix)
int
live
;
///< 0: recorded, -1: live, -2: both
...
...
@@ -209,7 +210,7 @@ static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
goto
fail
;
}
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
chunk_size
,
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
out_
chunk_size
,
rt
->
prev_pkt
[
1
]);
fail:
ff_rtmp_packet_destroy
(
pkt
);
...
...
@@ -965,17 +966,22 @@ static int handle_chunk_size(URLContext *s, RTMPPacket *pkt)
}
if
(
!
rt
->
is_input
)
{
if
((
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
chunk_size
,
/* Send the same chunk size change packet back to the server,
* setting the outgoing chunk size to the same as the incoming one. */
if
((
ret
=
ff_rtmp_packet_write
(
rt
->
stream
,
pkt
,
rt
->
out_chunk_size
,
rt
->
prev_pkt
[
1
]))
<
0
)
return
ret
;
rt
->
out_chunk_size
=
AV_RB32
(
pkt
->
data
);
}
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
);
rt
->
in_chunk_size
=
AV_RB32
(
pkt
->
data
);
if
(
rt
->
in_chunk_size
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Incorrect chunk size %d
\n
"
,
rt
->
in_chunk_size
);
return
AVERROR_INVALIDDATA
;
}
av_log
(
s
,
AV_LOG_DEBUG
,
"New chunk size = %d
\n
"
,
rt
->
chunk_size
);
av_log
(
s
,
AV_LOG_DEBUG
,
"New incoming chunk size = %d
\n
"
,
rt
->
in_chunk_size
);
return
0
;
}
...
...
@@ -1252,7 +1258,7 @@ static int get_packet(URLContext *s, int for_header)
for
(;;)
{
RTMPPacket
rpkt
=
{
0
};
if
((
ret
=
ff_rtmp_packet_read
(
rt
->
stream
,
&
rpkt
,
rt
->
chunk_size
,
rt
->
prev_pkt
[
0
]))
<=
0
)
{
rt
->
in_
chunk_size
,
rt
->
prev_pkt
[
0
]))
<=
0
)
{
if
(
ret
==
0
)
{
return
AVERROR
(
EAGAIN
);
}
else
{
...
...
@@ -1411,7 +1417,8 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
if
((
ret
=
rtmp_handshake
(
s
,
rt
))
<
0
)
goto
fail
;
rt
->
chunk_size
=
128
;
rt
->
out_chunk_size
=
128
;
rt
->
in_chunk_size
=
128
;
// Probably overwritten later
rt
->
state
=
STATE_HANDSHAKED
;
// Keep the application name when it has been defined by the user.
...
...
@@ -1665,7 +1672,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
RTMPPacket
rpkt
=
{
0
};
if
((
ret
=
ff_rtmp_packet_read_internal
(
rt
->
stream
,
&
rpkt
,
rt
->
chunk_size
,
rt
->
in_
chunk_size
,
rt
->
prev_pkt
[
0
],
c
))
<=
0
)
return
ret
;
...
...
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