mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-06 22:25:36 +01:00
Merge commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05'
* commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05': lavf: Add a protocol for SRTP encryption/decryption rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES) Conflicts: libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "avformat.h"
|
||||
#include "mpegts.h"
|
||||
#include "network.h"
|
||||
#include "srtp.h"
|
||||
#include "url.h"
|
||||
#include "rtpdec.h"
|
||||
#include "rtpdec_formats.h"
|
||||
@@ -543,6 +544,13 @@ void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
|
||||
s->handler = handler;
|
||||
}
|
||||
|
||||
void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
|
||||
const char *params)
|
||||
{
|
||||
if (!ff_srtp_set_crypto(&s->srtp, suite, params))
|
||||
s->srtp_enabled = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This was the second switch in rtp_parse packet.
|
||||
* Normalizes time, if required, sets stream_index, etc.
|
||||
@@ -879,7 +887,10 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
|
||||
int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
|
||||
uint8_t **bufptr, int len)
|
||||
{
|
||||
int rv = rtp_parse_one_packet(s, pkt, bufptr, len);
|
||||
int rv;
|
||||
if (s->srtp_enabled && bufptr && ff_srtp_decrypt(&s->srtp, *bufptr, &len) < 0)
|
||||
return -1;
|
||||
rv = rtp_parse_one_packet(s, pkt, bufptr, len);
|
||||
s->prev_ret = rv;
|
||||
while (rv == AVERROR(EAGAIN) && has_next_packet(s))
|
||||
rv = rtp_parse_queued_packet(s, pkt);
|
||||
@@ -892,6 +903,7 @@ void ff_rtp_parse_close(RTPDemuxContext *s)
|
||||
if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
|
||||
ff_mpegts_parse_close(s->ts);
|
||||
}
|
||||
ff_srtp_free(&s->srtp);
|
||||
av_free(s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user