Decode unsynchronized ID3v2 frames efficiently.

It makes a great difference when decoding huge unsynchronized ID3v2 frames.
This commit is contained in:
Tsuda Kageyu
2016-02-18 03:07:38 +09:00
parent dadfe79799
commit a9acca5d81
3 changed files with 32 additions and 4 deletions

View File

@ -40,6 +40,7 @@ class TestID3v2SynchData : public CppUnit::TestFixture
CPPUNIT_TEST(testToUIntBrokenAndTooLarge);
CPPUNIT_TEST(testDecode1);
CPPUNIT_TEST(testDecode2);
CPPUNIT_TEST(testDecode3);
CPPUNIT_TEST_SUITE_END();
public:
@ -104,6 +105,14 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("\xff\x44", 2), a);
}
void testDecode3()
{
ByteVector a("\xff\xff\x00", 3);
a = ID3v2::SynchData::decode(a);
CPPUNIT_ASSERT_EQUAL((unsigned int)2, a.size());
CPPUNIT_ASSERT_EQUAL(ByteVector("\xff\xff", 2), a);
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestID3v2SynchData);