Commit 22f6a543 authored by NzSN's avatar NzSN

Pass all unittests

parent df4f75b9
......@@ -101,6 +101,7 @@ public:
// FIXME: AVIOContext should be generated from proto
AVIOContext *ioctx = proto->to_avioctx();
ioctx->direct = false;
fmt = Utils::makeOutAVFormat(path, ioctx, ofmt);
}
......
......@@ -71,7 +71,6 @@ public:
[](void *priv, int64_t offset, int whence) -> int64_t {
return static_cast<T*>(priv)->seek_packet(priv, offset, whence);
});
io->direct = true;
}
return io;
......
......@@ -63,7 +63,6 @@ protected:
IOCtx::OutCtx oCtx { outFilePath };
};
#if 0
TEST_F(IOCTX_With_Default_Proto_Fixture, Description) {
AVPacket packet;
......@@ -88,19 +87,22 @@ TEST_F(IOCTX_With_Default_Proto_Fixture, Description) {
ASSERT_TRUE(Utils::isVideoValid(outFilePath));
}
#endif
TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
AVPacket *packet = av_packet_alloc();
for (int i = 0; i < 300; ++i) {
try {
while (true) {
iCtx.readFrame(packet);
outCtxCustom->writeFrame(packet);
av_packet_unref(packet);
}
outCtxCustom->closeCustomIO();
} catch (IOCtx::END_OF_FILE e) {
outCtxCustom->writeTrailer();
outCtxCustom->closeCustomIO();
}
std::cerr << "Data Size " << IOProto::TransientMemProto::dataSize << std::endl;
TrMemProto::TransientMemProto *inProto =
new TrMemProto::TransientMemProto(nullptr, IOProto::read);
......@@ -114,7 +116,7 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
throw std::runtime_error("Failed to init fixture");
oCtx.writeHeader();
int i = 0;
int init = false;
int timescale = 90000;
int fps = 30;
......@@ -128,12 +130,14 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
// Make sure all buffered datas is used
inCtxCustom->readFrame(packet);
if (i == 0) {
if (init == 0) {
packet->pts = 0;
packet->dts = -duration;
packet->duration = duration;
lastPTS = packet->pts;
lastDTS = packet->dts;
init = true;
} else {
packet->pts = lastPTS + duration;
packet->dts = lastDTS + duration;
......@@ -146,12 +150,9 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
oCtx.writeFrame(packet);
av_packet_unref(packet);
++i;
}
} catch (IOCtx::END_OF_FILE e) {}
printf("%d\n", i);
oCtx.writeTrailer();
inCtxCustom->closeCustomIO();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment