(Auto)update libjingle 69005149-> 69049090
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6408 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
286cd7683c
commit
d41eaeb7cd
@ -195,50 +195,47 @@ static std::vector<VideoCodec> DefaultVideoCodecs() {
|
|||||||
WebRtcVideoEncoderFactory2::~WebRtcVideoEncoderFactory2() {
|
WebRtcVideoEncoderFactory2::~WebRtcVideoEncoderFactory2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultVideoEncoderFactory : public WebRtcVideoEncoderFactory2 {
|
std::vector<webrtc::VideoStream> WebRtcVideoEncoderFactory2::CreateVideoStreams(
|
||||||
public:
|
const VideoCodec& codec,
|
||||||
virtual std::vector<webrtc::VideoStream> CreateVideoStreams(
|
const VideoOptions& options,
|
||||||
const VideoCodec& codec,
|
size_t num_streams) {
|
||||||
const VideoOptions& options,
|
assert(SupportsCodec(codec));
|
||||||
size_t num_streams) OVERRIDE {
|
if (num_streams != 1) {
|
||||||
assert(SupportsCodec(codec));
|
LOG(LS_ERROR) << "Unsupported number of streams: " << num_streams;
|
||||||
if (num_streams != 1) {
|
return std::vector<webrtc::VideoStream>();
|
||||||
LOG(LS_ERROR) << "Unsupported number of streams: " << num_streams;
|
|
||||||
return std::vector<webrtc::VideoStream>();
|
|
||||||
}
|
|
||||||
|
|
||||||
webrtc::VideoStream stream;
|
|
||||||
stream.width = codec.width;
|
|
||||||
stream.height = codec.height;
|
|
||||||
stream.max_framerate =
|
|
||||||
codec.framerate != 0 ? codec.framerate : kDefaultFramerate;
|
|
||||||
|
|
||||||
int min_bitrate = kMinVideoBitrate;
|
|
||||||
codec.GetParam(kCodecParamMinBitrate, &min_bitrate);
|
|
||||||
int max_bitrate = kMaxVideoBitrate;
|
|
||||||
codec.GetParam(kCodecParamMaxBitrate, &max_bitrate);
|
|
||||||
stream.min_bitrate_bps = min_bitrate * 1000;
|
|
||||||
stream.target_bitrate_bps = stream.max_bitrate_bps = max_bitrate * 1000;
|
|
||||||
|
|
||||||
int max_qp = 56;
|
|
||||||
codec.GetParam(kCodecParamMaxQuantization, &max_qp);
|
|
||||||
stream.max_qp = max_qp;
|
|
||||||
std::vector<webrtc::VideoStream> streams;
|
|
||||||
streams.push_back(stream);
|
|
||||||
return streams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual webrtc::VideoEncoder* CreateVideoEncoder(
|
webrtc::VideoStream stream;
|
||||||
const VideoCodec& codec,
|
stream.width = codec.width;
|
||||||
const VideoOptions& options) OVERRIDE {
|
stream.height = codec.height;
|
||||||
assert(SupportsCodec(codec));
|
stream.max_framerate =
|
||||||
return webrtc::VP8Encoder::Create();
|
codec.framerate != 0 ? codec.framerate : kDefaultFramerate;
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool SupportsCodec(const VideoCodec& codec) OVERRIDE {
|
int min_bitrate = kMinVideoBitrate;
|
||||||
return _stricmp(codec.name.c_str(), kVp8PayloadName) == 0;
|
codec.GetParam(kCodecParamMinBitrate, &min_bitrate);
|
||||||
}
|
int max_bitrate = kMaxVideoBitrate;
|
||||||
};
|
codec.GetParam(kCodecParamMaxBitrate, &max_bitrate);
|
||||||
|
stream.min_bitrate_bps = min_bitrate * 1000;
|
||||||
|
stream.target_bitrate_bps = stream.max_bitrate_bps = max_bitrate * 1000;
|
||||||
|
|
||||||
|
int max_qp = 56;
|
||||||
|
codec.GetParam(kCodecParamMaxQuantization, &max_qp);
|
||||||
|
stream.max_qp = max_qp;
|
||||||
|
std::vector<webrtc::VideoStream> streams;
|
||||||
|
streams.push_back(stream);
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
webrtc::VideoEncoder* WebRtcVideoEncoderFactory2::CreateVideoEncoder(
|
||||||
|
const VideoCodec& codec,
|
||||||
|
const VideoOptions& options) {
|
||||||
|
assert(SupportsCodec(codec));
|
||||||
|
return webrtc::VP8Encoder::Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebRtcVideoEncoderFactory2::SupportsCodec(const VideoCodec& codec) {
|
||||||
|
return _stricmp(codec.name.c_str(), kVp8PayloadName) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
WebRtcVideoEngine2::WebRtcVideoEngine2() {
|
WebRtcVideoEngine2::WebRtcVideoEngine2() {
|
||||||
// Construct without a factory or voice engine.
|
// Construct without a factory or voice engine.
|
||||||
@ -264,7 +261,6 @@ void WebRtcVideoEngine2::Construct(WebRtcVideoChannelFactory* channel_factory,
|
|||||||
|
|
||||||
video_codecs_ = DefaultVideoCodecs();
|
video_codecs_ = DefaultVideoCodecs();
|
||||||
default_codec_format_ = VideoFormat(kDefaultVideoFormat);
|
default_codec_format_ = VideoFormat(kDefaultVideoFormat);
|
||||||
default_video_encoder_factory_.reset(new DefaultVideoEncoderFactory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcVideoEngine2::~WebRtcVideoEngine2() {
|
WebRtcVideoEngine2::~WebRtcVideoEngine2() {
|
||||||
@ -463,8 +459,8 @@ bool WebRtcVideoEngine2::ShouldIgnoreTrace(const std::string& trace) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcVideoEncoderFactory2* WebRtcVideoEngine2::GetVideoEncoderFactory() const {
|
WebRtcVideoEncoderFactory2* WebRtcVideoEngine2::GetVideoEncoderFactory() {
|
||||||
return default_video_encoder_factory_.get();
|
return &default_video_encoder_factory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thin map between VideoFrame and an existing webrtc::I420VideoFrame
|
// Thin map between VideoFrame and an existing webrtc::I420VideoFrame
|
||||||
|
@ -86,13 +86,13 @@ class WebRtcVideoEncoderFactory2 {
|
|||||||
virtual std::vector<webrtc::VideoStream> CreateVideoStreams(
|
virtual std::vector<webrtc::VideoStream> CreateVideoStreams(
|
||||||
const VideoCodec& codec,
|
const VideoCodec& codec,
|
||||||
const VideoOptions& options,
|
const VideoOptions& options,
|
||||||
size_t num_streams) = 0;
|
size_t num_streams);
|
||||||
|
|
||||||
virtual webrtc::VideoEncoder* CreateVideoEncoder(
|
virtual webrtc::VideoEncoder* CreateVideoEncoder(
|
||||||
const VideoCodec& codec,
|
const VideoCodec& codec,
|
||||||
const VideoOptions& options) = 0;
|
const VideoOptions& options);
|
||||||
|
|
||||||
virtual bool SupportsCodec(const cricket::VideoCodec& codec) = 0;
|
virtual bool SupportsCodec(const cricket::VideoCodec& codec);
|
||||||
};
|
};
|
||||||
|
|
||||||
// WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
|
// WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
|
||||||
@ -144,7 +144,7 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
|
talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
|
||||||
|
|
||||||
virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory() const;
|
virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Construct(WebRtcVideoChannelFactory* channel_factory,
|
void Construct(WebRtcVideoChannelFactory* channel_factory,
|
||||||
@ -167,8 +167,7 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
|
talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
|
||||||
WebRtcVideoChannelFactory* channel_factory_;
|
WebRtcVideoChannelFactory* channel_factory_;
|
||||||
talk_base::scoped_ptr<WebRtcVideoEncoderFactory2>
|
WebRtcVideoEncoderFactory2 default_video_encoder_factory_;
|
||||||
default_video_encoder_factory_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adapter between webrtc::VideoRenderer and cricket::VideoRenderer.
|
// Adapter between webrtc::VideoRenderer and cricket::VideoRenderer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user