1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #738, use reader and seeker for mp4 demuxer to seek for general mp4(ftyp-mdat-moov).

This commit is contained in:
winlin 2017-02-03 22:49:19 +08:00
parent bbee16e4db
commit 9d21a8bb33
16 changed files with 237 additions and 101 deletions

View file

@ -131,7 +131,7 @@ void MockSrsFileReader::skip(int64_t _size)
offset += _size;
}
int64_t MockSrsFileReader::lseek(int64_t _offset)
int64_t MockSrsFileReader::seek2(int64_t _offset)
{
offset = (int)_offset;
return offset;
@ -163,6 +163,12 @@ int MockSrsFileReader::read(void* buf, size_t count, ssize_t* pnread)
return ret;
}
int MockSrsFileReader::lseek(off_t _offset, int /*whence*/, off_t* /*seeked*/)
{
offset = (int)_offset;
return ERROR_SUCCESS;
}
void MockSrsFileReader::mock_append_data(const char* _data, int _size)
{
int s = srs_min(MAX_MOCK_DATA_SIZE - offset, _size);
@ -952,10 +958,10 @@ VOID TEST(KernelFlvTest, FlvVSDecoderSeek)
fs.mock_append_data(tag_header, 11);
EXPECT_TRUE(11 == fs.offset);
EXPECT_TRUE(ERROR_SUCCESS == dec.lseek(0));
EXPECT_TRUE(ERROR_SUCCESS == dec.seek2(0));
EXPECT_TRUE(0 == fs.offset);
EXPECT_TRUE(ERROR_SUCCESS == dec.lseek(5));
EXPECT_TRUE(ERROR_SUCCESS == dec.seek2(5));
EXPECT_TRUE(5 == fs.offset);
}