Update libjingle 61901702->61966318

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5596 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2014-02-21 23:43:24 +00:00
parent a7b981843f
commit d43aa9de7a
13 changed files with 149 additions and 58 deletions

@ -30,8 +30,8 @@
#include <openssl/ssl.h>
#if (OPENSSL_VERSION_NUMBER < 0x10001000L)
#error OpenSSL is older than 1.0.1, which is the minimum supported version.
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
#error OpenSSL is older than 1.0.0, which is the minimum supported version.
#endif
#endif // TALK_BASE_OPENSSL_H_

@ -53,6 +53,11 @@
namespace talk_base {
#if (OPENSSL_VERSION_NUMBER >= 0x10001000L)
#define HAVE_DTLS_SRTP
#endif
#ifdef HAVE_DTLS_SRTP
// SRTP cipher suite table
struct SrtpCipherMapEntry {
const char* external_name;
@ -65,6 +70,7 @@ static SrtpCipherMapEntry SrtpCipherMap[] = {
{"AES_CM_128_HMAC_SHA1_32", "SRTP_AES128_CM_SHA1_32"},
{NULL, NULL}
};
#endif
//////////////////////////////////////////////////////////////////////
// StreamBIO
@ -238,6 +244,7 @@ bool OpenSSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
bool use_context,
uint8* result,
size_t result_len) {
#ifdef HAVE_DTLS_SRTP
int i;
i = SSL_export_keying_material(ssl_, result, result_len,
@ -249,10 +256,14 @@ bool OpenSSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
return false;
return true;
#else
return false;
#endif
}
bool OpenSSLStreamAdapter::SetDtlsSrtpCiphers(
const std::vector<std::string>& ciphers) {
#ifdef HAVE_DTLS_SRTP
std::string internal_ciphers;
if (state_ != SSL_NONE)
@ -283,9 +294,13 @@ bool OpenSSLStreamAdapter::SetDtlsSrtpCiphers(
srtp_ciphers_ = internal_ciphers;
return true;
#else
return false;
#endif
}
bool OpenSSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
#ifdef HAVE_DTLS_SRTP
ASSERT(state_ == SSL_CONNECTED);
if (state_ != SSL_CONNECTED)
return false;
@ -307,6 +322,9 @@ bool OpenSSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
ASSERT(false); // This should never happen
return false;
#else
return false;
#endif
}
int OpenSSLStreamAdapter::StartSSLWithServer(const char* server_name) {
@ -737,12 +755,14 @@ SSL_CTX* OpenSSLStreamAdapter::SetupSSLContext() {
SSL_CTX_set_verify_depth(ctx, 4);
SSL_CTX_set_cipher_list(ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
#ifdef HAVE_DTLS_SRTP
if (!srtp_ciphers_.empty()) {
if (SSL_CTX_set_tlsext_use_srtp(ctx, srtp_ciphers_.c_str())) {
SSL_CTX_free(ctx);
return NULL;
}
}
#endif
return ctx;
}
@ -820,11 +840,19 @@ bool OpenSSLStreamAdapter::HaveDtls() {
}
bool OpenSSLStreamAdapter::HaveDtlsSrtp() {
#ifdef HAVE_DTLS_SRTP
return true;
#else
return false;
#endif
}
bool OpenSSLStreamAdapter::HaveExporter() {
#ifdef HAVE_DTLS_SRTP
return true;
#else
return false;
#endif
}
} // namespace talk_base

@ -96,4 +96,7 @@ const char kGoogleSctpDataCodecName[] = "google-sctp-data";
const char kComfortNoiseCodecName[] = "CN";
const char kRtpAbsoluteSendTimeHeaderExtension[] =
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
} // namespace cricket

@ -116,6 +116,10 @@ extern const char kGoogleSctpDataCodecName[];
extern const char kComfortNoiseCodecName[];
// Extension header for absolute send time, see url for details:
// http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
extern const char kRtpAbsoluteSendTimeHeaderExtension[];
} // namespace cricket
#endif // TALK_MEDIA_BASE_CONSTANTS_H_

@ -211,6 +211,12 @@ void CoordinatedVideoAdapter::SetInputFormat(const VideoFormat& format) {
}
}
void CoordinatedVideoAdapter::set_cpu_smoothing(bool enable) {
LOG(LS_INFO) << "CPU smoothing is now "
<< (enable ? "enabled" : "disabled");
cpu_smoothing_ = enable;
}
void VideoAdapter::SetOutputFormat(const VideoFormat& format) {
talk_base::CritScope cs(&critical_section_);
int64 old_output_interval = output_format_.interval;
@ -361,6 +367,12 @@ bool VideoAdapter::AdaptFrame(const VideoFrame* in_frame,
return true;
}
void VideoAdapter::set_scale_third(bool enable) {
LOG(LS_INFO) << "Video Adapter third scaling is now "
<< (enable ? "enabled" : "disabled");
scale_third_ = enable;
}
// Scale or Blacken the frame. Returns true if successful.
bool VideoAdapter::StretchToOutputFrame(const VideoFrame* in_frame) {
int output_width = output_format_.width;
@ -481,6 +493,48 @@ void CoordinatedVideoAdapter::OnOutputFormatRequest(const VideoFormat& format) {
<< " To: " << new_width << "x" << new_height;
}
void CoordinatedVideoAdapter::set_cpu_load_min_samples(
int cpu_load_min_samples) {
if (cpu_load_min_samples_ != cpu_load_min_samples) {
LOG(LS_INFO) << "VAdapt Change Cpu Adapt Min Samples from: "
<< cpu_load_min_samples_ << " to "
<< cpu_load_min_samples;
cpu_load_min_samples_ = cpu_load_min_samples;
}
}
void CoordinatedVideoAdapter::set_high_system_threshold(
float high_system_threshold) {
ASSERT(high_system_threshold <= 1.0f);
ASSERT(high_system_threshold >= 0.0f);
if (high_system_threshold_ != high_system_threshold) {
LOG(LS_INFO) << "VAdapt Change High System Threshold from: "
<< high_system_threshold_ << " to " << high_system_threshold;
high_system_threshold_ = high_system_threshold;
}
}
void CoordinatedVideoAdapter::set_low_system_threshold(
float low_system_threshold) {
ASSERT(low_system_threshold <= 1.0f);
ASSERT(low_system_threshold >= 0.0f);
if (low_system_threshold_ != low_system_threshold) {
LOG(LS_INFO) << "VAdapt Change Low System Threshold from: "
<< low_system_threshold_ << " to " << low_system_threshold;
low_system_threshold_ = low_system_threshold;
}
}
void CoordinatedVideoAdapter::set_process_threshold(float process_threshold) {
ASSERT(process_threshold <= 1.0f);
ASSERT(process_threshold >= 0.0f);
if (process_threshold_ != process_threshold) {
LOG(LS_INFO) << "VAdapt Change High Process Threshold from: "
<< process_threshold_ << " to " << process_threshold;
process_threshold_ = process_threshold;
}
}
// A Bandwidth GD request for new resolution
void CoordinatedVideoAdapter::OnEncoderResolutionRequest(
int width, int height, AdaptRequest request) {

@ -28,7 +28,6 @@
#include "talk/base/common.h" // For ASSERT
#include "talk/base/criticalsection.h"
#include "talk/base/logging.h"
#include "talk/base/scoped_ptr.h"
#include "talk/base/sigslot.h"
#include "talk/media/base/videocommon.h"
@ -64,11 +63,7 @@ class VideoAdapter {
// the output frame.
bool AdaptFrame(const VideoFrame* in_frame, VideoFrame** out_frame);
void set_scale_third(bool enable) {
LOG(LS_INFO) << "Video Adapter third scaling is now "
<< (enable ? "enabled" : "disabled");
scale_third_ = enable;
}
void set_scale_third(bool enable);
bool scale_third() const { return scale_third_; }
protected:
@ -129,11 +124,7 @@ class CoordinatedVideoAdapter
// Enable or disable smoothing when doing CPU adaptation. When smoothing is
// enabled, system CPU load is tracked using an exponential weighted
// average.
void set_cpu_smoothing(bool enable) {
LOG(LS_INFO) << "CPU smoothing is now "
<< (enable ? "enabled" : "disabled");
cpu_smoothing_ = enable;
}
void set_cpu_smoothing(bool enable);
bool cpu_smoothing() const { return cpu_smoothing_; }
// Enable or disable video adaptation due to the change of the GD
void set_gd_adaptation(bool enable) { gd_adaptation_ = enable; }
@ -151,47 +142,16 @@ class CoordinatedVideoAdapter
// When the video is decreased, set the waiting time for CPU adaptation to
// decrease video again.
void set_cpu_load_min_samples(int cpu_load_min_samples) {
if (cpu_load_min_samples_ != cpu_load_min_samples) {
LOG(LS_INFO) << "VAdapt Change Cpu Adapt Min Samples from: "
<< cpu_load_min_samples_ << " to "
<< cpu_load_min_samples;
cpu_load_min_samples_ = cpu_load_min_samples;
}
}
void set_cpu_load_min_samples(int cpu_load_min_samples);
int cpu_load_min_samples() const { return cpu_load_min_samples_; }
// CPU system load high threshold for reducing resolution. e.g. 0.85f
void set_high_system_threshold(float high_system_threshold) {
ASSERT(high_system_threshold <= 1.0f);
ASSERT(high_system_threshold >= 0.0f);
if (high_system_threshold_ != high_system_threshold) {
LOG(LS_INFO) << "VAdapt Change High System Threshold from: "
<< high_system_threshold_ << " to " << high_system_threshold;
high_system_threshold_ = high_system_threshold;
}
}
void set_high_system_threshold(float high_system_threshold);
float high_system_threshold() const { return high_system_threshold_; }
// CPU system load low threshold for increasing resolution. e.g. 0.70f
void set_low_system_threshold(float low_system_threshold) {
ASSERT(low_system_threshold <= 1.0f);
ASSERT(low_system_threshold >= 0.0f);
if (low_system_threshold_ != low_system_threshold) {
LOG(LS_INFO) << "VAdapt Change Low System Threshold from: "
<< low_system_threshold_ << " to " << low_system_threshold;
low_system_threshold_ = low_system_threshold;
}
}
void set_low_system_threshold(float low_system_threshold);
float low_system_threshold() const { return low_system_threshold_; }
// CPU process load threshold for reducing resolution. e.g. 0.10f
void set_process_threshold(float process_threshold) {
ASSERT(process_threshold <= 1.0f);
ASSERT(process_threshold >= 0.0f);
if (process_threshold_ != process_threshold) {
LOG(LS_INFO) << "VAdapt Change High Process Threshold from: "
<< process_threshold_ << " to " << process_threshold;
process_threshold_ = process_threshold;
}
}
void set_process_threshold(float process_threshold);
float process_threshold() const { return process_threshold_; }
// Handle the format request from the server via Jingle update message.

@ -152,10 +152,7 @@ static const char kRtpTimestampOffsetHeaderExtension[] =
"urn:ietf:params:rtp-hdrext:toffset";
static const int kRtpTimeOffsetExtensionId = 2;
// Extension header for absolute send time, see url for details:
// http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
static const char kRtpAbsoluteSendTimeHeaderExtension[] =
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
// Extension header ID for absolute send time. Url defined in constants.cc
static const int kRtpAbsoluteSendTimeExtensionId = 3;
// Default video dscp value.
// See http://tools.ietf.org/html/rfc2474 for details

@ -33,6 +33,7 @@
#include "talk/base/common.h"
#include "talk/base/dscp.h"
#include "talk/base/logging.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/rtputils.h"
#include "talk/p2p/base/transportchannel.h"
#include "talk/session/media/channelmanager.h"
@ -186,7 +187,8 @@ BaseChannel::BaseChannel(talk_base::Thread* thread,
remote_content_direction_(MD_INACTIVE),
has_received_packet_(false),
dtls_keyed_(false),
secure_required_(false) {
secure_required_(false),
rtp_abs_sendtime_extn_id_(-1) {
ASSERT(worker_thread_ == talk_base::Thread::Current());
LOG(LS_INFO) << "Created channel for " << content_name;
}
@ -462,14 +464,40 @@ bool BaseChannel::SendPacket(bool rtcp, talk_base::Buffer* packet,
SignalSendPacketPreCrypto(packet->data(), packet->length(), rtcp);
}
talk_base::PacketOptions options(dscp);
options.packet_time_params.rtp_sendtime_extension_id =
rtp_abs_sendtime_extn_id_;
// Protect if needed.
if (srtp_filter_.IsActive()) {
bool res;
char* data = packet->data();
int len = static_cast<int>(packet->length());
if (!rtcp) {
res = srtp_filter_.ProtectRtp(data, len,
static_cast<int>(packet->capacity()), &len);
// If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done
// inside libsrtp for a RTP packet. A external HMAC module will be writing
// a fake HMAC value. This is ONLY done for a RTP packet.
// Socket layer will update rtp sendtime extension header if present in
// packet with current time before updating the HMAC.
#if !defined(ENABLE_EXTERNAL_AUTH)
res = srtp_filter_.ProtectRtp(
data, len, static_cast<int>(packet->capacity()), &len);
#else
res = srtp_filter_.ProtectRtp(
data, len, static_cast<int>(packet->capacity()), &len,
&options.packet_time_params.srtp_packet_index);
// If protection succeeds, let's get auth params from srtp.
if (res) {
uint8* auth_key = NULL;
int key_len;
res = srtp_filter_.GetRtpAuthParams(
&auth_key, &key_len, &options.packet_time_params.srtp_auth_tag_len);
if (res) {
options.packet_time_params.srtp_auth_key.resize(key_len);
options.packet_time_params.srtp_auth_key.assign(auth_key,
auth_key + key_len);
}
}
#endif
if (!res) {
int seq_num = -1;
uint32 ssrc = 0;
@ -511,7 +539,6 @@ bool BaseChannel::SendPacket(bool rtcp, talk_base::Buffer* packet,
}
// Bon voyage.
talk_base::PacketOptions options(dscp);
int ret = channel->SendPacket(packet->data(), packet->length(), options,
(secure() && secure_dtls()) ? PF_SRTP_BYPASS : 0);
if (ret != static_cast<int>(packet->length())) {
@ -1170,6 +1197,8 @@ bool BaseChannel::SetBaseRemoteContent_w(const MediaContentDescription* content,
<< MediaTypeToString(content->type()) << " content.";
SafeSetError(desc.str(), error_desc);
ret = false;
} else {
MaybeCacheRtpAbsSendTimeHeaderExtension(content->rtp_header_extensions());
}
}
@ -1184,6 +1213,14 @@ bool BaseChannel::SetBaseRemoteContent_w(const MediaContentDescription* content,
return ret;
}
void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension(
const std::vector<RtpHeaderExtension>& extensions) {
const RtpHeaderExtension* send_time_extension =
FindHeaderExtension(extensions, kRtpAbsoluteSendTimeHeaderExtension);
rtp_abs_sendtime_extn_id_ =
send_time_extension ? send_time_extension->id : -1;
}
void BaseChannel::OnMessage(talk_base::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_RTPPACKET:

@ -319,6 +319,11 @@ class BaseChannel
ContentAction action,
std::string* error_desc) = 0;
// Helper method to get RTP Absoulute SendTime extension header id if
// present in remote supported extensions list.
void MaybeCacheRtpAbsSendTimeHeaderExtension(
const std::vector<RtpHeaderExtension>& extensions);
bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos,
bool* dtls,
std::string* error_desc);
@ -380,6 +385,7 @@ class BaseChannel
bool has_received_packet_;
bool dtls_keyed_;
bool secure_required_;
int rtp_abs_sendtime_extn_id_;
};
// VoiceChannel is a specialization that adds support for early media, DTMF,

@ -33,7 +33,7 @@
#include "third_party/libsrtp/include/srtp.h"
#endif // SRTP_RELATIVE_PATH
#include "talk/session/media/external_hmac.h"
#include "talk/session/media/externalhmac.h"
#include "talk/base/logging.h"

@ -52,7 +52,7 @@ extern "C" srtp_stream_t srtp_get_stream(srtp_t srtp, uint32_t ssrc);
#include "third_party/libsrtp/include/srtp_priv.h"
#endif // SRTP_RELATIVE_PATH
#ifdef ENABLE_EXTERNAL_AUTH
#include "talk/session/media/external_hmac.h"
#include "talk/session/media/externalhmac.h"
#endif // ENABLE_EXTERNAL_AUTH
#ifdef _DEBUG
extern "C" debug_module_t mod_srtp;

@ -118,6 +118,7 @@ const char STR_MUC_ROOM_FEATURE_HANGOUT[] = "muc_es";
const char STR_MUC_ROOM_FEATURE_HANGOUT_LITE[] = "muc_lite";
const char STR_MUC_ROOM_FEATURE_BROADCAST[] = "broadcast";
const char STR_MUC_ROOM_FEATURE_MULTI_USER_VC[] = "muc_muvc";
const char STR_MUC_ROOM_FEATURE_RECORDABLE[] = "recordable";
const char STR_MUC_ROOM_OWNER_PROFILE_ID[] = "muc#roominfo_owner_profile_id";
const char STR_ID_TYPE_CONVERSATION[] = "conversation";

@ -111,6 +111,7 @@ extern const char STR_MUC_ROOM_FEATURE_HANGOUT[];
extern const char STR_MUC_ROOM_FEATURE_HANGOUT_LITE[];
extern const char STR_MUC_ROOM_FEATURE_BROADCAST[];
extern const char STR_MUC_ROOM_FEATURE_MULTI_USER_VC[];
extern const char STR_MUC_ROOM_FEATURE_RECORDABLE[];
extern const char STR_MUC_ROOM_OWNER_PROFILE_ID[];
extern const char STR_ID_TYPE_CONVERSATION[];