Revert r6110 and r6109.
Effectively re-landing r6104 as well as r6108 which includes a fix to a compile error that caused r6104 to be reverted in r6110. BUG= TBR=henrike@webrtc.org Review URL: https://webrtc-codereview.appspot.com/20459004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6119 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "talk/base/common.h"
|
||||
#include "talk/base/logging.h"
|
||||
#include "talk/base/stringencode.h"
|
||||
#include "talk/base/stringutils.h"
|
||||
|
||||
@@ -160,6 +161,55 @@ std::string VideoCodec::ToString() const {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
VideoCodec VideoCodec::CreateRtxCodec(int rtx_payload_type,
|
||||
int associated_payload_type) {
|
||||
VideoCodec rtx_codec(rtx_payload_type, kRtxCodecName, 0, 0, 0, 0);
|
||||
rtx_codec.SetParam(kCodecParamAssociatedPayloadType, associated_payload_type);
|
||||
return rtx_codec;
|
||||
}
|
||||
|
||||
VideoCodec::CodecType VideoCodec::GetCodecType() const {
|
||||
const char* payload_name = name.c_str();
|
||||
if (_stricmp(payload_name, kRedCodecName) == 0) {
|
||||
return CODEC_RED;
|
||||
}
|
||||
if (_stricmp(payload_name, kUlpfecCodecName) == 0) {
|
||||
return CODEC_ULPFEC;
|
||||
}
|
||||
if (_stricmp(payload_name, kRtxCodecName) == 0) {
|
||||
return CODEC_RTX;
|
||||
}
|
||||
|
||||
return CODEC_VIDEO;
|
||||
}
|
||||
|
||||
bool VideoCodec::ValidateCodecFormat() const {
|
||||
if (id < 0 || id > 127) {
|
||||
LOG(LS_ERROR) << "Codec with invalid payload type: " << ToString();
|
||||
return false;
|
||||
}
|
||||
if (GetCodecType() != CODEC_VIDEO) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Video validation from here on.
|
||||
|
||||
if (width <= 0 || height <= 0) {
|
||||
LOG(LS_ERROR) << "Codec with invalid dimensions: " << ToString();
|
||||
return false;
|
||||
}
|
||||
int min_bitrate = -1;
|
||||
int max_bitrate = -1;
|
||||
if (GetParam(kCodecParamMinBitrate, &min_bitrate) &&
|
||||
GetParam(kCodecParamMaxBitrate, &max_bitrate)) {
|
||||
if (max_bitrate < min_bitrate) {
|
||||
LOG(LS_ERROR) << "Codec with max < min bitrate: " << ToString();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string DataCodec::ToString() const {
|
||||
std::ostringstream os;
|
||||
os << "DataCodec[" << id << ":" << name << "]";
|
||||
|
||||
Reference in New Issue
Block a user