[FFmpeg-devel] [PATCH] lavf/tls_securetransport: fix SNI support when not verifying
Rodger Combs
rodger.combs at gmail.com
Mon Jun 8 23:50:53 CEST 2015
---
libavformat/segment.c | 4 +++-
libavformat/tls_securetransport.c | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 953140f..66e28b2 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -113,6 +113,7 @@ typedef struct SegmentContext {
int64_t initial_offset; ///< initial timestamps offset, expressed in microseconds
char *reference_stream_specifier; ///< reference stream specifier
int reference_stream_index;
+ int break_non_keyframes;
SegmentListEntry cur_entry;
SegmentListEntry *segment_list_entries;
@@ -910,7 +911,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index == seg->reference_stream_index ? seg->frame_count : -1);
if (pkt->stream_index == seg->reference_stream_index &&
- pkt->flags & AV_PKT_FLAG_KEY &&
+ (pkt->flags & AV_PKT_FLAG_KEY || seg->break_non_keyframes) &&
seg->segment_frame_count > 0 &&
(seg->cut_pending || seg->frame_count >= start_frame ||
(pkt->pts != AV_NOPTS_VALUE &&
@@ -1056,6 +1057,7 @@ static const AVOption options[] = {
{ "segment_start_number", "set the sequence number of the first segment", OFFSET(segment_idx), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
{ "segment_wrap_number", "set the number of wrap before the first segment", OFFSET(segment_idx_wrap_nb), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
{ "strftime", "set filename expansion with strftime at segment creation", OFFSET(use_strftime), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, E },
+ { "break_non_keyframes", "allow breaking segments on non-keyframes", OFFSET(break_non_keyframes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, E },
{ "individual_header_trailer", "write header/trailer to each segment", OFFSET(individual_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{ "write_header_trailer", "write a header to the first segment and a trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
index c90eab7..cdc7953 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -273,13 +273,13 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
if (s->ca_file) {
if ((ret = load_ca(h)) < 0)
goto fail;
- CHECK_ERROR(SSLSetSessionOption, c->ssl_context, kSSLSessionOptionBreakOnServerAuth, true);
}
+ if (s->ca_file || !s->verify)
+ CHECK_ERROR(SSLSetSessionOption, c->ssl_context, kSSLSessionOptionBreakOnServerAuth, true);
if (s->cert_file)
if ((ret = load_cert(h)) < 0)
goto fail;
- if (s->verify)
- CHECK_ERROR(SSLSetPeerDomainName, c->ssl_context, s->host, strlen(s->host));
+ CHECK_ERROR(SSLSetPeerDomainName, c->ssl_context, s->host, strlen(s->host));
CHECK_ERROR(SSLSetIOFuncs, c->ssl_context, tls_read_cb, tls_write_cb);
CHECK_ERROR(SSLSetConnection, c->ssl_context, h);
while (1) {
--
2.4.1
More information about the ffmpeg-devel
mailing list