Add StartSend check.
Review URL: https://webrtc-codereview.appspot.com/414002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1783 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
4ce0ba00de
commit
1a739bab59
@ -227,96 +227,11 @@ void ViEAutoTest::ViECodecExtendedTest()
|
||||
videoChannel2, "127.0.0.1", rtpPort2));
|
||||
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(videoChannel2));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(videoChannel2));
|
||||
EXPECT_EQ(-1, ViE.base->StartSend(videoChannel2));
|
||||
|
||||
ViETest::Log("\nTest using one encoder on several channels");
|
||||
ViETest::Log("Channel 1 is rendered in Window1, channel 2 in Window 2."
|
||||
"\nSending VP8 on both channels");
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
EXPECT_EQ(webrtc::kVideoCodecVP8,
|
||||
codecObserver1.incomingCodec.codecType);
|
||||
EXPECT_EQ(send_codec.width, codecObserver1.incomingCodec.width);
|
||||
EXPECT_EQ(webrtc::kVideoCodecVP8,
|
||||
codecObserver2.incomingCodec.codecType);
|
||||
EXPECT_EQ(send_codec.width, codecObserver2.incomingCodec.width);
|
||||
|
||||
// Change resolution on one of the channels and verify it changes for
|
||||
// the other channel too.
|
||||
send_codec.width = 2 * codecWidth;
|
||||
send_codec.height = 2 * codecHeight;
|
||||
EXPECT_EQ(0, ViE.codec->SetSendCodec(videoChannel1, send_codec));
|
||||
|
||||
// We need to verify using render effect filter since we won't trigger
|
||||
// a decode reset in loopback (due to using the same SSRC).
|
||||
RenderFilter filter1;
|
||||
RenderFilter filter2;
|
||||
EXPECT_EQ(0,
|
||||
ViE.image_process->RegisterRenderEffectFilter(videoChannel1,
|
||||
filter1));
|
||||
EXPECT_EQ(0,
|
||||
ViE.image_process->RegisterRenderEffectFilter(videoChannel2,
|
||||
filter2));
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
EXPECT_EQ(0, ViE.image_process->DeregisterRenderEffectFilter(
|
||||
videoChannel1));
|
||||
EXPECT_EQ(0, ViE.image_process->DeregisterRenderEffectFilter(
|
||||
videoChannel2));
|
||||
EXPECT_EQ(send_codec.width, filter1.last_render_width_);
|
||||
EXPECT_EQ(send_codec.height, filter1.last_render_height_);
|
||||
EXPECT_EQ(send_codec.width, filter2.last_render_width_);
|
||||
EXPECT_EQ(send_codec.height, filter2.last_render_height_);
|
||||
|
||||
// Delete the first channel and keep the second
|
||||
EXPECT_EQ(0, ViE.base->DeleteChannel(videoChannel1));
|
||||
ViETest::Log("Channel 1 deleted, "
|
||||
"you should only see video in Window 2");
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
// Create another channel
|
||||
int videoChannel3 = -1;
|
||||
EXPECT_EQ(0, ViE.base->CreateChannel(videoChannel3, videoChannel2));
|
||||
EXPECT_NE(videoChannel3, videoChannel2);
|
||||
|
||||
EXPECT_EQ(0, ViE.rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
videoChannel3, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
|
||||
// Prepare receive codecs
|
||||
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
|
||||
{
|
||||
EXPECT_EQ(0, ViE.codec->GetCodec(idx, videoCodec));
|
||||
EXPECT_EQ(0, ViE.codec->SetReceiveCodec(
|
||||
videoChannel3, videoCodec));
|
||||
}
|
||||
|
||||
ViEAutotestCodecObserver codecObserver3;
|
||||
EXPECT_EQ(0, ViE.codec->RegisterDecoderObserver(
|
||||
videoChannel3, codecObserver3));
|
||||
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
videoChannel3, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(videoChannel3));
|
||||
|
||||
unsigned short rtpPort3 = 14000;
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(videoChannel3, rtpPort3));
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
videoChannel3, "127.0.0.1", rtpPort3));
|
||||
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(videoChannel3));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(videoChannel3));
|
||||
|
||||
EXPECT_EQ(0, ViE.base->DeleteChannel(videoChannel2));
|
||||
|
||||
ViETest::Log("A third channel created and rendered in Window 1,\n"
|
||||
"channel 2 is deleted and you should only see video in Window 1");
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
EXPECT_EQ(0, ViE.base->DeleteChannel(videoChannel3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -269,6 +269,21 @@ int ViEBaseImpl::StartSend(const int video_channel) {
|
||||
shared_data_.SetLastError(kViEBaseInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Verify no other channel using the same encoder is sending.
|
||||
ChannelList channels;
|
||||
cs.ChannelsUsingViEEncoder(video_channel, &channels);
|
||||
for (ChannelList::iterator it = channels.begin(); it != channels.end();
|
||||
++it) {
|
||||
if ((*it)->Sending()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_.instance_id(), video_channel),
|
||||
"A channel using this encoder is already synding");
|
||||
shared_data_.SetLastError(kViEBaseAlreadySending);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
|
||||
if (!vie_encoder) {
|
||||
assert(false);
|
||||
|
@ -147,15 +147,7 @@ int ViEChannelManager::CreateChannel(int& channel_id, int original_channel) {
|
||||
return -1;
|
||||
}
|
||||
VideoCodec video_codec;
|
||||
if (vie_encoder->GetEncoder(video_codec) == 0) {
|
||||
if (video_codec.numberOfSimulcastStreams > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(engine_id_, original_channel),
|
||||
"%s: Can't share a simulcast encoder",
|
||||
__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
vie_encoder->GetEncoder(video_codec);
|
||||
|
||||
// Get a free id for the new channel.
|
||||
if (GetFreeChannelId(channel_id) == false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user