diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc index f4abecb19..a23d22b3a 100644 --- a/webrtc/modules/video_capture/video_capture_impl.cc +++ b/webrtc/modules/video_capture/video_capture_impl.cc @@ -164,7 +164,7 @@ VideoCaptureImpl::VideoCaptureImpl(const int32_t id) _captureCallBack(NULL), _lastProcessFrameCount(TickTime::Now()), _rotateFrame(kRotateNone), - last_capture_time_(TickTime::MillisecondTimestamp()), + last_capture_time_(0), delta_ntp_internal_ms_( Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() - TickTime::MillisecondTimestamp()) { diff --git a/webrtc/video_engine/test/call_tests.cc b/webrtc/video_engine/test/call_tests.cc index 2fd25f368..207aaf4f5 100644 --- a/webrtc/video_engine/test/call_tests.cc +++ b/webrtc/video_engine/test/call_tests.cc @@ -13,6 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" +#include "webrtc/common_video/test/frame_generator.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" @@ -88,11 +89,13 @@ class CallTest : public ::testing::Test { void StartSending() { receive_stream_->StartReceive(); send_stream_->StartSend(); - frame_generator_capturer_->Start(); + if (frame_generator_capturer_.get() != NULL) + frame_generator_capturer_->Start(); } void StopSending() { - frame_generator_capturer_->Stop(); + if (frame_generator_capturer_.get() != NULL) + frame_generator_capturer_->Stop(); if (send_stream_ != NULL) send_stream_->StopSend(); if (receive_stream_ != NULL) @@ -285,6 +288,50 @@ TEST_F(CallTest, UsesTraceCallback) { receiver_call_.reset(); } +TEST_F(CallTest, TransmitsFirstFrame) { + class Renderer : public VideoRenderer { + public: + Renderer() : event_(EventWrapper::Create()) {} + + virtual void RenderFrame(const I420VideoFrame& video_frame, + int /*time_to_render_ms*/) OVERRIDE { + event_->Set(); + } + + EventTypeWrapper Wait() { return event_->Wait(kDefaultTimeoutMs); } + + scoped_ptr event_; + } renderer; + + test::DirectTransport sender_transport, receiver_transport; + + CreateCalls(Call::Config(&sender_transport), + Call::Config(&receiver_transport)); + + sender_transport.SetReceiver(receiver_call_->Receiver()); + receiver_transport.SetReceiver(sender_call_->Receiver()); + + CreateTestConfigs(); + receive_config_.renderer = &renderer; + + CreateStreams(); + StartSending(); + + scoped_ptr frame_generator(test::FrameGenerator::Create( + send_config_.codec.width, send_config_.codec.height)); + send_stream_->Input()->PutFrame(frame_generator->NextFrame(), 0); + + EXPECT_EQ(kEventSignaled, renderer.Wait()) + << "Timed out while waiting for the frame to render."; + + StopSending(); + + sender_transport.StopSending(); + receiver_transport.StopSending(); + + DestroyStreams(); +} + TEST_F(CallTest, ReceivesAndRetransmitsNack) { NackObserver observer;