Permitting double start/stopping of streams.
It doesn't make too much sense to hard enforce that the user keeps track of which streams are started and which are not. BUG= R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/6899004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5363 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a366e810a9
commit
f777cf2547
@ -30,6 +30,7 @@
|
||||
#include "webrtc/test/fake_encoder.h"
|
||||
#include "webrtc/test/frame_generator.h"
|
||||
#include "webrtc/test/frame_generator_capturer.h"
|
||||
#include "webrtc/test/null_transport.h"
|
||||
#include "webrtc/test/rtp_rtcp_observer.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/test/testsupport/perf_test.h"
|
||||
@ -271,6 +272,32 @@ TEST_F(CallTest, UsesTraceCallback) {
|
||||
receiver_call_.reset();
|
||||
}
|
||||
|
||||
TEST_F(CallTest, ReceiverCanBeStartedTwice) {
|
||||
test::NullTransport transport;
|
||||
CreateCalls(Call::Config(&transport), Call::Config(&transport));
|
||||
|
||||
CreateTestConfigs();
|
||||
CreateStreams();
|
||||
|
||||
receive_stream_->StartReceiving();
|
||||
receive_stream_->StartReceiving();
|
||||
|
||||
DestroyStreams();
|
||||
}
|
||||
|
||||
TEST_F(CallTest, ReceiverCanBeStoppedTwice) {
|
||||
test::NullTransport transport;
|
||||
CreateCalls(Call::Config(&transport), Call::Config(&transport));
|
||||
|
||||
CreateTestConfigs();
|
||||
CreateStreams();
|
||||
|
||||
receive_stream_->StopReceiving();
|
||||
receive_stream_->StopReceiving();
|
||||
|
||||
DestroyStreams();
|
||||
}
|
||||
|
||||
TEST_F(CallTest, RendersSingleDelayedFrame) {
|
||||
static const int kWidth = 320;
|
||||
static const int kHeight = 240;
|
||||
|
@ -259,17 +259,13 @@ void VideoSendStream::SwapFrame(I420VideoFrame* frame) {
|
||||
VideoSendStreamInput* VideoSendStream::Input() { return this; }
|
||||
|
||||
void VideoSendStream::StartSending() {
|
||||
if (video_engine_base_->StartSend(channel_) != 0)
|
||||
abort();
|
||||
if (video_engine_base_->StartReceive(channel_) != 0)
|
||||
abort();
|
||||
video_engine_base_->StartSend(channel_);
|
||||
video_engine_base_->StartReceive(channel_);
|
||||
}
|
||||
|
||||
void VideoSendStream::StopSending() {
|
||||
if (video_engine_base_->StopSend(channel_) != 0)
|
||||
abort();
|
||||
if (video_engine_base_->StopReceive(channel_) != 0)
|
||||
abort();
|
||||
video_engine_base_->StopSend(channel_);
|
||||
video_engine_base_->StopReceive(channel_);
|
||||
}
|
||||
|
||||
bool VideoSendStream::SetCodec(const VideoCodec& codec) {
|
||||
|
@ -193,6 +193,30 @@ void VideoSendStreamTest::SendsSetSsrcs(size_t num_ssrcs,
|
||||
call->DestroyVideoSendStream(send_stream_);
|
||||
}
|
||||
|
||||
TEST_F(VideoSendStreamTest, CanStartStartedStream) {
|
||||
test::NullTransport transport;
|
||||
Call::Config call_config(&transport);
|
||||
scoped_ptr<Call> call(Call::Create(call_config));
|
||||
|
||||
VideoSendStream::Config config = GetSendTestConfig(call.get(), 1);
|
||||
VideoSendStream* stream = call->CreateVideoSendStream(config);
|
||||
stream->StartSending();
|
||||
stream->StartSending();
|
||||
call->DestroyVideoSendStream(stream);
|
||||
}
|
||||
|
||||
TEST_F(VideoSendStreamTest, CanStopStoppedStream) {
|
||||
test::NullTransport transport;
|
||||
Call::Config call_config(&transport);
|
||||
scoped_ptr<Call> call(Call::Create(call_config));
|
||||
|
||||
VideoSendStream::Config config = GetSendTestConfig(call.get(), 1);
|
||||
VideoSendStream* stream = call->CreateVideoSendStream(config);
|
||||
stream->StopSending();
|
||||
stream->StopSending();
|
||||
call->DestroyVideoSendStream(stream);
|
||||
}
|
||||
|
||||
TEST_F(VideoSendStreamTest, SendsSetSsrc) { SendsSetSsrcs(1, false); }
|
||||
|
||||
TEST_F(VideoSendStreamTest, SendsSetSimulcastSsrcs) {
|
||||
|
Loading…
Reference in New Issue
Block a user