Implement 'abs-send-time' extension in VideoSendStream.

BUG=2229
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2184010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4727 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2013-09-11 19:00:39 +00:00
parent 6138c5cfa4
commit 5c678eabd9
2 changed files with 34 additions and 0 deletions

View File

@ -112,6 +112,9 @@ VideoSendStream::VideoSendStream(newapi::Transport* transport,
if (extension == "toffset") {
if (rtp_rtcp_->SetSendTimestampOffsetStatus(channel_, true, id) != 0)
abort();
} else if (extension == "abs-send-time") {
if (rtp_rtcp_->SetSendAbsoluteSendTimeStatus(channel_, true, id) != 0)
abort();
} else {
abort(); // Unsupported extension.
}

View File

@ -138,6 +138,37 @@ TEST_F(VideoSendStreamTest, SupportsCName) {
RunSendTest(call.get(), send_config, &observer);
}
TEST_F(VideoSendStreamTest, SupportsAbsoluteSendTime) {
static const uint8_t kAbsSendTimeExtensionId = 13;
class AbsoluteSendTimeObserver : public SendTransportObserver {
public:
AbsoluteSendTimeObserver() : SendTransportObserver(30 * 1000) {
EXPECT_TRUE(rtp_header_parser_->RegisterRtpHeaderExtension(
kRtpExtensionAbsoluteSendTime, kAbsSendTimeExtensionId));
}
virtual bool SendRTP(const uint8_t* packet, size_t length) OVERRIDE {
RTPHeader header;
EXPECT_TRUE(
rtp_header_parser_->Parse(packet, static_cast<int>(length), &header));
if (header.extension.absoluteSendTime > 0)
send_test_complete_->Set();
return true;
}
} observer;
Call::Config call_config(&observer);
scoped_ptr<Call> call(Call::Create(call_config));
VideoSendStream::Config send_config = GetSendTestConfig(call.get());
send_config.rtp.extensions.push_back(
RtpExtension("abs-send-time", kAbsSendTimeExtensionId));
RunSendTest(call.get(), send_config, &observer);
}
TEST_F(VideoSendStreamTest, SupportsTransmissionTimeOffset) {
static const uint8_t kTOffsetExtensionId = 13;
class DelayedEncoder : public test::FakeEncoder {