Make sure the first frame isn't dropped.
If frames were delivered within the same millisecond as VideoCaptureImpl was created, or the timestamp weren't granular enough then the first frame would be mistakenly dropped because of having the same timestamp as a previous one, even though there was no previous one. BUG= R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2599004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5004 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
eb61a851d5
commit
e05362916c
@ -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()) {
|
||||
|
@ -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<EventWrapper> 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<test::FrameGenerator> 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user