(Auto)update libjingle 68689052-> 68689059
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6350 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6ae48c6609
commit
7b6cbb3aa0
@ -2050,6 +2050,9 @@ bool WebRtcVideoMediaChannel::AddRecvStream(const StreamParams& sp) {
|
||||
<< " reuse default channel #"
|
||||
<< vie_channel_;
|
||||
first_receive_ssrc_ = sp.first_ssrc();
|
||||
if (!MaybeSetRtxSsrc(sp, vie_channel_)) {
|
||||
return false;
|
||||
}
|
||||
if (render_started_) {
|
||||
if (engine()->vie()->render()->StartRender(vie_channel_) !=0) {
|
||||
LOG_RTCERR1(StartRender, vie_channel_);
|
||||
@ -2088,19 +2091,8 @@ bool WebRtcVideoMediaChannel::AddRecvStream(const StreamParams& sp) {
|
||||
}
|
||||
channel_iterator = recv_channels_.find(sp.first_ssrc());
|
||||
|
||||
// Set the corresponding RTX SSRC.
|
||||
uint32 rtx_ssrc;
|
||||
bool has_rtx = sp.GetFidSsrc(sp.first_ssrc(), &rtx_ssrc);
|
||||
if (has_rtx) {
|
||||
LOG(LS_INFO) << "Setting rtx ssrc " << rtx_ssrc << " for stream "
|
||||
<< sp.first_ssrc();
|
||||
if (engine()->vie()->rtp()->SetRemoteSSRCType(
|
||||
channel_id, webrtc::kViEStreamTypeRtx, rtx_ssrc) != 0) {
|
||||
LOG_RTCERR3(SetRemoteSSRCType, channel_id, webrtc::kViEStreamTypeRtx,
|
||||
rtx_ssrc);
|
||||
return false;
|
||||
}
|
||||
rtx_to_primary_ssrc_[rtx_ssrc] = sp.first_ssrc();
|
||||
if (!MaybeSetRtxSsrc(sp, channel_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the default renderer.
|
||||
@ -2129,6 +2121,24 @@ bool WebRtcVideoMediaChannel::AddRecvStream(const StreamParams& sp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebRtcVideoMediaChannel::MaybeSetRtxSsrc(const StreamParams& sp,
|
||||
int channel_id) {
|
||||
uint32 rtx_ssrc;
|
||||
bool has_rtx = sp.GetFidSsrc(sp.first_ssrc(), &rtx_ssrc);
|
||||
if (has_rtx) {
|
||||
LOG(LS_INFO) << "Setting rtx ssrc " << rtx_ssrc << " for stream "
|
||||
<< sp.first_ssrc();
|
||||
if (engine()->vie()->rtp()->SetRemoteSSRCType(
|
||||
channel_id, webrtc::kViEStreamTypeRtx, rtx_ssrc) != 0) {
|
||||
LOG_RTCERR3(SetRemoteSSRCType, channel_id, webrtc::kViEStreamTypeRtx,
|
||||
rtx_ssrc);
|
||||
return false;
|
||||
}
|
||||
rtx_to_primary_ssrc_[rtx_ssrc] = sp.first_ssrc();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebRtcVideoMediaChannel::RemoveRecvStream(uint32 ssrc) {
|
||||
if (ssrc == 0) {
|
||||
LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported.";
|
||||
@ -3974,9 +3984,13 @@ int WebRtcVideoMediaChannel::GetRecvChannelNum(uint32 ssrc) {
|
||||
// Check if we have an RTX stream registered on this SSRC.
|
||||
SsrcMap::iterator rtx_it = rtx_to_primary_ssrc_.find(ssrc);
|
||||
if (rtx_it != rtx_to_primary_ssrc_.end()) {
|
||||
it = recv_channels_.find(rtx_it->second);
|
||||
assert(it != recv_channels_.end());
|
||||
recv_channel = it->second->channel_id();
|
||||
if (rtx_it->second == first_receive_ssrc_) {
|
||||
recv_channel = vie_channel_;
|
||||
} else {
|
||||
it = recv_channels_.find(rtx_it->second);
|
||||
assert(it != recv_channels_.end());
|
||||
recv_channel = it->second->channel_id();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
recv_channel = it->second->channel_id();
|
||||
|
@ -350,6 +350,7 @@ class WebRtcVideoMediaChannel : public talk_base::MessageHandler,
|
||||
bool SetReceiveCodecs(WebRtcVideoChannelRecvInfo* info);
|
||||
// Returns the channel number that receives the stream with SSRC |ssrc|.
|
||||
int GetRecvChannelNum(uint32 ssrc);
|
||||
bool MaybeSetRtxSsrc(const StreamParams& sp, int channel_id);
|
||||
// Given captured video frame size, checks if we need to reset vie send codec.
|
||||
// |reset| is set to whether resetting has happened on vie or not.
|
||||
// Returns false on error.
|
||||
|
@ -74,7 +74,7 @@ static const unsigned int kMaxBandwidthKbps = 2000;
|
||||
static const uint32 kSsrcs1[] = {1};
|
||||
static const uint32 kSsrcs2[] = {1, 2};
|
||||
static const uint32 kSsrcs3[] = {1, 2, 3};
|
||||
static const uint32 kRtxSsrc1[] = {4};
|
||||
static const uint32 kRtxSsrcs1[] = {4};
|
||||
static const uint32 kRtxSsrcs3[] = {4, 5, 6};
|
||||
|
||||
|
||||
@ -750,8 +750,44 @@ TEST_F(WebRtcVideoEngineTestFake, SetRecvCodecsWithRtx) {
|
||||
EXPECT_EQ(rtx_codec.id, vie_.GetRtxRecvPayloadType(channel_num));
|
||||
}
|
||||
|
||||
// Test that RTX packets are routed to the default video channel if
|
||||
// there's only one recv stream.
|
||||
TEST_F(WebRtcVideoEngineTestFake, TestReceiveRtxOneStream) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
|
||||
// Setup one channel with an associated RTX stream.
|
||||
cricket::StreamParams params =
|
||||
cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
|
||||
params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
|
||||
EXPECT_TRUE(channel_->AddRecvStream(params));
|
||||
int channel_num = vie_.GetLastChannel();
|
||||
EXPECT_EQ(static_cast<int>(kRtxSsrcs1[0]),
|
||||
vie_.GetRemoteRtxSsrc(channel_num));
|
||||
|
||||
// Register codecs.
|
||||
std::vector<cricket::VideoCodec> codec_list;
|
||||
codec_list.push_back(kVP8Codec720p);
|
||||
cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
|
||||
rtx_codec.SetParam("apt", kVP8Codec.id);
|
||||
codec_list.push_back(rtx_codec);
|
||||
EXPECT_TRUE(channel_->SetRecvCodecs(codec_list));
|
||||
|
||||
// Construct a fake RTX packet and verify that it is passed to the
|
||||
// right WebRTC channel.
|
||||
const size_t kDataLength = 12;
|
||||
uint8_t data[kDataLength];
|
||||
memset(data, 0, sizeof(data));
|
||||
data[0] = 0x80;
|
||||
data[1] = rtx_codec.id;
|
||||
talk_base::SetBE32(&data[8], kRtxSsrcs1[0]);
|
||||
talk_base::Buffer packet(data, kDataLength);
|
||||
talk_base::PacketTime packet_time;
|
||||
channel_->OnPacketReceived(&packet, packet_time);
|
||||
EXPECT_EQ(rtx_codec.id, vie_.GetLastRecvdPayloadType(channel_num));
|
||||
}
|
||||
|
||||
// Test that RTX packets are routed to the correct video channel.
|
||||
TEST_F(WebRtcVideoEngineTestFake, TestReceiveRtx) {
|
||||
TEST_F(WebRtcVideoEngineTestFake, TestReceiveRtxThreeStreams) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
|
||||
// Setup three channels with associated RTX streams.
|
||||
@ -881,7 +917,7 @@ TEST_F(WebRtcVideoEngineTestFake, RecvStreamWithRtx) {
|
||||
EXPECT_TRUE(channel_->AddRecvStream(
|
||||
cricket::CreateSimWithRtxStreamParams("cname",
|
||||
MAKE_VECTOR(kSsrcs1),
|
||||
MAKE_VECTOR(kRtxSsrc1))));
|
||||
MAKE_VECTOR(kRtxSsrcs1))));
|
||||
int new_channel_num = vie_.GetLastChannel();
|
||||
EXPECT_NE(default_channel, new_channel_num);
|
||||
EXPECT_EQ(4, vie_.GetRemoteRtxSsrc(new_channel_num));
|
||||
|
Loading…
x
Reference in New Issue
Block a user