зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1332619 - Add gtest for skipped frames. r=jesup
MozReview-Commit-ID: G5BkNVayJOV --HG-- extra : rebase_source : 522a754f70bff7525c5f9e8fdc4343360783c356 extra : source : f06f4ff1d49007e0d6a2506f87df3c365f3a2c5f
This commit is contained in:
Родитель
c6a1810522
Коммит
12bae8d7f9
|
@ -429,6 +429,49 @@ TEST(VP8VideoTrackEncoder, NullFrameFirst)
|
|||
EXPECT_EQ(pointThree, totalDuration);
|
||||
}
|
||||
|
||||
// Test encoding a track that has to skip frames.
|
||||
TEST(VP8VideoTrackEncoder, SkippedFrames)
|
||||
{
|
||||
// Initiate VP8 encoder
|
||||
TestVP8TrackEncoder encoder;
|
||||
InitParam param = {true, 640, 480};
|
||||
encoder.TestInit(param);
|
||||
YUVBufferGenerator generator;
|
||||
generator.Init(mozilla::gfx::IntSize(640, 480));
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
VideoSegment segment;
|
||||
|
||||
// Pass 100 frames of the shortest possible duration where we don't get
|
||||
// rounding errors between input/output rate.
|
||||
for (uint32_t i = 0; i < 100; ++i) {
|
||||
segment.AppendFrame(generator.GenerateI420Image(),
|
||||
mozilla::StreamTime(9), // 0.1ms
|
||||
generator.GetSize(),
|
||||
PRINCIPAL_HANDLE_NONE,
|
||||
false,
|
||||
now + TimeDuration::FromMilliseconds(i * 0.1));
|
||||
}
|
||||
|
||||
encoder.SetCurrentFrames(segment);
|
||||
|
||||
// End the track.
|
||||
segment.Clear();
|
||||
encoder.NotifyQueuedTrackChanges(nullptr, 0, 0, TrackEventCommand::TRACK_EVENT_ENDED, segment);
|
||||
|
||||
EncodedFrameContainer container;
|
||||
ASSERT_TRUE(NS_SUCCEEDED(encoder.GetEncodedTrack(container)));
|
||||
|
||||
EXPECT_TRUE(encoder.IsEncodingComplete());
|
||||
|
||||
// Verify total duration being 100 * 0.1ms = 10ms.
|
||||
uint64_t totalDuration = 0;
|
||||
for (auto& frame : container.GetEncodedFrames()) {
|
||||
totalDuration += frame->GetDuration();
|
||||
}
|
||||
const uint64_t tenMillis = PR_USEC_PER_SEC / 100;
|
||||
EXPECT_EQ(tenMillis, totalDuration);
|
||||
}
|
||||
|
||||
// EOS test
|
||||
TEST(VP8VideoTrackEncoder, EncodeComplete)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче