Skip to content

Commit

Permalink
Add some demuxing and logging test. This exhausts the number of callb…
Browse files Browse the repository at this point in the history
…acks. Has to be fixed.
  • Loading branch information
ChristianFeldmann committed Apr 16, 2024
1 parent 0f6f6a0 commit bfaa3ab
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/ffmpegTest/ffmpegTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class LibrariesWithLogging

void loggingFunction(const LogLevel logLevel, const std::string &message)
{
std::cerr << "[ ] [" << to_string(logLevel) << "] " << message << "\n";
if (logLevel != LogLevel::Debug)
std::cerr << "[ ] [" << to_string(logLevel) << "] " << message << "\n";
this->logEntries.push_back({logLevel, message});
}

Expand Down Expand Up @@ -282,6 +283,24 @@ TEST(FFmpegTest, DemuxPackets)
EXPECT_EQ(packetCountVideo, 25);
}

TEST(FFmpegTest, DemuxPacketsAndCheckFFmpegCallbackLogs)
{
auto libsAndLogs = LibrariesWithLogging();

auto demuxer = libsAndLogs.openTestFileInDemuxer();
const auto formatContext = demuxer.getFormatContext();

while (auto packet = demuxer.getNextPacket())
{
EXPECT_TRUE(packet->getStreamIndex() == 0 || packet->getStreamIndex() == 1);
}

EXPECT_TRUE(libsAndLogs.containsLogEntry(
{LogLevel::Debug, "Got Packet with DTS -1024 PTS 0 Flags [Keyframe]"}));
EXPECT_TRUE(libsAndLogs.containsLogEntry({LogLevel::Debug, "Decoding VUI\n"}));
EXPECT_TRUE(libsAndLogs.containsLogEntry({LogLevel::Debug, "stream 0, sample 0, dts -23220\n"}));
}

TEST(FFmpegTest, DecodingTest)
{
auto libsAndLogs = LibrariesWithLogging();
Expand Down

0 comments on commit bfaa3ab

Please sign in to comment.