Adds two tests for verifying padding and ramp-up behavior.
BUG=1837
R=pbos@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2073004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4591 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video_engine/internal/video_send_stream.cc b/video_engine/internal/video_send_stream.cc
index 7d9e680..da72877 100644
--- a/video_engine/internal/video_send_stream.cc
+++ b/video_engine/internal/video_send_stream.cc
@@ -16,6 +16,7 @@
#include "webrtc/video_engine/include/vie_base.h"
#include "webrtc/video_engine/include/vie_capture.h"
#include "webrtc/video_engine/include/vie_codec.h"
+#include "webrtc/video_engine/include/vie_external_codec.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/video_engine/new_include/video_send_stream.h"
@@ -77,7 +78,7 @@
bool overuse_detection,
webrtc::VideoEngine* video_engine,
const newapi::VideoSendStream::Config& config)
- : transport_(transport), config_(config) {
+ : transport_(transport), config_(config), external_codec_(NULL) {
if (config_.codec.numberOfSimulcastStreams > 0) {
assert(config_.rtp.ssrcs.size() == config_.codec.numberOfSimulcastStreams);
@@ -92,9 +93,17 @@
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine);
assert(rtp_rtcp_ != NULL);
- assert(config_.rtp.ssrcs.size() == 1);
- rtp_rtcp_->SetLocalSSRC(channel_, config_.rtp.ssrcs[0]);
+ if (config_.rtp.ssrcs.size() == 1) {
+ rtp_rtcp_->SetLocalSSRC(channel_, config_.rtp.ssrcs[0]);
+ } else {
+ for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) {
+ rtp_rtcp_->SetLocalSSRC(channel_, config_.rtp.ssrcs[i],
+ kViEStreamTypeNormal, i);
+ }
+ }
rtp_rtcp_->SetNACKStatus(channel_, config_.rtp.nack.rtp_history_ms > 0);
+ rtp_rtcp_->SetTransmissionSmoothingStatus(channel_, config_.pacing);
+ rtp_rtcp_->SetSendTimestampOffsetStatus(channel_, true, 1);
capture_ = ViECapture::GetInterface(video_engine);
capture_->AllocateExternalCaptureDevice(capture_id_, external_capture_);
@@ -105,6 +114,15 @@
network_->RegisterSendTransport(channel_, *this);
+ if (config.encoder) {
+ external_codec_ = ViEExternalCodec::GetInterface(video_engine);
+ if (external_codec_->RegisterExternalSendCodec(
+ channel_, config.codec.plType, config.encoder,
+ config.internal_source) != 0) {
+ abort();
+ }
+ }
+
codec_ = ViECodec::GetInterface(video_engine);
if (codec_->SetSendCodec(channel_, config_.codec) != 0) {
abort();
@@ -126,9 +144,16 @@
capture_->DisconnectCaptureDevice(channel_);
capture_->ReleaseCaptureDevice(capture_id_);
+ if (external_codec_) {
+ external_codec_->DeRegisterExternalSendCodec(channel_,
+ config_.codec.plType);
+ }
+
video_engine_base_->Release();
capture_->Release();
codec_->Release();
+ if (external_codec_)
+ external_codec_->Release();
network_->Release();
rtp_rtcp_->Release();
}
@@ -199,7 +224,7 @@
assert(length >= 0);
bool success = transport_->SendRTP(static_cast<const uint8_t*>(packet),
static_cast<size_t>(length));
- return success ? 0 : -1;
+ return success ? length : -1;
}
int VideoSendStream::SendRTCPPacket(int /*channel*/,
@@ -208,7 +233,7 @@
assert(length >= 0);
bool success = transport_->SendRTCP(static_cast<const uint8_t*>(packet),
static_cast<size_t>(length));
- return success ? 0 : -1;
+ return success ? length : -1;
}
bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {