Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
76317e22
Commit
76317e22
authored
Jun 03, 2024
by
Timo Rothenpieler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/tls_schannel: forward AVIO_FLAG_NONBLOCK to tcp stream
Fixes for example rtmps streaming over schannel.
parent
e37a9303
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
tls_schannel.c
libavformat/tls_schannel.c
+14
-1
No files found.
libavformat/tls_schannel.c
View file @
76317e22
...
@@ -113,6 +113,7 @@ static int tls_shutdown_client(URLContext *h)
...
@@ -113,6 +113,7 @@ static int tls_shutdown_client(URLContext *h)
c
->
request_flags
,
0
,
0
,
NULL
,
0
,
&
c
->
ctxt_handle
,
c
->
request_flags
,
0
,
0
,
NULL
,
0
,
&
c
->
ctxt_handle
,
&
outbuf_desc
,
&
c
->
context_flags
,
&
c
->
ctxt_timestamp
);
&
outbuf_desc
,
&
c
->
context_flags
,
&
c
->
ctxt_timestamp
);
if
(
sspi_ret
==
SEC_E_OK
||
sspi_ret
==
SEC_I_CONTEXT_EXPIRED
)
{
if
(
sspi_ret
==
SEC_E_OK
||
sspi_ret
==
SEC_I_CONTEXT_EXPIRED
)
{
s
->
tcp
->
flags
&=
~
AVIO_FLAG_NONBLOCK
;
ret
=
ffurl_write
(
s
->
tcp
,
outbuf
.
pvBuffer
,
outbuf
.
cbBuffer
);
ret
=
ffurl_write
(
s
->
tcp
,
outbuf
.
pvBuffer
,
outbuf
.
cbBuffer
);
FreeContextBuffer
(
outbuf
.
pvBuffer
);
FreeContextBuffer
(
outbuf
.
pvBuffer
);
if
(
ret
<
0
||
ret
!=
outbuf
.
cbBuffer
)
if
(
ret
<
0
||
ret
!=
outbuf
.
cbBuffer
)
...
@@ -316,6 +317,7 @@ static int tls_client_handshake(URLContext *h)
...
@@ -316,6 +317,7 @@ static int tls_client_handshake(URLContext *h)
goto
fail
;
goto
fail
;
}
}
s
->
tcp
->
flags
&=
~
AVIO_FLAG_NONBLOCK
;
ret
=
ffurl_write
(
s
->
tcp
,
outbuf
.
pvBuffer
,
outbuf
.
cbBuffer
);
ret
=
ffurl_write
(
s
->
tcp
,
outbuf
.
pvBuffer
,
outbuf
.
cbBuffer
);
FreeContextBuffer
(
outbuf
.
pvBuffer
);
FreeContextBuffer
(
outbuf
.
pvBuffer
);
if
(
ret
<
0
||
ret
!=
outbuf
.
cbBuffer
)
{
if
(
ret
<
0
||
ret
!=
outbuf
.
cbBuffer
)
{
...
@@ -416,11 +418,16 @@ static int tls_read(URLContext *h, uint8_t *buf, int len)
...
@@ -416,11 +418,16 @@ static int tls_read(URLContext *h, uint8_t *buf, int len)
}
}
}
}
s
->
tcp
->
flags
&=
~
AVIO_FLAG_NONBLOCK
;
s
->
tcp
->
flags
|=
h
->
flags
&
AVIO_FLAG_NONBLOCK
;
ret
=
ffurl_read
(
s
->
tcp
,
c
->
enc_buf
+
c
->
enc_buf_offset
,
ret
=
ffurl_read
(
s
->
tcp
,
c
->
enc_buf
+
c
->
enc_buf_offset
,
c
->
enc_buf_size
-
c
->
enc_buf_offset
);
c
->
enc_buf_size
-
c
->
enc_buf_offset
);
if
(
ret
==
AVERROR_EOF
)
{
if
(
ret
==
AVERROR_EOF
)
{
c
->
connection_closed
=
1
;
c
->
connection_closed
=
1
;
ret
=
0
;
ret
=
0
;
}
else
if
(
ret
==
AVERROR
(
EAGAIN
))
{
ret
=
0
;
}
else
if
(
ret
<
0
)
{
}
else
if
(
ret
<
0
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Unable to read from socket
\n
"
);
av_log
(
h
,
AV_LOG_ERROR
,
"Unable to read from socket
\n
"
);
return
ret
;
return
ret
;
...
@@ -564,8 +571,14 @@ static int tls_write(URLContext *h, const uint8_t *buf, int len)
...
@@ -564,8 +571,14 @@ static int tls_write(URLContext *h, const uint8_t *buf, int len)
sspi_ret
=
EncryptMessage
(
&
c
->
ctxt_handle
,
0
,
&
outbuf_desc
,
0
);
sspi_ret
=
EncryptMessage
(
&
c
->
ctxt_handle
,
0
,
&
outbuf_desc
,
0
);
if
(
sspi_ret
==
SEC_E_OK
)
{
if
(
sspi_ret
==
SEC_E_OK
)
{
len
=
outbuf
[
0
].
cbBuffer
+
outbuf
[
1
].
cbBuffer
+
outbuf
[
2
].
cbBuffer
;
len
=
outbuf
[
0
].
cbBuffer
+
outbuf
[
1
].
cbBuffer
+
outbuf
[
2
].
cbBuffer
;
s
->
tcp
->
flags
&=
~
AVIO_FLAG_NONBLOCK
;
s
->
tcp
->
flags
|=
h
->
flags
&
AVIO_FLAG_NONBLOCK
;
ret
=
ffurl_write
(
s
->
tcp
,
data
,
len
);
ret
=
ffurl_write
(
s
->
tcp
,
data
,
len
);
if
(
ret
<
0
||
ret
!=
len
)
{
if
(
ret
==
AVERROR
(
EAGAIN
))
{
goto
done
;
}
else
if
(
ret
<
0
||
ret
!=
len
)
{
ret
=
AVERROR
(
EIO
);
ret
=
AVERROR
(
EIO
);
av_log
(
h
,
AV_LOG_ERROR
,
"Writing encrypted data to socket failed
\n
"
);
av_log
(
h
,
AV_LOG_ERROR
,
"Writing encrypted data to socket failed
\n
"
);
goto
done
;
goto
done
;
...
...
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