Skip to content
Snippets Groups Projects
Commit 5d8d6252 authored by Mohamed Fenjiro's avatar Mohamed Fenjiro Committed by Philippe Gorley
Browse files

media_encoder: fixed unitTest


Change-Id: Ic5c7b37ee534b4e379c7b7ec363d459e85c024d8
Reviewed-by: default avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
parent 6f427399
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,6 @@ private: ...@@ -50,7 +50,6 @@ private:
std::unique_ptr<MediaEncoder> encoder_; std::unique_ptr<MediaEncoder> encoder_;
std::unique_ptr<MediaIOHandle> ioHandle_; std::unique_ptr<MediaIOHandle> ioHandle_;
std::vector<std::string> files_; std::vector<std::string> files_;
std::string cacheDir_;
}; };
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(MediaEncoderTest, MediaEncoderTest::name()); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(MediaEncoderTest, MediaEncoderTest::name());
...@@ -61,8 +60,7 @@ MediaEncoderTest::setUp() ...@@ -61,8 +60,7 @@ MediaEncoderTest::setUp()
DRing::init(DRing::InitFlag(DRing::DRING_FLAG_DEBUG | DRing::DRING_FLAG_CONSOLE_LOG)); DRing::init(DRing::InitFlag(DRing::DRING_FLAG_DEBUG | DRing::DRING_FLAG_CONSOLE_LOG));
libav_utils::ring_avcodec_init(); libav_utils::ring_avcodec_init();
encoder_.reset(new MediaEncoder); encoder_.reset(new MediaEncoder);
cacheDir_ = fileutils::get_cache_dir() + DIR_SEPARATOR_CH; files_.push_back("test.mkv");
files_.push_back(cacheDir_ + "test.mkv");
} }
void void
...@@ -70,7 +68,7 @@ MediaEncoderTest::tearDown() ...@@ -70,7 +68,7 @@ MediaEncoderTest::tearDown()
{ {
// clean up behind ourselves // clean up behind ourselves
for (const auto& file : files_) for (const auto& file : files_)
fileutils::remove(cacheDir_ + file); fileutils::remove(file);
DRing::fini(); DRing::fini();
} }
...@@ -164,8 +162,7 @@ MediaEncoderTest::testMultiStream() ...@@ -164,8 +162,7 @@ MediaEncoderTest::testMultiStream()
); );
try { try {
encoder_->openFileOutput(cacheDir_ + "test.mkv", options); encoder_->openFileOutput("test.mkv", options);
encoder_->setIOContext(ioHandle_);
int videoIdx = encoder_->addStream(*vp8Codec.get()); int videoIdx = encoder_->addStream(*vp8Codec.get());
CPPUNIT_ASSERT(videoIdx >= 0); CPPUNIT_ASSERT(videoIdx >= 0);
CPPUNIT_ASSERT(encoder_->getStreamCount() == 1); CPPUNIT_ASSERT(encoder_->getStreamCount() == 1);
...@@ -173,8 +170,8 @@ MediaEncoderTest::testMultiStream() ...@@ -173,8 +170,8 @@ MediaEncoderTest::testMultiStream()
CPPUNIT_ASSERT(audioIdx >= 0); CPPUNIT_ASSERT(audioIdx >= 0);
CPPUNIT_ASSERT(videoIdx != audioIdx); CPPUNIT_ASSERT(videoIdx != audioIdx);
CPPUNIT_ASSERT(encoder_->getStreamCount() == 2); CPPUNIT_ASSERT(encoder_->getStreamCount() == 2);
encoder_->setIOContext(ioHandle_);
encoder_->startIO(); encoder_->startIO();
int sentSamples = 0; int sentSamples = 0;
AVFrame* audio = nullptr; AVFrame* audio = nullptr;
AVFrame* video = nullptr; AVFrame* video = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment