Add test for Cluster memory leak

Tests the scenario described in this CL:
https://chromium-review.googlesource.com/#/c/341251/

Change-Id: I4d732eebc11140691ed516321cf490905991720b
This commit is contained in:
Vignesh Venkatasubramanian 2016-04-29 11:32:48 -07:00
parent 26d673e737
commit cc62ecd23f

View File

@ -699,6 +699,26 @@ TEST_F(MuxerTest, AccurateClusterDurationTwoTracks) {
GetTestFilePath("accurate_cluster_duration_two_tracks.webm"), filename_));
}
TEST_F(MuxerTest, AccurateClusterDurationWithoutFinalizingCluster) {
EXPECT_TRUE(SegmentInit(false, true, false));
AddVideoTrack();
// Add a couple of frames and then bail out without finalizing the Segment
// (and thereby not finalizing the Cluster). The expectation here is that
// there shouldn't be any leaks. The test will fail under valgrind if there's
// a leak.
Frame video_frame;
video_frame.Init(dummy_data_, kFrameLength);
video_frame.set_track_number(kVideoTrackNumber);
video_frame.set_timestamp(0);
video_frame.set_is_key(true);
EXPECT_TRUE(segment_.AddGenericFrame(&video_frame));
video_frame.set_timestamp(33000000);
EXPECT_TRUE(segment_.AddGenericFrame(&video_frame));
CloseWriter();
}
TEST_F(MuxerTest, UseFixedSizeClusterTimecode) {
EXPECT_TRUE(SegmentInit(false, false, true));
AddVideoTrack();