1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "demuxer_plugin_unit_test.h"
17 #include "demuxer_plugin_manager.h"
18 #include "stream_demuxer.h"
19 #include "common/media_source.h"
20 #include "buffer/avbuffer.h"
21 #include "plugin/plugin_manager_v2.h"
22 #include <fcntl.h>
23 #include <fstream>
24 #include <gtest/gtest.h>
25 #include "media_description.h"
26 #include "file_server_demo.h"
27 #include <numeric>
28 #include <vector>
29
30 using namespace OHOS;
31 using namespace OHOS::Media;
32 using namespace testing::ext;
33 using namespace std;
34 using MediaAVBuffer = OHOS::Media::AVBuffer;
35 using FFmpegAVBuffer = ::AVBuffer;
36 using InvokerTypeAlias = OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin::InvokerType;
37 using namespace OHOS::MediaAVCodec;
38 using namespace OHOS::Media::Plugins;
39
40 list<SeekMode> seekModes = {SeekMode::SEEK_NEXT_SYNC, SeekMode::SEEK_PREVIOUS_SYNC,
41 SeekMode::SEEK_CLOSEST_SYNC};
42 const int32_t DEFAULT_TIMEOUT = 100; // 100ms
43 unique_ptr<FileServerDemo> server = nullptr;
44 static const string TEST_URI_PATH = "http://127.0.0.1:46666/";
45 static const string TEST_RELATIVE_PATH = "/data/test/media/";
46 const std::string HEVC_LIB_PATH = std::string(AV_CODEC_PATH) + "/libav_codec_hevc_parser.z.so";
47 // FLV
48 string g_flvPath = string("/data/test/media/h264.flv");
49 // MP4
50 string g_mp4Path1 = string("/data/test/media/h264_double_video_audio.mp4");
51 string g_mp4Path2 = string("/data/test/media/avcc_aac_mp3.mp4");
52 string g_mp4Path3 = string("/data/test/media/MPEG4.mp4");
53 string g_mp4Path4 = string("/data/test/media/muxer_auxl_265.mp4");
54 string g_mp4Path5 = string("/data/test/media/muxer_auxl_265_264_aac.mp4");
55 // FMP4
56 string g_fmp4Path1 = string("/data/test/media/h264_fmp4.mp4");
57 string g_fmp4Path2 = string("/data/test/media/h265_fmp4.mp4");
58 // MOV
59 string g_movPath1 = string("/data/test/media/265_pcm_s16le.mov");
60 string g_movPath2 = string("/data/test/media/h264_aac.mov");
61 string g_movPath3 = string("/data/test/media/h264_mp3.mov");
62 string g_movPath4 = string("/data/test/media/h264_vorbis.mov");
63 string g_movPath5 = string("/data/test/media/MPEG4_mp2.mov");
64 // MKV
65 string g_mkvPath1 = string("/data/test/media/h264_mp3_4sec.mkv");
66 string g_mkvPath2 = string("/data/test/media/h265_aac_4sec.mkv");
67 string g_mkvPath3 = string("/data/test/media/h265_opus_4sec.mkv");
68 // MPEG-TS
69 string g_mpegTsPath1 = string("/data/test/media/2obj_44100Hz_16bit_32k.ts");
70 string g_mpegTsPath2 = string("/data/test/media/hevc_aac_1920x1080_g30_30fps.ts");
71 string g_mpegTsPath3 = string("/data/test/media/h264_ac3.mts");
72 string g_mpegTsPath4 = string("/data/test/media/test_mpeg2_Gop25_4sec.ts");
73 string g_mpegTsPath5 = string("/data/test/media/test_mpeg4_Gop25_4sec.ts");
74 string g_mpegTsPath6 = string("/data/test/media/hevc_aac_3840x2160_30frames.ts");
75 // AVI
76 string g_aviPath1 = string("/data/test/media/h264_aac.avi");
77 string g_aviPath2 = string("/data/test/media/h264_mp3.avi");
78 string g_aviPath3 = string("/data/test/media/mpeg4_pcm.avi");
79 string g_aviPath4 = string("/data/test/media/test_263_aac_B_Gop25_4sec_cover.avi");
80 string g_aviPath5 = string("/data/test/media/test_mpeg4_mp3_B_Gop25_4sec_cover.avi");
81 string g_aviPath6 = string("/data/test/media/test_mpeg2_mp2_B_Gop25_4sec_cover.avi");
82 // MPG
83 string g_mpgPath1 = string("/data/test/media/mpeg_mpeg2_mp2.mpeg");
84 string g_mpgPath2 = string("/data/test/media/mpeg_mpeg2_mp3.mpeg");
85 string g_mpgPath3 = string("/data/test/media/mpeg_h264_mp2.mpeg");
86 // SRT
87 string g_srtPath1 = string("/data/test/media/subtitle.srt");
88 // VTT
89 string g_vttPath1 = string("/data/test/media/webvtt_test.vtt");
90
SetUpTestCase(void)91 void DemuxerPluginUnitTest::SetUpTestCase(void)
92 {
93 if (server != nullptr) {
94 server->StopServer();
95 server.reset();
96 }
97 server = make_unique<FileServerDemo>();
98 server->StartServer();
99 cout << "start" << endl;
100 }
101
TearDownTestCase(void)102 void DemuxerPluginUnitTest::TearDownTestCase(void)
103 {
104 if (server == nullptr) {
105 return;
106 }
107 server->StopServer();
108 }
109
SetUp(void)110 void DemuxerPluginUnitTest::SetUp(void) {}
111
TearDown(void)112 void DemuxerPluginUnitTest::TearDown(void)
113 {
114 if (fd_ > 0) {
115 close(fd_);
116 fd_ = -1;
117 }
118 if (initStatus_) {
119 initStatus_ = false;
120 }
121 if (demuxerPlugin_ != nullptr) {
122 demuxerPlugin_->Reset();
123 demuxerPlugin_ = nullptr;
124 }
125 }
126
InitResourceURI(const std::string & filePath,std::string pluginName)127 void DemuxerPluginUnitTest::InitResourceURI(const std::string &filePath, std::string pluginName)
128 {
129 std::string uri = TEST_URI_PATH + filePath.substr(TEST_RELATIVE_PATH.size());
130 std::shared_ptr<MediaSource> mediaSource = std::make_shared<MediaSource>(uri);
131 std::shared_ptr<StreamDemuxer> streamDemuxer = std::make_shared<StreamDemuxer>();
132 std::shared_ptr<Source> source = std::make_shared<Source>();
133 source->SetSource(mediaSource);
134 streamDemuxer->SetSource(source);
135 streamDemuxer->SetSourceType(mediaSource->GetSourceType());
136 streamDemuxer->Init(uri);
137 streamDemuxer->SetDemuxerState(0, DemuxerState::DEMUXER_STATE_PARSE_FRAME);
138 auto dataSource = std::make_shared<DataSourceImpl>(streamDemuxer, 0);
139 auto basePlugin = Plugins::PluginManagerV2::Instance().CreatePluginByName(pluginName);
140 demuxerPlugin_ = std::reinterpret_pointer_cast<OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin>(basePlugin);
141 ASSERT_EQ(demuxerPlugin_->SetDataSource(dataSource), Status::OK);
142 ASSERT_EQ(demuxerPlugin_->GetMediaInfo(mediaInfo_), Status::OK);
143 initStatus_ = true;
144 }
145
InitWeakNetworkDemuxerPluginURI(const std::string & filePath,std::string pluginName,int64_t failOffset,size_t maxFailCount)146 void DemuxerPluginUnitTest::InitWeakNetworkDemuxerPluginURI(
147 const std::string& filePath, std::string pluginName, int64_t failOffset, size_t maxFailCount)
148 {
149 std::string uri = TEST_URI_PATH + filePath.substr(TEST_RELATIVE_PATH.size());
150 printf("DemuxerPluginUnitTest::InitWeakNetworkDemuxerPluginURI, uri: %s\n", uri.c_str());
151 std::shared_ptr<DemuxerPluginManager> demuxerPluginManager = std::make_shared<DemuxerPluginManager>();
152 SourceCallback cb = SourceCallback(demuxerPluginManager);
153 std::shared_ptr<Source> source = std::make_shared<Source>();
154 source->SetCallback(&cb);
155 EXPECT_EQ(source->SetSource(std::make_shared<MediaSource>(uri)), Status::OK);
156 std::vector<StreamInfo> streams;
157 source->GetStreamInfo(streams);
158 demuxerPluginManager->InitDefaultPlay(streams);
159 std::shared_ptr<BaseStreamDemuxer> streamDemuxer =
160 std::make_shared<StreamDemuxerPullDataFailMock>(failOffset, maxFailCount);
161 streamDemuxer->SetInterruptState(false);
162 streamDemuxer->SetSource(source);
163 streamDemuxer->Init("");
164 streamDemuxer->SetDemuxerState(0, DemuxerState::DEMUXER_STATE_PARSE_FRAME);
165 auto dataSource = std::make_shared<DataSourceImpl>(streamDemuxer, 0);
166 auto basePlugin = Plugins::PluginManagerV2::Instance().CreatePluginByName(pluginName);
167 demuxerPlugin_ = std::reinterpret_pointer_cast<OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin>(basePlugin);
168 ASSERT_EQ(demuxerPlugin_->SetDataSource(dataSource), Status::OK);
169 ASSERT_EQ(demuxerPlugin_->GetMediaInfo(mediaInfo_), Status::OK);
170 initStatus_ = true;
171 }
172
InitResource(const std::string & filePath,std::string pluginName)173 void DemuxerPluginUnitTest::InitResource(const std::string &filePath, std::string pluginName)
174 {
175 struct stat fileStatus {};
176 if (stat(filePath.c_str(), &fileStatus) != 0) {
177 printf("Failed to get file status for path: %s\n", filePath.c_str());
178 return;
179 }
180 int64_t fileSize = static_cast<int64_t>(fileStatus.st_size);
181 int fd = open(filePath.c_str(), O_RDONLY);
182 if (fd < 0) {
183 printf("Failed to open file: %s\n", filePath.c_str());
184 return;
185 }
186 auto uri = "fd://" + std::to_string(fd) + "?offset=0&size=" + std::to_string(fileSize);
187 std::shared_ptr<MediaSource> mediaSource = std::make_shared<MediaSource>(uri);
188 std::shared_ptr<StreamDemuxer> streamDemuxer = std::make_shared<StreamDemuxer>();
189 std::shared_ptr<Source> source = std::make_shared<Source>();
190 source->SetSource(mediaSource);
191 streamDemuxer->SetSource(source);
192 streamDemuxer->SetSourceType(mediaSource->GetSourceType());
193 streamDemuxer->Init(uri);
194 streamDemuxer->SetDemuxerState(0, DemuxerState::DEMUXER_STATE_PARSE_FRAME);
195 auto dataSource = std::make_shared<DataSourceImpl>(streamDemuxer, 0);
196 auto basePlugin = Plugins::PluginManagerV2::Instance().CreatePluginByName(pluginName);
197 demuxerPlugin_ = std::reinterpret_pointer_cast<OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin>(basePlugin);
198 ASSERT_EQ(demuxerPlugin_->SetDataSource(dataSource), Status::OK);
199 ASSERT_EQ(demuxerPlugin_->GetMediaInfo(mediaInfo_), Status::OK);
200 initStatus_ = true;
201 }
202
InitWeakNetworkDemuxerPlugin(const std::string & filePath,std::string pluginName,int64_t failOffset,size_t maxFailCount)203 void DemuxerPluginUnitTest::InitWeakNetworkDemuxerPlugin(
204 const std::string& filePath, std::string pluginName, int64_t failOffset, size_t maxFailCount)
205 {
206 struct stat fileStatus {};
207 if (stat(filePath.c_str(), &fileStatus) != 0) {
208 printf("Failed to get file status for path: %s\n", filePath.c_str());
209 return;
210 }
211 int64_t fileSize = static_cast<int64_t>(fileStatus.st_size);
212 int fd = open(filePath.c_str(), O_RDONLY);
213 if (fd < 0) {
214 printf("Failed to open file: %s\n", filePath.c_str());
215 return;
216 }
217 auto uri = "fd://" + std::to_string(fd) + "?offset=0&size=" + std::to_string(fileSize);
218 std::shared_ptr<DemuxerPluginManager> demuxerPluginManager = std::make_shared<DemuxerPluginManager>();
219 SourceCallback cb = SourceCallback(demuxerPluginManager);
220 std::shared_ptr<Source> source = std::make_shared<Source>();
221 source->SetCallback(&cb);
222 EXPECT_EQ(source->SetSource(std::make_shared<MediaSource>(uri)), Status::OK);
223 std::vector<StreamInfo> streams;
224 source->GetStreamInfo(streams);
225 demuxerPluginManager->InitDefaultPlay(streams);
226 std::shared_ptr<BaseStreamDemuxer> streamDemuxer =
227 std::make_shared<StreamDemuxerPullDataFailMock>(failOffset, maxFailCount);
228 streamDemuxer->SetInterruptState(false);
229 streamDemuxer->SetSource(source);
230 streamDemuxer->Init("");
231 streamDemuxer->SetDemuxerState(0, DemuxerState::DEMUXER_STATE_PARSE_FRAME);
232 auto dataSource = std::make_shared<DataSourceImpl>(streamDemuxer, 0);
233 auto basePlugin = Plugins::PluginManagerV2::Instance().CreatePluginByName(pluginName);
234 demuxerPlugin_ = std::reinterpret_pointer_cast<OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin>(basePlugin);
235 ASSERT_EQ(demuxerPlugin_->SetDataSource(dataSource), Status::OK);
236 ASSERT_EQ(demuxerPlugin_->GetMediaInfo(mediaInfo_), Status::OK);
237 initStatus_ = true;
238 }
239
SetInitValue()240 void DemuxerPluginUnitTest::SetInitValue()
241 {
242 for (int i = 0; i < mediaInfo_.tracks.size(); i++) {
243 string codecMime = "";
244 OHOS::Media::Plugins::MediaType trackType = OHOS::Media::Plugins::MediaType::UNKNOWN;
245 Meta &format = mediaInfo_.tracks[i];
246 std::vector<TagType> keys;
247 ASSERT_TRUE(format.GetData(Tag::MIME_TYPE, codecMime));
248 ASSERT_TRUE(format.GetData(Tag::MEDIA_TYPE, trackType));
249 if (trackType == OHOS::Media::Plugins::MediaType::VIDEO) {
250 ASSERT_TRUE(format.GetData(Tag::VIDEO_WIDTH, videoWidth_));
251 ASSERT_TRUE(format.GetData(Tag::VIDEO_HEIGHT, videoHeight_));
252 }
253 if (codecMime.find("image/") != std::string::npos) {
254 continue;
255 }
256 if (trackType == OHOS::Media::Plugins::MediaType::VIDEO ||
257 trackType == OHOS::Media::Plugins::MediaType::AUDIO ||
258 trackType == OHOS::Media::Plugins::MediaType::SUBTITLE ||
259 trackType == OHOS::Media::Plugins::MediaType::TIMEDMETA) {
260 frames_[i] = 0;
261 keyFrames_[i] = 0;
262 eosFlag_[i] = false;
263 }
264 }
265 }
266
isEOS(map<uint32_t,bool> & countFlag)267 bool DemuxerPluginUnitTest::isEOS(map<uint32_t, bool>& countFlag)
268 {
269 for (auto iter = countFlag.begin(); iter != countFlag.end(); ++iter) {
270 if (!iter->second) {
271 return false;
272 }
273 }
274 return true;
275 }
276
CheckKeyFrameIndex(std::vector<uint32_t> keyFrameIndexList,const uint32_t frameIndex,const bool isKeyFrame)277 bool DemuxerPluginUnitTest::CheckKeyFrameIndex(
278 std::vector<uint32_t> keyFrameIndexList, const uint32_t frameIndex, const bool isKeyFrame)
279 {
280 bool contaionIndex = (std::count(keyFrameIndexList.begin(), keyFrameIndexList.end(), frameIndex) > 0);
281 return isKeyFrame ? contaionIndex : !contaionIndex;
282 }
283
SetEosValue()284 void DemuxerPluginUnitTest::SetEosValue()
285 {
286 for (int i = 0; i < nbStreams_; i++) {
287 eosFlag_[i] = true;
288 }
289 }
290
CountFrames(uint32_t index)291 void DemuxerPluginUnitTest::CountFrames(uint32_t index)
292 {
293 if (flag_ & AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_EOS) {
294 eosFlag_[index] = true;
295 return;
296 }
297 if (flag_ & AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_SYNC_FRAME) {
298 keyFrames_[index]++;
299 frames_[index]++;
300 } else if ((flag_ & AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_NONE) == AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_NONE) {
301 frames_[index]++;
302 } else {
303 SetEosValue();
304 printf("flag is unknown, read sample break");
305 }
306 }
307
ReadData()308 void DemuxerPluginUnitTest::ReadData()
309 {
310 SetInitValue();
311 AVBufferWrapper buffer(videoHeight_ * videoWidth_ * 3); // 3 is use for buffer allocate
312 while (!isEOS(eosFlag_)) {
313 for (uint32_t i = 0; i < mediaInfo_.tracks.size(); ++i) {
314 auto ret = demuxerPlugin_->ReadSample(i, buffer.mediaAVBuffer, 100);
315 ASSERT_TRUE(ret == Status::OK || ret == Status::END_OF_STREAM || ret == Status::NO_ERROR);
316 flag_ = buffer.mediaAVBuffer->flag_;
317 CountFrames(i);
318 }
319 }
320 }
321
RemoveValue()322 void DemuxerPluginUnitTest::RemoveValue()
323 {
324 if (!frames_.empty()) {
325 frames_.clear();
326 }
327 if (!keyFrames_.empty()) {
328 keyFrames_.clear();
329 }
330 if (!eosFlag_.empty()) {
331 eosFlag_.clear();
332 }
333 }
334
CheckAllFrames(const std::vector<int> & expectedFrames,const std::vector<int> & expectedKeyFrames,const std::vector<uint32_t> & keyFrameIndex)335 void DemuxerPluginUnitTest::CheckAllFrames(const std::vector<int>& expectedFrames,
336 const std::vector<int>& expectedKeyFrames, const std::vector<uint32_t>& keyFrameIndex)
337 {
338 for (uint32_t i = 0; i < mediaInfo_.tracks.size(); ++i) {
339 std::string mime;
340 mediaInfo_.tracks[i].GetData(Tag::MIME_TYPE, mime);
341 if (mime.find("video/") == 0 || mime.find("audio/") == 0 ||
342 mime.find("application/") == 0 || mime.find("text/vtt") == 0) {
343 demuxerPlugin_->SelectTrack(i);
344 selectedTrackIds_.push_back(i);
345 frames_[i] = 0;
346 keyFrames_[i] = 0;
347 eosFlag_[i] = false;
348 }
349 }
350 SetInitValue();
351 OHOS::Media::AVBufferWrapper buffer(videoHeight_ * videoWidth_ * 3); // 3 is use for buffer allocate
352 while (!isEOS(eosFlag_)) {
353 for (auto id : selectedTrackIds_) {
354 auto ret = demuxerPlugin_->ReadSample(id, buffer.mediaAVBuffer, DEFAULT_TIMEOUT);
355 while (ret == Status::ERROR_WAIT_TIMEOUT) {
356 ret = demuxerPlugin_->ReadSample(id, buffer.mediaAVBuffer, DEFAULT_TIMEOUT);
357 }
358 ASSERT_TRUE(ret == Status::OK || ret == Status::END_OF_STREAM || ret == Status::NO_ERROR);
359 flag_ = buffer.mediaAVBuffer->flag_;
360 if (id == 0) {
361 EXPECT_TRUE(CheckKeyFrameIndex(
362 keyFrameIndex, frames_[0], flag_ & AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_SYNC_FRAME));
363 }
364 CountFrames(id);
365 }
366 }
367 for (size_t i = 0; i < expectedFrames.size(); ++i) {
368 EXPECT_EQ(frames_[i], expectedFrames[i]);
369 EXPECT_EQ(keyFrames_[i], expectedKeyFrames[i]);
370 }
371 }
372
373 /**
374 * @tc.name: Demuxer_SelectTrack_0001
375 * @tc.desc: Test SelectTrack
376 * @tc.type: FUNC
377 */
378 HWTEST_F(DemuxerPluginUnitTest, Demuxer_SelectTrack_0001, TestSize.Level1)
379 {
380 std::string pluginName = "avdemux_flv";
381 InitResource(g_flvPath, pluginName);
382 ASSERT_TRUE(initStatus_);
383 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
384 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
385 ASSERT_NE(demuxerPlugin_->SelectTrack(2), Status::OK);
386 }
387
388 /**
389 * @tc.name: Demuxer_ErrorSelectTrack_0001
390 * @tc.desc: Test SelectTrack without initialization
391 * @tc.type: FUNC
392 */
393 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorSelectTrack_0001, TestSize.Level1)
394 {
395 string pluginName = "avdemux_flv";
396 auto basePlugin = Plugins::PluginManagerV2::Instance().CreatePluginByName(pluginName);
397 demuxerPlugin_ = std::reinterpret_pointer_cast<OHOS::Media::Plugins::Ffmpeg::FFmpegDemuxerPlugin>(basePlugin);
398 ASSERT_NE(demuxerPlugin_->SelectTrack(0), Status::OK);
399 ASSERT_NE(demuxerPlugin_->SelectTrack(1), Status::OK);
400 ASSERT_NE(demuxerPlugin_->SelectTrack(2), Status::OK);
401 }
402
403 /**
404 * @tc.name: Demuxer_ErrorSelectTrack_0002
405 * @tc.desc: Test SelectTrack after repeated initialization
406 * @tc.type: FUNC
407 */
408 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorSelectTrack_0002, TestSize.Level1)
409 {
410 std::string pluginName = "avdemux_flv";
411 InitResource(g_flvPath, pluginName);
412 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
413 InitResource(g_flvPath, pluginName);
414 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
415 InitResource(g_flvPath, pluginName);
416 ASSERT_NE(demuxerPlugin_->SelectTrack(2), Status::OK);
417 }
418
419 /**
420 * @tc.name: Demuxer_ErrorSelectTrack_0003
421 * @tc.desc: Test SelectTrack with invalid parameter
422 * @tc.type: FUNC
423 */
424 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorSelectTrack_0003, TestSize.Level1)
425 {
426 std::string pluginName = "avdemux_flv";
427 InitResource(g_flvPath, pluginName);
428 ASSERT_TRUE(initStatus_);
429 ASSERT_NE(demuxerPlugin_->SelectTrack(-1), Status::OK);
430 }
431
432 /**
433 * @tc.name: Demuxer_UnSelectTrack_0001
434 * @tc.desc: Test UnselectTrack
435 * @tc.type: FUNC
436 */
437 HWTEST_F(DemuxerPluginUnitTest, Demuxer_UnSelectTrack_0001, TestSize.Level1)
438 {
439 std::string pluginName = "avdemux_flv";
440 InitResource(g_flvPath, pluginName);
441 ASSERT_TRUE(initStatus_);
442 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
443 ASSERT_NE(demuxerPlugin_->SelectTrack(3), Status::OK);
444 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
445 ASSERT_NE(demuxerPlugin_->SelectTrack(-1), Status::OK);
446 ASSERT_EQ(demuxerPlugin_->UnselectTrack(0), Status::OK);
447 ASSERT_EQ(demuxerPlugin_->UnselectTrack(1), Status::OK);
448 ASSERT_EQ(demuxerPlugin_->UnselectTrack(3), Status::OK);
449 ASSERT_EQ(demuxerPlugin_->UnselectTrack(-1), Status::OK);
450 }
451
452 /**
453 * @tc.name: Demuxer_ReadSample_0001
454 * @tc.desc: Test ReadSample with valid buffer
455 * @tc.type: FUNC
456 */
457 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0001, TestSize.Level1)
458 {
459 std::string pluginName = "avdemux_flv";
460 InitResource(g_flvPath, pluginName);
461 ASSERT_TRUE(initStatus_);
462 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
463 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
464 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
465 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
466 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
467 }
468
469 /**
470 * @tc.name: Demuxer_BoostReadThreadPriority_0001
471 * @tc.desc: Test BoostReadThreadPriority
472 * @tc.type: FUNC
473 */
474 HWTEST_F(DemuxerPluginUnitTest, Demuxer_BoostReadThreadPriority_0001, TestSize.Level1)
475 {
476 std::string pluginName = "avdemux_flv";
477 InitResource(g_flvPath, pluginName);
478 ASSERT_TRUE(initStatus_);
479 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
480 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
481 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
482 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
483 ASSERT_EQ(demuxerPlugin_->BoostReadThreadPriority(), Status::OK);
484 ASSERT_EQ(demuxerPlugin_->BoostReadThreadPriority(), Status::ERROR_WRONG_STATE);
485 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
486 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
487 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
488 ASSERT_EQ(demuxerPlugin_->BoostReadThreadPriority(), Status::ERROR_WRONG_STATE);
489 }
490
491 /**
492 * @tc.name: Demuxer_BoostReadThreadPriority_0002
493 * @tc.desc: Test BoostReadThreadPriority
494 * @tc.type: FUNC
495 */
496 HWTEST_F(DemuxerPluginUnitTest, Demuxer_BoostReadThreadPriority_0002, TestSize.Level1)
497 {
498 std::string pluginName = "avdemux_flv";
499 InitResource(g_flvPath, pluginName);
500 ASSERT_TRUE(initStatus_);
501 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
502 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
503 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
504 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
505 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
506 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
507 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
508 ASSERT_EQ(demuxerPlugin_->BoostReadThreadPriority(), Status::ERROR_WRONG_STATE);
509 }
510
511 /**
512 * @tc.name: Demuxer_ErrorReadSample_0001
513 * @tc.desc: Test ReadSample with null buffer
514 * @tc.type: FUNC
515 */
516 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorReadSample_0001, TestSize.Level1)
517 {
518 std::string pluginName = "avdemux_flv";
519 InitResource(g_flvPath, pluginName);
520 ASSERT_TRUE(initStatus_);
521 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
522 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
523 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
524 std::shared_ptr<MediaAVBuffer> mediaAVBuffer = nullptr;
525 ASSERT_NE(demuxerPlugin_->ReadSample(0, mediaAVBuffer, 100), Status::OK);
526 }
527
528 /**
529 * @tc.name: Demuxer_ErrorReadSample_0002
530 * @tc.desc: Test ReadSample after reset and re-select
531 * @tc.type: FUNC
532 */
533 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorReadSample_0002, TestSize.Level1)
534 {
535 std::string pluginName = "avdemux_flv";
536 InitResource(g_flvPath, pluginName);
537 ASSERT_TRUE(initStatus_);
538 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
539 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
540 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
541 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
542 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
543 ASSERT_EQ(demuxerPlugin_->Reset(), Status::OK);
544 ASSERT_NE(demuxerPlugin_->SelectTrack(0), Status::OK);
545 ASSERT_NE(demuxerPlugin_->SelectTrack(1), Status::OK);
546 OHOS::Media::AVBufferWrapper buffer1(DEFAULT_BUFFSIZE);
547 ASSERT_NE(demuxerPlugin_->ReadSample(0, buffer1.mediaAVBuffer, 100), Status::OK);
548 }
549
550 /**
551 * @tc.name: Demuxer_ReadSample_0002
552 * @tc.desc: Test ReadSample with GetNextSampleSize
553 * @tc.type: FUNC
554 */
555 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0002, TestSize.Level1)
556 {
557 std::string pluginName = "avdemux_flv";
558 InitResource(g_flvPath, pluginName);
559 ASSERT_TRUE(initStatus_);
560 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
561 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
562 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
563 int32_t size = 0;
564 demuxerPlugin_->GetNextSampleSize(0, size, 100);
565 // Used to cover thread existence checks
566 demuxerPlugin_->GetNextSampleSize(0, size, 100);
567 AVBufferWrapper buffer(size);
568 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
569 }
570
571 /**
572 * @tc.name: Demuxer_ReadSample_0003
573 * @tc.desc: Copy current sample to buffer (flv)
574 * @tc.type: FUNC
575 */
576 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0003, TestSize.Level1)
577 {
578 std::string pluginName = "avdemux_flv";
579 std::string filePath = g_flvPath;
580 InitResource(filePath, pluginName);
581 ASSERT_TRUE(initStatus_);
582 CheckAllFrames({76, 113}, {1, 113}, {0});
583 }
584
585 /**
586 * @tc.name: Demuxer_ReadSample_0004
587 * @tc.desc: Copy current sample to buffer (flv) without timeout
588 * @tc.type: FUNC
589 */
590 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0004, TestSize.Level1)
591 {
592 std::string pluginName = "avdemux_flv";
593 InitResource(g_flvPath, pluginName);
594 ASSERT_TRUE(initStatus_);
595 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
596 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
597 SetInitValue();
598 OHOS::Media::AVBufferWrapper buffer(videoHeight_ * videoWidth_ * 3);
599 std::vector<uint32_t> keyFrameIndex = {0};
600 while (!isEOS(eosFlag_)) {
601 for (uint32_t i = 0; i < mediaInfo_.tracks.size(); ++i) {
602 auto ret = demuxerPlugin_->ReadSample(i, buffer.mediaAVBuffer);
603 ASSERT_TRUE(ret == Status::OK || ret == Status::END_OF_STREAM || ret == Status::NO_ERROR);
604 flag_ = buffer.mediaAVBuffer->flag_;
605 if (i == 0) {
606 ASSERT_TRUE(CheckKeyFrameIndex(
607 keyFrameIndex, frames_[0], flag_ & AVCodecBufferFlag::AVCODEC_BUFFER_FLAG_SYNC_FRAME));
608 }
609 CountFrames(i);
610 }
611 }
612 printf("frames_[0]=%d | kFrames[0]=%d\n", frames_[0], keyFrames_[0]);
613 printf("frames_[1]=%d | kFrames[1]=%d\n", frames_[1], keyFrames_[1]);
614 ASSERT_EQ(frames_[0], 76);
615 ASSERT_EQ(frames_[1], 113);
616 ASSERT_EQ(keyFrames_[0], 1);
617 ASSERT_EQ(keyFrames_[1], 113);
618 }
619
620 /**
621 * @tc.name: Demuxer_ReadSample_0005
622 * @tc.desc: Test ReadSample with and without timeout
623 * @tc.type: FUNC
624 */
625 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0005, TestSize.Level1)
626 {
627 std::string pluginName = "avdemux_flv";
628 InitResource(g_flvPath, pluginName);
629 ASSERT_TRUE(initStatus_);
630 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
631 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
632 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
633 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
634 ASSERT_NE(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer), Status::OK);
635 }
636
637 /**
638 * @tc.name: Demuxer_ReadSample_0006
639 * @tc.desc: Test ReadSample with and without timeout (reverse order)
640 * @tc.type: FUNC
641 */
642 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_0006, TestSize.Level1)
643 {
644 std::string pluginName = "avdemux_flv";
645 InitResource(g_flvPath, pluginName);
646 ASSERT_TRUE(initStatus_);
647 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
648 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
649 OHOS::Media::AVBufferWrapper buffer(DEFAULT_BUFFSIZE);
650 ASSERT_EQ(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer), Status::OK);
651 ASSERT_NE(demuxerPlugin_->ReadSample(0, buffer.mediaAVBuffer, 100), Status::OK);
652 }
653
654 /**
655 * @tc.name: Demuxer_SeekToTime_0001
656 * @tc.desc: Seek to the specified time (h264 flv local)
657 * @tc.type: FUNC
658 */
659 HWTEST_F(DemuxerPluginUnitTest, Demuxer_SeekToTime_0001, TestSize.Level1)
660 {
661 std::string pluginName = "avdemux_flv";
662 InitResource(g_flvPath, pluginName);
663 ASSERT_TRUE(initStatus_);
664 SetInitValue();
665 for (uint32_t idx = 0; idx < mediaInfo_.tracks.size(); ++idx) {
666 ASSERT_EQ(demuxerPlugin_->SelectTrack(idx), Status::OK);
667 }
668 int64_t seekTime = 0;
669 list<int64_t> toPtsList = {0, 1500, 1000, 1740, 1970, 2100}; // ms
670 vector<int32_t> videoVals = {76, 76, 76, 0, 76, 0, 0, 76, 76, 0, 76, 0, 0, 76, 0, 0, 76, 0};
671 vector<int32_t> audioVals = {107, 107, 107, 0, 107, 0, 0, 107, 107, 0, 107, 0, 0, 107, 0, 0, 107, 0};
672 OHOS::Media::AVBufferWrapper buffer(videoHeight_ * videoWidth_ * 3);
673 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
674 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
675 Status ret_ = demuxerPlugin_->SeekTo(-1, *toPts, *mode, seekTime);
676 if (ret_ != Status::OK) {
677 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
678 continue;
679 }
680 ReadData();
681 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
682 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
683 ASSERT_EQ(frames_[0], videoVals[numbers_]);
684 ASSERT_EQ(frames_[1], audioVals[numbers_]);
685 numbers_ += 1;
686 RemoveValue();
687 }
688 }
689 ASSERT_NE(demuxerPlugin_->SeekTo(0, 11000, SeekMode::SEEK_NEXT_SYNC, seekTime), Status::OK);
690 ASSERT_NE(demuxerPlugin_->SeekTo(0, -1000, SeekMode::SEEK_NEXT_SYNC, seekTime), Status::OK);
691 }
692
693 /**
694 * @tc.name: Demuxer_ErrorSeekToTime_0001
695 * @tc.desc: Seek to time with large positive or negative values
696 * @tc.type: FUNC
697 */
698 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ErrorSeekToTime_0001, TestSize.Level1)
699 {
700 std::string pluginName = "avdemux_flv";
701 InitResource(g_flvPath, pluginName);
702 ASSERT_TRUE(initStatus_);
703 ASSERT_EQ(demuxerPlugin_->GetMediaInfo(mediaInfo_), Status::OK);
704 SetInitValue();
705 int64_t seekTime = 0;
706 for (uint32_t idx = 0; idx < mediaInfo_.tracks.size(); ++idx) {
707 ASSERT_EQ(demuxerPlugin_->SelectTrack(idx), Status::OK);
708 }
709 ASSERT_NE(demuxerPlugin_->SeekTo(0, INT64_MAX, SeekMode::SEEK_NEXT_SYNC, seekTime), Status::OK);
710 ASSERT_NE(demuxerPlugin_->SeekTo(0, -1000, SeekMode::SEEK_NEXT_SYNC, seekTime), Status::OK);
711 }
712
713 /**
714 * @tc.name: Demuxer_WeakNetwork_001
715 * @tc.desc: Test demuxer under normal network conditions
716 * @tc.type: FUNC
717 */
718 HWTEST_F(DemuxerPluginUnitTest, Demuxer_WeakNetwork_001, TestSize.Level1)
719 {
720 std::string pluginName = "avdemux_flv";
721 std::string srtPath = g_flvPath;
722 InitWeakNetworkDemuxerPlugin(srtPath, pluginName, 0, 0); // 无弱网
723 CheckAllFrames({76, 113}, {1, 113}, {0});
724 }
725
726 /**
727 * @tc.name: Demuxer_WeakNetwork_002
728 * @tc.desc: Test demuxer with weak network (init fail once)
729 * @tc.type: FUNC
730 */
731 HWTEST_F(DemuxerPluginUnitTest, Demuxer_WeakNetwork_002, TestSize.Level1)
732 {
733 std::string pluginName = "avdemux_flv";
734 std::string srtPath = g_flvPath;
735 InitWeakNetworkDemuxerPlugin(srtPath, pluginName, 500, 1); // 初始化
736 CheckAllFrames({76, 113}, {1, 113}, {0});
737 }
738
739 /**
740 * @tc.name: Demuxer_WeakNetwork_003
741 * @tc.desc: Test demuxer with weak network (read frame fail 3 times)
742 * @tc.type: FUNC
743 */
744 HWTEST_F(DemuxerPluginUnitTest, Demuxer_WeakNetwork_003, TestSize.Level1)
745 {
746 std::string pluginName = "avdemux_flv";
747 std::string srtPath = g_flvPath;
748 InitWeakNetworkDemuxerPlugin(srtPath, pluginName, 2560656, 3); // 读帧
749 CheckAllFrames({76, 113}, {1, 113}, {0});
750 }
751
752 /**
753 * @tc.name: Demuxer_WeakNetwork_004
754 * @tc.desc: Test demuxer with weak network (read frame fail 3 times, check last pts)
755 * @tc.type: FUNC
756 */
757 HWTEST_F(DemuxerPluginUnitTest, Demuxer_WeakNetwork_004, TestSize.Level1)
758 {
759 std::string pluginName = "avdemux_flv";
760 std::string srtPath = g_flvPath;
761 InitWeakNetworkDemuxerPlugin(srtPath, pluginName, 2560656, 3); // 读帧
762 CheckAllFrames({76, 113}, {1, 113}, {0});
763 }
764
765 /**
766 * @tc.name: Demuxer_WeakNetwork_005
767 * @tc.desc: Test demuxer with weak network (read frame fail 20 times)
768 * @tc.type: FUNC
769 */
770 HWTEST_F(DemuxerPluginUnitTest, Demuxer_WeakNetwork_005, TestSize.Level1)
771 {
772 std::string pluginName = "avdemux_flv";
773 std::string srtPath = g_flvPath;
774 InitWeakNetworkDemuxerPlugin(srtPath, pluginName, 2560656, 20); // 读帧
775 CheckAllFrames({76, 113}, {1, 113}, {0});
776 }
777
778 /**
779 * @tc.name: Demuxer_EnsurePacketAllocated_001
780 * @tc.desc: EnsurePacketAllocated
781 * @tc.type: FUNC
782 */
783 HWTEST_F(DemuxerPluginUnitTest, Demuxer_EnsurePacketAllocated_001, TestSize.Level1)
784 {
785 std::string pluginName = "avdemux_flv";
786 InitResource(g_flvPath, pluginName);
787 ASSERT_TRUE(initStatus_);
788 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
789 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
790 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
791 AVPacket *pkt = av_packet_alloc();
792 demuxerPlugin_->EnsurePacketAllocated(pkt);
793 av_packet_free(&pkt);
794 }
795
796 /**
797 * @tc.name: Demuxer_UpdateInitDownloadData_001
798 * @tc.desc: Test UpdateInitDownloadData
799 * @tc.type: FUNC
800 */
801 HWTEST_F(DemuxerPluginUnitTest, Demuxer_UpdateInitDownloadData_001, TestSize.Level1)
802 {
803 std::string pluginName = "avdemux_flv";
804 InitResource(g_flvPath, pluginName);
805 ASSERT_TRUE(initStatus_);
806 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
807 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
808 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
809 demuxerPlugin_->ioContext_.initCompleted = false;
810 demuxerPlugin_->UpdateInitDownloadData(&demuxerPlugin_->ioContext_, UINT32_MAX -1);
811 }
812
813 /**
814 * @tc.name: Demuxer_GetNextSampleSize_001
815 * @tc.desc: Test GetNextSampleSize
816 * @tc.type: FUNC
817 */
818 HWTEST_F(DemuxerPluginUnitTest, Demuxer_GetNextSampleSize_001, TestSize.Level1)
819 {
820 std::string pluginName = "avdemux_flv";
821 InitResource(g_flvPath, pluginName);
822 ASSERT_TRUE(initStatus_);
823 ASSERT_NE(demuxerPlugin_, nullptr); // 检查插件是否初始化成功
824 ASSERT_EQ(demuxerPlugin_->SelectTrack(0), Status::OK);
825 ASSERT_EQ(demuxerPlugin_->SelectTrack(1), Status::OK);
826 int32_t size = 0;
827 demuxerPlugin_->ioContext_.invokerType = InvokerTypeAlias::READ;
828 demuxerPlugin_->GetNextSampleSize(0, size, 100);
829 }
830
831 /**
832 * @tc.name: Demuxer_ReadSample_MP4_0001
833 * @tc.desc: Copy current sample to buffer (mp4)
834 * @tc.type: FUNC
835 */
836 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MP4_0001, TestSize.Level1)
837 {
838 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
839 std::string filePath = g_mp4Path1;
840 InitResource(filePath, pluginName);
841 ASSERT_TRUE(initStatus_);
842 CheckAllFrames({602, 604, 433, 433}, {3, 3, 433, 433}, {0, 250, 500});
843 }
844
845 /**
846 * @tc.name: Demuxer_ReadSample_MP4_0002
847 * @tc.desc: Copy current sample to buffer (mp4)
848 * @tc.type: FUNC
849 */
850 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MP4_0002, TestSize.Level1)
851 {
852 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
853 std::string filePath = g_mp4Path2;
854 InitResource(filePath, pluginName);
855 ASSERT_TRUE(initStatus_);
856 CheckAllFrames({602, 433, 417}, {3, 433, 417}, {0, 250, 500});
857 }
858
859 /**
860 * @tc.name: Demuxer_ReadSample_MP4_0003
861 * @tc.desc: Copy current sample to buffer (mp4)
862 * @tc.type: FUNC
863 */
864 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MP4_0003, TestSize.Level1)
865 {
866 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
867 std::string filePath = g_mp4Path3;
868 InitResource(filePath, pluginName);
869 ASSERT_TRUE(initStatus_);
870 CheckAllFrames({602, 434}, {51, 434}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144,
871 156, 168, 180, 192, 204, 216, 228, 240, 252, 264, 276,
872 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408,
873 420, 432, 444, 456, 468, 480, 492, 504, 516, 528, 540,
874 552, 564, 576, 588, 600});
875 }
876
877 /**
878 * @tc.name: Demuxer_ReadSample_MP4_0004
879 * @tc.desc: Copy current sample to buffer (mp4)
880 * @tc.type: FUNC
881 */
882 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MP4_0004, TestSize.Level1)
883 {
884 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
885 std::string filePath = g_mp4Path4;
886 InitResource(filePath, pluginName);
887 ASSERT_TRUE(initStatus_);
888 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
889 CheckAllFrames({16, 16, 16}, {1, 1, 1}, {0});
890 }
891 }
892
893 /**
894 * @tc.name: Demuxer_ReadSample_MP4_0005
895 * @tc.desc: Copy current sample to buffer (mp4)
896 * @tc.type: FUNC
897 */
898 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MP4_0005, TestSize.Level1)
899 {
900 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
901 std::string filePath = g_mp4Path5;
902 InitResource(filePath, pluginName);
903 ASSERT_TRUE(initStatus_);
904 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
905 std::vector<uint32_t> numbers(430);
906 std::iota(numbers.begin(), numbers.end(), 0);
907 CheckAllFrames({430, 601, 430, 601, 601}, {430, 3, 430, 3, 3}, numbers);
908 }
909 }
910
911 /**
912 * @tc.name: Demuxer_ReadSample_FMP4_0001
913 * @tc.desc: Copy current sample to buffer (fmp4)
914 * @tc.type: FUNC
915 */
916 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_FMP4_0001, TestSize.Level1)
917 {
918 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
919 std::string filePath = g_fmp4Path1;
920 InitResource(filePath, pluginName);
921 ASSERT_TRUE(initStatus_);
922 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
923 }
924
925 /**
926 * @tc.name: Demuxer_ReadSample_FMP4_0002
927 * @tc.desc: Copy current sample to buffer (fmp4)
928 * @tc.type: FUNC
929 */
930 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_FMP4_0002, TestSize.Level1)
931 {
932 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
933 std::string filePath = g_fmp4Path2;
934 InitResource(filePath, pluginName);
935 ASSERT_TRUE(initStatus_);
936 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
937 }
938
939 /**
940 * @tc.name: Demuxer_ReadSample_MOV_0001
941 * @tc.desc: Copy current sample to buffer (mov)
942 * @tc.type: FUNC
943 */
944 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MOV_0001, TestSize.Level1)
945 {
946 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
947 std::string filePath = g_movPath1;
948 InitResource(filePath, pluginName);
949 ASSERT_TRUE(initStatus_);
950 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
951 }
952
953 /**
954 * @tc.name: Demuxer_ReadSample_MOV_0002
955 * @tc.desc: Copy current sample to buffer (mov)
956 * @tc.type: FUNC
957 */
958 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MOV_0002, TestSize.Level1)
959 {
960 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
961 std::string filePath = g_movPath2;
962 InitResource(filePath, pluginName);
963 ASSERT_TRUE(initStatus_);
964 CheckAllFrames({602, 434}, {3, 434}, {0, 250, 500});
965 }
966
967 /**
968 * @tc.name: Demuxer_ReadSample_MOV_0003
969 * @tc.desc: Copy current sample to buffer (mov)
970 * @tc.type: FUNC
971 */
972 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MOV_0003, TestSize.Level1)
973 {
974 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
975 std::string filePath = g_movPath3;
976 InitResource(filePath, pluginName);
977 ASSERT_TRUE(initStatus_);
978 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
979 }
980
981 /**
982 * @tc.name: Demuxer_ReadSample_MOV_0004
983 * @tc.desc: Copy current sample to buffer (mov)
984 * @tc.type: FUNC
985 */
986 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MOV_0004, TestSize.Level1)
987 {
988 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
989 std::string filePath = g_movPath4;
990 InitResource(filePath, pluginName);
991 ASSERT_TRUE(initStatus_);
992 CheckAllFrames({602, 609}, {3, 609}, {0, 250, 500});
993 }
994
995 /**
996 * @tc.name: Demuxer_ReadSample_MOV_0005
997 * @tc.desc: Copy current sample to buffer (mov)
998 * @tc.type: FUNC
999 */
1000 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MOV_0005, TestSize.Level1)
1001 {
1002 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1003 std::string filePath = g_movPath5;
1004 InitResource(filePath, pluginName);
1005 ASSERT_TRUE(initStatus_);
1006 CheckAllFrames({602, 385}, {51, 385}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120,
1007 132, 144, 156, 168, 180, 192, 204, 216, 228,
1008 240, 252, 264, 276, 288, 300, 312, 324, 336,
1009 348, 360, 372, 384, 396, 408, 420, 432, 444,
1010 456, 468, 480, 492, 504, 516, 528, 540, 552,
1011 564, 576, 588, 600});
1012 }
1013
1014 /**
1015 * @tc.name: Demuxer_ReadSample_MKV_0001
1016 * @tc.desc: Copy current sample to buffer (MKV)
1017 * @tc.type: FUNC
1018 */
1019 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MKV_0001, TestSize.Level1)
1020 {
1021 std::string pluginName = "avdemux_matroska,webm";
1022 std::string filePath = g_mkvPath1;
1023 InitResource(filePath, pluginName);
1024 ASSERT_TRUE(initStatus_);
1025 CheckAllFrames({239, 153}, {4, 153}, {0, 60, 120, 180});
1026 }
1027
1028 /**
1029 * @tc.name: Demuxer_ReadSample_MKV_0002
1030 * @tc.desc: Copy current sample to buffer (MKV)
1031 * @tc.type: FUNC
1032 */
1033 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MKV_0002, TestSize.Level1)
1034 {
1035 std::string pluginName = "avdemux_matroska,webm";
1036 std::string filePath = g_mkvPath2;
1037 InitResource(filePath, pluginName);
1038 ASSERT_TRUE(initStatus_);
1039 CheckAllFrames({242, 173}, {1, 173}, {0});
1040 }
1041
1042 /**
1043 * @tc.name: Demuxer_ReadSample_MKV_0003
1044 * @tc.desc: Copy current sample to buffer (MKV)
1045 * @tc.type: FUNC
1046 */
1047 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MKV_0003, TestSize.Level1)
1048 {
1049 std::string pluginName = "avdemux_matroska,webm";
1050 std::string filePath = g_mkvPath3;
1051 InitResource(filePath, pluginName);
1052 ASSERT_TRUE(initStatus_);
1053 CheckAllFrames({242, 200}, {1, 200}, {0});
1054 }
1055
1056 /**
1057 * @tc.name: Demuxer_ReadSample_MPEG_TS_0001
1058 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1059 * @tc.type: FUNC
1060 */
1061 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0001, TestSize.Level1)
1062 {
1063 std::string pluginName = "avdemux_mpegts";
1064 std::string filePath = g_mpegTsPath1;
1065 InitResource(filePath, pluginName);
1066 ASSERT_TRUE(initStatus_);
1067 CheckAllFrames({92}, {92}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1068 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1069 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1070 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1071 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1072 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1073 86, 87, 88, 89, 90, 91});
1074 }
1075
1076 /**
1077 * @tc.name: Demuxer_ReadSample_MPEG_TS_0002
1078 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1079 * @tc.type: FUNC
1080 */
1081 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0002, TestSize.Level1)
1082 {
1083 std::string pluginName = "avdemux_mpegts";
1084 std::string filePath = g_mpegTsPath2;
1085 InitResource(filePath, pluginName);
1086 ASSERT_TRUE(initStatus_);
1087 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1088 CheckAllFrames({303, 433}, {11, 433}, {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300});
1089 }
1090 }
1091
1092 /**
1093 * @tc.name: Demuxer_ReadSample_MPEG_TS_0003
1094 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1095 * @tc.type: FUNC
1096 */
1097 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0003, TestSize.Level1)
1098 {
1099 std::string pluginName = "avdemux_mpegts";
1100 std::string filePath = g_mpegTsPath3;
1101 InitResource(filePath, pluginName);
1102 ASSERT_TRUE(initStatus_);
1103 CheckAllFrames({602, 314}, {3, 314}, {0, 250, 500});
1104 }
1105
1106 /**
1107 * @tc.name: Demuxer_ReadSample_MPEG_TS_0004
1108 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1109 * @tc.type: FUNC
1110 */
1111 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0004, TestSize.Level1)
1112 {
1113 std::string pluginName = "avdemux_mpegts";
1114 std::string filePath = g_mpegTsPath4;
1115 InitResource(filePath, pluginName);
1116 ASSERT_TRUE(initStatus_);
1117 CheckAllFrames({103, 174}, {5, 174}, {0, 25, 50, 75, 100});
1118 }
1119
1120 /**
1121 * @tc.name: Demuxer_ReadSample_MPEG_TS_0005
1122 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1123 * @tc.type: FUNC
1124 */
1125 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0005, TestSize.Level1)
1126 {
1127 std::string pluginName = "avdemux_mpegts";
1128 std::string filePath = g_mpegTsPath5;
1129 InitResource(filePath, pluginName);
1130 ASSERT_TRUE(initStatus_);
1131 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1132 }
1133
1134 /**
1135 * @tc.name: Demuxer_ReadSample_MPEG_TS_0006
1136 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1137 * @tc.type: FUNC
1138 */
1139 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPEG_TS_0006, TestSize.Level1)
1140 {
1141 std::string pluginName = "avdemux_mpegts";
1142 std::string filePath = g_mpegTsPath6;
1143 InitResource(filePath, pluginName);
1144 ASSERT_TRUE(initStatus_);
1145 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1146 CheckAllFrames({30}, {1}, {0});
1147 }
1148 }
1149
1150 /**
1151 * @tc.name: Demuxer_ReadSample_AVI_0001
1152 * @tc.desc: Copy current sample to buffer (AVI)
1153 * @tc.type: FUNC
1154 */
1155 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0001, TestSize.Level1)
1156 {
1157 std::string pluginName = "avdemux_avi";
1158 std::string filePath = g_aviPath1;
1159 InitResource(filePath, pluginName);
1160 ASSERT_TRUE(initStatus_);
1161 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
1162 }
1163
1164 /**
1165 * @tc.name: Demuxer_ReadSample_AVI_0002
1166 * @tc.desc: Copy current sample to buffer (AVI)
1167 * @tc.type: FUNC
1168 */
1169 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0002, TestSize.Level1)
1170 {
1171 std::string pluginName = "avdemux_avi";
1172 std::string filePath = g_aviPath2;
1173 InitResource(filePath, pluginName);
1174 ASSERT_TRUE(initStatus_);
1175 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
1176 }
1177
1178 /**
1179 * @tc.name: Demuxer_ReadSample_AVI_0003
1180 * @tc.desc: Copy current sample to buffer (AVI)
1181 * @tc.type: FUNC
1182 */
1183 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0003, TestSize.Level1)
1184 {
1185 std::string pluginName = "avdemux_avi";
1186 std::string filePath = g_aviPath3;
1187 InitResource(filePath, pluginName);
1188 ASSERT_TRUE(initStatus_);
1189 CheckAllFrames({604, 433}, {51, 433}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108,
1190 120, 132, 144, 156, 168, 180, 192, 204, 216,
1191 228, 240, 252, 264, 276, 288, 300, 312, 324,
1192 336, 348, 360, 372, 384, 396, 408, 420, 432,
1193 444, 456, 468, 480, 492, 504, 516, 528, 540,
1194 552, 564, 576, 588, 600});
1195 }
1196
1197 /**
1198 * @tc.name: Demuxer_ReadSample_AVI_0004
1199 * @tc.desc: Copy current sample to buffer (AVI)
1200 * @tc.type: FUNC
1201 */
1202 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0004, TestSize.Level1)
1203 {
1204 std::string pluginName = "avdemux_avi";
1205 std::string filePath = g_aviPath4;
1206 InitResource(filePath, pluginName);
1207 ASSERT_TRUE(initStatus_);
1208 CheckAllFrames({103, 174}, {103, 174}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1209 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1210 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1211 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1212 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1213 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1214 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
1215 100, 101, 102});
1216 }
1217
1218 /**
1219 * @tc.name: Demuxer_ReadSample_AVI_0005
1220 * @tc.desc: Copy current sample to buffer (AVI)
1221 * @tc.type: FUNC
1222 */
1223 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0005, TestSize.Level1)
1224 {
1225 std::string pluginName = "avdemux_avi";
1226 std::string filePath = g_aviPath5;
1227 InitResource(filePath, pluginName);
1228 ASSERT_TRUE(initStatus_);
1229 CheckAllFrames({103, 156}, {9, 156}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1230 }
1231
1232 /**
1233 * @tc.name: Demuxer_ReadSample_AVI_0006
1234 * @tc.desc: Copy current sample to buffer (AVI)
1235 * @tc.type: FUNC
1236 */
1237 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_AVI_0006, TestSize.Level1)
1238 {
1239 std::string pluginName = "avdemux_avi";
1240 std::string filePath = g_aviPath6;
1241 InitResource(filePath, pluginName);
1242 ASSERT_TRUE(initStatus_);
1243 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1244 }
1245
1246 /**
1247 * @tc.name: Demuxer_ReadSample_MPG_0001
1248 * @tc.desc: Copy current sample to buffer (MPG)
1249 * @tc.type: FUNC
1250 */
1251 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPG_0001, TestSize.Level1)
1252 {
1253 std::string pluginName = "avdemux_mpeg";
1254 std::string filePath = g_mpgPath1;
1255 InitResource(filePath, pluginName);
1256 ASSERT_TRUE(initStatus_);
1257 CheckAllFrames({1253, 2164}, {109, 2164}, {0, 12, 14, 26, 38, 50, 62, 74, 86,
1258 98, 110, 122, 134, 146, 158, 170, 182, 194,
1259 206, 218, 230, 242, 254, 266, 278, 290, 302,
1260 314, 326, 338, 350, 362, 374, 386, 396, 408,
1261 420, 432, 444, 456, 468, 480, 492, 504, 516,
1262 528, 540, 552, 564, 571, 583, 595, 607, 619,
1263 621, 633, 645, 657, 658, 670, 672, 684, 696,
1264 708, 720, 732, 744, 756, 768, 780, 792, 804,
1265 816, 828, 840, 852, 864, 876, 888, 900, 912,
1266 924, 936, 948, 960, 972, 984, 996, 1008, 1020,
1267 1032, 1044, 1056, 1068, 1080, 1092, 1104, 1116,
1268 1128, 1140, 1152, 1164, 1176, 1188, 1200, 1212,
1269 1224, 1236, 1248});
1270 }
1271
1272 /**
1273 * @tc.name: Demuxer_ReadSample_MPG_0002
1274 * @tc.desc: Copy current sample to buffer (MPG)
1275 * @tc.type: FUNC
1276 */
1277 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPG_0002, TestSize.Level1)
1278 {
1279 std::string pluginName = "avdemux_mpeg";
1280 std::string filePath = g_mpgPath2;
1281 InitResource(filePath, pluginName);
1282 ASSERT_TRUE(initStatus_);
1283 CheckAllFrames({1253, 2165}, {120, 2165}, {0, 12, 14, 17, 29, 41, 53, 65, 77, 89, 101, 113,
1284 125, 137, 149, 161, 173, 185, 197, 209,
1285 217, 218, 219, 220, 221, 222, 234, 246, 258, 270, 282,
1286 294, 306, 318, 330, 334, 346, 358,
1287 370, 382, 394, 396, 408, 420, 432, 435, 447, 459, 471,
1288 483, 495, 507, 519, 531, 543, 555,
1289 567, 571, 583, 595, 607, 619, 631, 643, 655, 667, 672,
1290 679, 680, 681, 693, 705, 717, 729,
1291 741, 753, 765, 772, 773, 774, 775, 787, 799, 811,
1292 823, 835, 847, 859, 871, 883, 895, 907,
1293 919, 931, 943, 955, 967, 979, 991, 1003, 1015,
1294 1027, 1039, 1051, 1063, 1075, 1087, 1099,
1295 1111, 1123, 1135, 1147, 1159, 1171, 1183, 1195,
1296 1207, 1219, 1231, 1243});
1297 }
1298
1299 /**
1300 * @tc.name: Demuxer_ReadSample_MPG_0003
1301 * @tc.desc: Copy current sample to buffer (MPG)
1302 * @tc.type: FUNC
1303 */
1304 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_MPG_0003, TestSize.Level1)
1305 {
1306 std::string pluginName = "avdemux_mpeg";
1307 std::string filePath = g_mpgPath3;
1308 InitResource(filePath, pluginName);
1309 ASSERT_TRUE(initStatus_);
1310 CheckAllFrames({1253, 2164}, {19, 2164}, {0, 89, 123, 193, 224, 288, 334, 396, 436, 531,
1311 571, 621, 658, 684, 727, 772, 867, 1117, 1163});
1312 }
1313
1314 /**
1315 * @tc.name: Demuxer_ReadSample_SRT_0001
1316 * @tc.desc: Copy current sample to buffer (SRT)
1317 * @tc.type: FUNC
1318 */
1319 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_SRT_0001, TestSize.Level1)
1320 {
1321 std::string pluginName = "avdemux_srt";
1322 std::string filePath = g_srtPath1;
1323 InitResource(filePath, pluginName);
1324 ASSERT_TRUE(initStatus_);
1325 CheckAllFrames({5}, {5}, {0, 1, 2, 3, 4});
1326 }
1327
1328 /**
1329 * @tc.name: Demuxer_ReadSample_VTT_0001
1330 * @tc.desc: Copy current sample to buffer (VTT)
1331 * @tc.type: FUNC
1332 */
1333 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_VTT_0001, TestSize.Level1)
1334 {
1335 std::string pluginName = "avdemux_webvtt";
1336 std::string filePath = g_vttPath1;
1337 InitResource(filePath, pluginName);
1338 ASSERT_TRUE(initStatus_);
1339 CheckAllFrames({4}, {4}, {0, 1, 2, 3});
1340 }
1341
1342 /**
1343 * @tc.name: Demuxer_ReadSample_WeakNetwork_MP4_0001
1344 * @tc.desc: Copy current sample to buffer (mp4)
1345 * @tc.type: FUNC
1346 */
1347 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MP4_0001, TestSize.Level1)
1348 {
1349 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1350 std::string filePath = g_mp4Path1;
1351 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1352 ASSERT_TRUE(initStatus_);
1353 CheckAllFrames({602, 604, 433, 433}, {3, 3, 433, 433}, {0, 250, 500});
1354 }
1355
1356 /**
1357 * @tc.name: Demuxer_ReadSample_WeakNetwork_MP4_0002
1358 * @tc.desc: Copy current sample to buffer (mp4)
1359 * @tc.type: FUNC
1360 */
1361 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MP4_0002, TestSize.Level1)
1362 {
1363 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1364 std::string filePath = g_mp4Path2;
1365 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1366 ASSERT_TRUE(initStatus_);
1367 CheckAllFrames({602, 433, 417}, {3, 433, 417}, {0, 250, 500});
1368 }
1369
1370 /**
1371 * @tc.name: Demuxer_ReadSample_WeakNetwork_MP4_0003
1372 * @tc.desc: Copy current sample to buffer (mp4)
1373 * @tc.type: FUNC
1374 */
1375 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MP4_0003, TestSize.Level1)
1376 {
1377 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1378 std::string filePath = g_mp4Path3;
1379 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1380 ASSERT_TRUE(initStatus_);
1381 CheckAllFrames({602, 434}, {51, 434}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144,
1382 156, 168, 180, 192, 204, 216, 228, 240, 252, 264, 276,
1383 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408,
1384 420, 432, 444, 456, 468, 480, 492, 504, 516, 528, 540,
1385 552, 564, 576, 588, 600});
1386 }
1387
1388 /**
1389 * @tc.name: Demuxer_ReadSample_WeakNetwork_MP4_0004
1390 * @tc.desc: Copy current sample to buffer (mp4)
1391 * @tc.type: FUNC
1392 */
1393 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MP4_0004, TestSize.Level1)
1394 {
1395 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1396 std::string filePath = g_mp4Path4;
1397 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 4330600, 3);
1398 ASSERT_TRUE(initStatus_);
1399 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1400 CheckAllFrames({16, 16, 16}, {1, 1, 1}, {0});
1401 }
1402 }
1403
1404 /**
1405 * @tc.name: Demuxer_ReadSample_WeakNetwork_MP4_0005
1406 * @tc.desc: Copy current sample to buffer (mp4)
1407 * @tc.type: FUNC
1408 */
1409 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MP4_0005, TestSize.Level1)
1410 {
1411 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1412 std::string filePath = g_mp4Path5;
1413 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1414 ASSERT_TRUE(initStatus_);
1415 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1416 std::vector<uint32_t> numbers(430);
1417 std::iota(numbers.begin(), numbers.end(), 0);
1418 CheckAllFrames({430, 601, 430, 601, 601}, {430, 3, 430, 3, 3}, numbers);
1419 }
1420 }
1421
1422 /**
1423 * @tc.name: Demuxer_ReadSample_WeakNetwork_FMP4_0001
1424 * @tc.desc: Copy current sample to buffer (fmp4)
1425 * @tc.type: FUNC
1426 */
1427 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_FMP4_0001, TestSize.Level1)
1428 {
1429 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1430 std::string filePath = g_fmp4Path1;
1431 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1432 ASSERT_TRUE(initStatus_);
1433 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
1434 }
1435
1436 /**
1437 * @tc.name: Demuxer_ReadSample_WeakNetwork_FMP4_0002
1438 * @tc.desc: Copy current sample to buffer (fmp4)
1439 * @tc.type: FUNC
1440 */
1441 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_FMP4_0002, TestSize.Level1)
1442 {
1443 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1444 std::string filePath = g_fmp4Path2;
1445 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1446 ASSERT_TRUE(initStatus_);
1447 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
1448 }
1449
1450 /**
1451 * @tc.name: Demuxer_ReadSample_WeakNetwork_MOV_0001
1452 * @tc.desc: Copy current sample to buffer (mov)
1453 * @tc.type: FUNC
1454 */
1455 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MOV_0001, TestSize.Level1)
1456 {
1457 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1458 std::string filePath = g_movPath1;
1459 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1460 ASSERT_TRUE(initStatus_);
1461 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
1462 }
1463
1464 /**
1465 * @tc.name: Demuxer_ReadSample_WeakNetwork_MOV_0002
1466 * @tc.desc: Copy current sample to buffer (mov)
1467 * @tc.type: FUNC
1468 */
1469 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MOV_0002, TestSize.Level1)
1470 {
1471 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1472 std::string filePath = g_movPath2;
1473 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1474 ASSERT_TRUE(initStatus_);
1475 CheckAllFrames({602, 434}, {3, 434}, {0, 250, 500});
1476 }
1477
1478 /**
1479 * @tc.name: Demuxer_ReadSample_WeakNetwork_MOV_0003
1480 * @tc.desc: Copy current sample to buffer (mov)
1481 * @tc.type: FUNC
1482 */
1483 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MOV_0003, TestSize.Level1)
1484 {
1485 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1486 std::string filePath = g_movPath3;
1487 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1488 ASSERT_TRUE(initStatus_);
1489 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
1490 }
1491
1492 /**
1493 * @tc.name: Demuxer_ReadSample_WeakNetwork_MOV_0004
1494 * @tc.desc: Copy current sample to buffer (mov)
1495 * @tc.type: FUNC
1496 */
1497 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MOV_0004, TestSize.Level1)
1498 {
1499 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1500 std::string filePath = g_movPath4;
1501 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1502 ASSERT_TRUE(initStatus_);
1503 CheckAllFrames({602, 609}, {3, 609}, {0, 250, 500});
1504 }
1505
1506 /**
1507 * @tc.name: Demuxer_ReadSample_WeakNetwork_MOV_0005
1508 * @tc.desc: Copy current sample to buffer (mov)
1509 * @tc.type: FUNC
1510 */
1511 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MOV_0005, TestSize.Level1)
1512 {
1513 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1514 std::string filePath = g_movPath5;
1515 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1516 ASSERT_TRUE(initStatus_);
1517 CheckAllFrames({602, 385}, {51, 385}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120,
1518 132, 144, 156, 168, 180, 192, 204, 216, 228,
1519 240, 252, 264, 276, 288, 300, 312, 324, 336,
1520 348, 360, 372, 384, 396, 408, 420, 432, 444,
1521 456, 468, 480, 492, 504, 516, 528, 540, 552,
1522 564, 576, 588, 600});
1523 }
1524
1525 /**
1526 * @tc.name: Demuxer_ReadSample_WeakNetwork_MKV_0001
1527 * @tc.desc: Copy current sample to buffer (MKV)
1528 * @tc.type: FUNC
1529 */
1530 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MKV_0001, TestSize.Level1)
1531 {
1532 std::string pluginName = "avdemux_matroska,webm";
1533 std::string filePath = g_mkvPath1;
1534 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1535 ASSERT_TRUE(initStatus_);
1536 CheckAllFrames({239, 153}, {4, 153}, {0, 60, 120, 180});
1537 }
1538
1539 /**
1540 * @tc.name: Demuxer_ReadSample_WeakNetwork_MKV_0002
1541 * @tc.desc: Copy current sample to buffer (MKV)
1542 * @tc.type: FUNC
1543 */
1544 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MKV_0002, TestSize.Level1)
1545 {
1546 std::string pluginName = "avdemux_matroska,webm";
1547 std::string filePath = g_mkvPath2;
1548 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1549 ASSERT_TRUE(initStatus_);
1550 CheckAllFrames({242, 173}, {1, 173}, {0});
1551 }
1552
1553 /**
1554 * @tc.name: Demuxer_ReadSample_WeakNetwork_MKV_0003
1555 * @tc.desc: Copy current sample to buffer (MKV)
1556 * @tc.type: FUNC
1557 */
1558 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MKV_0003, TestSize.Level1)
1559 {
1560 std::string pluginName = "avdemux_matroska,webm";
1561 std::string filePath = g_mkvPath3;
1562 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1563 ASSERT_TRUE(initStatus_);
1564 CheckAllFrames({242, 200}, {1, 200}, {0});
1565 }
1566
1567 /**
1568 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0001
1569 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1570 * @tc.type: FUNC
1571 */
1572 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0001, TestSize.Level1)
1573 {
1574 std::string pluginName = "avdemux_mpegts";
1575 std::string filePath = g_mpegTsPath1;
1576 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1577 ASSERT_TRUE(initStatus_);
1578 CheckAllFrames({92}, {92}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1579 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1580 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1581 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1582 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1583 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1584 86, 87, 88, 89, 90, 91});
1585 }
1586
1587 /**
1588 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0002
1589 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1590 * @tc.type: FUNC
1591 */
1592 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0002, TestSize.Level1)
1593 {
1594 std::string pluginName = "avdemux_mpegts";
1595 std::string filePath = g_mpegTsPath2;
1596 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1597 ASSERT_TRUE(initStatus_);
1598 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1599 CheckAllFrames({303, 433}, {11, 433}, {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300});
1600 }
1601 }
1602
1603 /**
1604 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0003
1605 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1606 * @tc.type: FUNC
1607 */
1608 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0003, TestSize.Level1)
1609 {
1610 std::string pluginName = "avdemux_mpegts";
1611 std::string filePath = g_mpegTsPath3;
1612 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1613 ASSERT_TRUE(initStatus_);
1614 CheckAllFrames({602, 314}, {3, 314}, {0, 250, 500});
1615 }
1616
1617 /**
1618 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0004
1619 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1620 * @tc.type: FUNC
1621 */
1622 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0004, TestSize.Level1)
1623 {
1624 std::string pluginName = "avdemux_mpegts";
1625 std::string filePath = g_mpegTsPath4;
1626 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1627 ASSERT_TRUE(initStatus_);
1628 CheckAllFrames({103, 174}, {5, 174}, {0, 25, 50, 75, 100});
1629 }
1630
1631 /**
1632 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0005
1633 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1634 * @tc.type: FUNC
1635 */
1636 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0005, TestSize.Level1)
1637 {
1638 std::string pluginName = "avdemux_mpegts";
1639 std::string filePath = g_mpegTsPath5;
1640 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1641 ASSERT_TRUE(initStatus_);
1642 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1643 }
1644
1645 /**
1646 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPEG_TS_0006
1647 * @tc.desc: Copy current sample to buffer (MPEG-TS)
1648 * @tc.type: FUNC
1649 */
1650 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPEG_TS_0006, TestSize.Level1)
1651 {
1652 std::string pluginName = "avdemux_mpegts";
1653 std::string filePath = g_mpegTsPath6;
1654 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1655 ASSERT_TRUE(initStatus_);
1656 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1657 CheckAllFrames({30}, {1}, {0});
1658 }
1659 }
1660
1661 /**
1662 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0001
1663 * @tc.desc: Copy current sample to buffer (AVI)
1664 * @tc.type: FUNC
1665 */
1666 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0001, TestSize.Level1)
1667 {
1668 std::string pluginName = "avdemux_avi";
1669 std::string filePath = g_aviPath1;
1670 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1671 ASSERT_TRUE(initStatus_);
1672 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
1673 }
1674
1675 /**
1676 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0002
1677 * @tc.desc: Copy current sample to buffer (AVI)
1678 * @tc.type: FUNC
1679 */
1680 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0002, TestSize.Level1)
1681 {
1682 std::string pluginName = "avdemux_avi";
1683 std::string filePath = g_aviPath2;
1684 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1685 ASSERT_TRUE(initStatus_);
1686 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
1687 }
1688
1689 /**
1690 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0003
1691 * @tc.desc: Copy current sample to buffer (AVI)
1692 * @tc.type: FUNC
1693 */
1694 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0003, TestSize.Level1)
1695 {
1696 std::string pluginName = "avdemux_avi";
1697 std::string filePath = g_aviPath3;
1698 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1699 ASSERT_TRUE(initStatus_);
1700 CheckAllFrames({604, 433}, {51, 433}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108,
1701 120, 132, 144, 156, 168, 180, 192, 204, 216,
1702 228, 240, 252, 264, 276, 288, 300, 312, 324,
1703 336, 348, 360, 372, 384, 396, 408, 420, 432,
1704 444, 456, 468, 480, 492, 504, 516, 528, 540,
1705 552, 564, 576, 588, 600});
1706 }
1707
1708 /**
1709 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0004
1710 * @tc.desc: Copy current sample to buffer (AVI)
1711 * @tc.type: FUNC
1712 */
1713 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0004, TestSize.Level1)
1714 {
1715 std::string pluginName = "avdemux_avi";
1716 std::string filePath = g_aviPath4;
1717 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1718 ASSERT_TRUE(initStatus_);
1719 CheckAllFrames({103, 174}, {103, 174}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1720 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1721 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1722 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1723 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1724 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1725 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
1726 100, 101, 102});
1727 }
1728
1729 /**
1730 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0005
1731 * @tc.desc: Copy current sample to buffer (AVI)
1732 * @tc.type: FUNC
1733 */
1734 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0005, TestSize.Level1)
1735 {
1736 std::string pluginName = "avdemux_avi";
1737 std::string filePath = g_aviPath5;
1738 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1739 ASSERT_TRUE(initStatus_);
1740 CheckAllFrames({103, 156}, {9, 156}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1741 }
1742
1743 /**
1744 * @tc.name: Demuxer_ReadSample_WeakNetwork_AVI_0006
1745 * @tc.desc: Copy current sample to buffer (AVI)
1746 * @tc.type: FUNC
1747 */
1748 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_AVI_0006, TestSize.Level1)
1749 {
1750 std::string pluginName = "avdemux_avi";
1751 std::string filePath = g_aviPath6;
1752 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1753 ASSERT_TRUE(initStatus_);
1754 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
1755 }
1756
1757 /**
1758 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPG_0001
1759 * @tc.desc: Copy current sample to buffer (MPG)
1760 * @tc.type: FUNC
1761 */
1762 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPG_0001, TestSize.Level1)
1763 {
1764 std::string pluginName = "avdemux_mpeg";
1765 std::string filePath = g_mpgPath1;
1766 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1767 ASSERT_TRUE(initStatus_);
1768 CheckAllFrames({1253, 2164}, {109, 2164}, {0, 12, 14, 26, 38, 50, 62, 74, 86,
1769 98, 110, 122, 134, 146, 158, 170, 182, 194,
1770 206, 218, 230, 242, 254, 266, 278, 290, 302,
1771 314, 326, 338, 350, 362, 374, 386, 396, 408,
1772 420, 432, 444, 456, 468, 480, 492, 504, 516,
1773 528, 540, 552, 564, 571, 583, 595, 607, 619,
1774 621, 633, 645, 657, 658, 670, 672, 684, 696,
1775 708, 720, 732, 744, 756, 768, 780, 792, 804,
1776 816, 828, 840, 852, 864, 876, 888, 900, 912,
1777 924, 936, 948, 960, 972, 984, 996, 1008, 1020,
1778 1032, 1044, 1056, 1068, 1080, 1092, 1104, 1116,
1779 1128, 1140, 1152, 1164, 1176, 1188, 1200, 1212,
1780 1224, 1236, 1248});
1781 }
1782
1783 /**
1784 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPG_0002
1785 * @tc.desc: Copy current sample to buffer (MPG)
1786 * @tc.type: FUNC
1787 */
1788 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPG_0002, TestSize.Level1)
1789 {
1790 std::string pluginName = "avdemux_mpeg";
1791 std::string filePath = g_mpgPath2;
1792 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1793 ASSERT_TRUE(initStatus_);
1794 CheckAllFrames({1253, 2165}, {120, 2165}, {0, 12, 14, 17, 29, 41, 53, 65, 77, 89, 101, 113,
1795 125, 137, 149, 161, 173, 185, 197, 209,
1796 217, 218, 219, 220, 221, 222, 234, 246, 258, 270, 282,
1797 294, 306, 318, 330, 334, 346, 358,
1798 370, 382, 394, 396, 408, 420, 432, 435, 447, 459, 471,
1799 483, 495, 507, 519, 531, 543, 555,
1800 567, 571, 583, 595, 607, 619, 631, 643, 655, 667, 672,
1801 679, 680, 681, 693, 705, 717, 729,
1802 741, 753, 765, 772, 773, 774, 775, 787, 799, 811,
1803 823, 835, 847, 859, 871, 883, 895, 907,
1804 919, 931, 943, 955, 967, 979, 991, 1003, 1015,
1805 1027, 1039, 1051, 1063, 1075, 1087, 1099,
1806 1111, 1123, 1135, 1147, 1159, 1171, 1183, 1195,
1807 1207, 1219, 1231, 1243});
1808 }
1809
1810 /**
1811 * @tc.name: Demuxer_ReadSample_WeakNetwork_MPG_0003
1812 * @tc.desc: Copy current sample to buffer (MPG)
1813 * @tc.type: FUNC
1814 */
1815 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_MPG_0003, TestSize.Level1)
1816 {
1817 std::string pluginName = "avdemux_mpeg";
1818 std::string filePath = g_mpgPath3;
1819 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1820 ASSERT_TRUE(initStatus_);
1821 CheckAllFrames({1253, 2164}, {19, 2164}, {0, 89, 123, 193, 224, 288, 334, 396, 436, 531,
1822 571, 621, 658, 684, 727, 772, 867, 1117, 1163});
1823 }
1824
1825 /**
1826 * @tc.name: Demuxer_ReadSample_WeakNetwork_SRT_0001
1827 * @tc.desc: Copy current sample to buffer (SRT)
1828 * @tc.type: FUNC
1829 */
1830 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_SRT_0001, TestSize.Level1)
1831 {
1832 std::string pluginName = "avdemux_srt";
1833 std::string filePath = g_srtPath1;
1834 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1835 ASSERT_TRUE(initStatus_);
1836 CheckAllFrames({5}, {5}, {0, 1, 2, 3, 4});
1837 }
1838
1839 /**
1840 * @tc.name: Demuxer_ReadSample_WeakNetwork_VTT_0001
1841 * @tc.desc: Copy current sample to buffer (VTT)
1842 * @tc.type: FUNC
1843 */
1844 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_WeakNetwork_VTT_0001, TestSize.Level1)
1845 {
1846 std::string pluginName = "avdemux_webvtt";
1847 std::string filePath = g_vttPath1;
1848 InitWeakNetworkDemuxerPlugin(filePath, pluginName, 2560656, 3);
1849 ASSERT_TRUE(initStatus_);
1850 CheckAllFrames({4}, {4}, {0, 1, 2, 3});
1851 }
1852
1853 /**
1854 * @tc.name: Demuxer_ReadSample_URI_MP4_0001
1855 * @tc.desc: Copy current sample to buffer (mp4)
1856 * @tc.type: FUNC
1857 */
1858 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MP4_0001, TestSize.Level1)
1859 {
1860 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1861 std::string filePath = g_mp4Path1;
1862 InitResourceURI(filePath, pluginName);
1863 ASSERT_TRUE(initStatus_);
1864 CheckAllFrames({602, 604, 433, 433}, {3, 3, 433, 433}, {0, 250, 500});
1865 }
1866
1867 /**
1868 * @tc.name: Demuxer_ReadSample_URI_MP4_0002
1869 * @tc.desc: Copy current sample to buffer (mp4)
1870 * @tc.type: FUNC
1871 */
1872 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MP4_0002, TestSize.Level1)
1873 {
1874 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1875 std::string filePath = g_mp4Path2;
1876 InitResourceURI(filePath, pluginName);
1877 ASSERT_TRUE(initStatus_);
1878 CheckAllFrames({602, 433, 417}, {3, 433, 417}, {0, 250, 500});
1879 }
1880
1881 /**
1882 * @tc.name: Demuxer_ReadSample_URI_MP4_0003
1883 * @tc.desc: Copy current sample to buffer (mp4)
1884 * @tc.type: FUNC
1885 */
1886 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MP4_0003, TestSize.Level1)
1887 {
1888 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1889 std::string filePath = g_mp4Path3;
1890 InitResourceURI(filePath, pluginName);
1891 ASSERT_TRUE(initStatus_);
1892 CheckAllFrames({602, 434}, {51, 434}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144,
1893 156, 168, 180, 192, 204, 216, 228, 240, 252, 264, 276,
1894 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408,
1895 420, 432, 444, 456, 468, 480, 492, 504, 516, 528, 540,
1896 552, 564, 576, 588, 600});
1897 }
1898
1899 /**
1900 * @tc.name: Demuxer_ReadSample_URI_MP4_0004
1901 * @tc.desc: Copy current sample to buffer (mp4)
1902 * @tc.type: FUNC
1903 */
1904 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MP4_0004, TestSize.Level1)
1905 {
1906 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1907 std::string filePath = g_mp4Path4;
1908 InitResourceURI(filePath, pluginName);
1909 ASSERT_TRUE(initStatus_);
1910 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1911 CheckAllFrames({16, 16, 16}, {1, 1, 1}, {0});
1912 }
1913 }
1914
1915 /**
1916 * @tc.name: Demuxer_ReadSample_URI_MP4_0005
1917 * @tc.desc: Copy current sample to buffer (mp4)
1918 * @tc.type: FUNC
1919 */
1920 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MP4_0005, TestSize.Level1)
1921 {
1922 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1923 std::string filePath = g_mp4Path5;
1924 InitResourceURI(filePath, pluginName);
1925 ASSERT_TRUE(initStatus_);
1926 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
1927 std::vector<uint32_t> numbers(430);
1928 std::iota(numbers.begin(), numbers.end(), 0);
1929 CheckAllFrames({430, 601, 430, 601, 601}, {430, 3, 430, 3, 3}, numbers);
1930 }
1931 }
1932
1933 /**
1934 * @tc.name: Demuxer_ReadSample_URI_FMP4_0001
1935 * @tc.desc: Copy current sample to buffer (fmp4)
1936 * @tc.type: FUNC
1937 */
1938 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_FMP4_0001, TestSize.Level1)
1939 {
1940 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1941 std::string filePath = g_fmp4Path1;
1942 InitResourceURI(filePath, pluginName);
1943 ASSERT_TRUE(initStatus_);
1944 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
1945 }
1946
1947 /**
1948 * @tc.name: Demuxer_ReadSample_URI_FMP4_0002
1949 * @tc.desc: Copy current sample to buffer (fmp4)
1950 * @tc.type: FUNC
1951 */
1952 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_FMP4_0002, TestSize.Level1)
1953 {
1954 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1955 std::string filePath = g_fmp4Path2;
1956 InitResourceURI(filePath, pluginName);
1957 ASSERT_TRUE(initStatus_);
1958 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
1959 }
1960
1961 /**
1962 * @tc.name: Demuxer_ReadSample_URI_MOV_0001
1963 * @tc.desc: Copy current sample to buffer (mov)
1964 * @tc.type: FUNC
1965 */
1966 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MOV_0001, TestSize.Level1)
1967 {
1968 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1969 std::string filePath = g_movPath1;
1970 InitResourceURI(filePath, pluginName);
1971 ASSERT_TRUE(initStatus_);
1972 CheckAllFrames({604, 433}, {3, 433}, {0, 246, 497});
1973 }
1974
1975 /**
1976 * @tc.name: Demuxer_ReadSample_URI_MOV_0002
1977 * @tc.desc: Copy current sample to buffer (mov)
1978 * @tc.type: FUNC
1979 */
1980 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MOV_0002, TestSize.Level1)
1981 {
1982 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1983 std::string filePath = g_movPath2;
1984 InitResourceURI(filePath, pluginName);
1985 ASSERT_TRUE(initStatus_);
1986 CheckAllFrames({602, 434}, {3, 434}, {0, 250, 500});
1987 }
1988
1989 /**
1990 * @tc.name: Demuxer_ReadSample_URI_MOV_0003
1991 * @tc.desc: Copy current sample to buffer (mov)
1992 * @tc.type: FUNC
1993 */
1994 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MOV_0003, TestSize.Level1)
1995 {
1996 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
1997 std::string filePath = g_movPath3;
1998 InitResourceURI(filePath, pluginName);
1999 ASSERT_TRUE(initStatus_);
2000 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
2001 }
2002
2003 /**
2004 * @tc.name: Demuxer_ReadSample_URI_MOV_0004
2005 * @tc.desc: Copy current sample to buffer (mov)
2006 * @tc.type: FUNC
2007 */
2008 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MOV_0004, TestSize.Level1)
2009 {
2010 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
2011 std::string filePath = g_movPath4;
2012 InitResourceURI(filePath, pluginName);
2013 ASSERT_TRUE(initStatus_);
2014 CheckAllFrames({602, 609}, {3, 609}, {0, 250, 500});
2015 }
2016
2017 /**
2018 * @tc.name: Demuxer_ReadSample_URI_MOV_0005
2019 * @tc.desc: Copy current sample to buffer (mov)
2020 * @tc.type: FUNC
2021 */
2022 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MOV_0005, TestSize.Level1)
2023 {
2024 std::string pluginName = "avdemux_mov,mp4,m4a,3gp,3g2,mj2";
2025 std::string filePath = g_movPath5;
2026 InitResourceURI(filePath, pluginName);
2027 ASSERT_TRUE(initStatus_);
2028 CheckAllFrames({602, 385}, {51, 385}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120,
2029 132, 144, 156, 168, 180, 192, 204, 216, 228,
2030 240, 252, 264, 276, 288, 300, 312, 324, 336,
2031 348, 360, 372, 384, 396, 408, 420, 432, 444,
2032 456, 468, 480, 492, 504, 516, 528, 540, 552,
2033 564, 576, 588, 600});
2034 }
2035
2036 /**
2037 * @tc.name: Demuxer_ReadSample_URI_MKV_0001
2038 * @tc.desc: Copy current sample to buffer (MKV)
2039 * @tc.type: FUNC
2040 */
2041 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MKV_0001, TestSize.Level1)
2042 {
2043 std::string pluginName = "avdemux_matroska,webm";
2044 std::string filePath = g_mkvPath1;
2045 InitResourceURI(filePath, pluginName);
2046 ASSERT_TRUE(initStatus_);
2047 CheckAllFrames({239, 153}, {4, 153}, {0, 60, 120, 180});
2048 }
2049
2050 /**
2051 * @tc.name: Demuxer_ReadSample_URI_MKV_0002
2052 * @tc.desc: Copy current sample to buffer (MKV)
2053 * @tc.type: FUNC
2054 */
2055 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MKV_0002, TestSize.Level1)
2056 {
2057 std::string pluginName = "avdemux_matroska,webm";
2058 std::string filePath = g_mkvPath2;
2059 InitResourceURI(filePath, pluginName);
2060 ASSERT_TRUE(initStatus_);
2061 CheckAllFrames({242, 173}, {1, 173}, {0});
2062 }
2063
2064 /**
2065 * @tc.name: Demuxer_ReadSample_URI_MKV_0003
2066 * @tc.desc: Copy current sample to buffer (MKV)
2067 * @tc.type: FUNC
2068 */
2069 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MKV_0003, TestSize.Level1)
2070 {
2071 std::string pluginName = "avdemux_matroska,webm";
2072 std::string filePath = g_mkvPath3;
2073 InitResourceURI(filePath, pluginName);
2074 ASSERT_TRUE(initStatus_);
2075 CheckAllFrames({242, 200}, {1, 200}, {0});
2076 }
2077
2078 /**
2079 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0001
2080 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2081 * @tc.type: FUNC
2082 */
2083 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0001, TestSize.Level1)
2084 {
2085 std::string pluginName = "avdemux_mpegts";
2086 std::string filePath = g_mpegTsPath1;
2087 InitResourceURI(filePath, pluginName);
2088 ASSERT_TRUE(initStatus_);
2089 CheckAllFrames({92}, {92}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2090 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
2091 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
2092 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2093 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2094 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2095 86, 87, 88, 89, 90, 91});
2096 }
2097
2098 /**
2099 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0002
2100 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2101 * @tc.type: FUNC
2102 */
2103 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0002, TestSize.Level1)
2104 {
2105 std::string pluginName = "avdemux_mpegts";
2106 std::string filePath = g_mpegTsPath2;
2107 InitResourceURI(filePath, pluginName);
2108 ASSERT_TRUE(initStatus_);
2109 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
2110 CheckAllFrames({303, 433}, {11, 433}, {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300});
2111 }
2112 }
2113
2114 /**
2115 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0003
2116 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2117 * @tc.type: FUNC
2118 */
2119 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0003, TestSize.Level1)
2120 {
2121 std::string pluginName = "avdemux_mpegts";
2122 std::string filePath = g_mpegTsPath3;
2123 InitResourceURI(filePath, pluginName);
2124 ASSERT_TRUE(initStatus_);
2125 CheckAllFrames({602, 314}, {3, 314}, {0, 250, 500});
2126 }
2127
2128 /**
2129 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0004
2130 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2131 * @tc.type: FUNC
2132 */
2133 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0004, TestSize.Level1)
2134 {
2135 std::string pluginName = "avdemux_mpegts";
2136 std::string filePath = g_mpegTsPath4;
2137 InitResourceURI(filePath, pluginName);
2138 ASSERT_TRUE(initStatus_);
2139 CheckAllFrames({103, 174}, {5, 174}, {0, 25, 50, 75, 100});
2140 }
2141
2142 /**
2143 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0005
2144 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2145 * @tc.type: FUNC
2146 */
2147 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0005, TestSize.Level1)
2148 {
2149 std::string pluginName = "avdemux_mpegts";
2150 std::string filePath = g_mpegTsPath5;
2151 InitResourceURI(filePath, pluginName);
2152 ASSERT_TRUE(initStatus_);
2153 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
2154 }
2155
2156 /**
2157 * @tc.name: Demuxer_ReadSample_URI_MPEG_TS_0006
2158 * @tc.desc: Copy current sample to buffer (MPEG-TS)
2159 * @tc.type: FUNC
2160 */
2161 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPEG_TS_0006, TestSize.Level1)
2162 {
2163 std::string pluginName = "avdemux_mpegts";
2164 std::string filePath = g_mpegTsPath6;
2165 InitResourceURI(filePath, pluginName);
2166 ASSERT_TRUE(initStatus_);
2167 if (access(HEVC_LIB_PATH.c_str(), F_OK) == 0) {
2168 CheckAllFrames({30}, {1}, {0});
2169 }
2170 }
2171
2172 /**
2173 * @tc.name: Demuxer_ReadSample_URI_AVI_0001
2174 * @tc.desc: Copy current sample to buffer (AVI)
2175 * @tc.type: FUNC
2176 */
2177 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0001, TestSize.Level1)
2178 {
2179 std::string pluginName = "avdemux_avi";
2180 std::string filePath = g_aviPath1;
2181 InitResourceURI(filePath, pluginName);
2182 ASSERT_TRUE(initStatus_);
2183 CheckAllFrames({602, 433}, {3, 433}, {0, 250, 500});
2184 }
2185
2186 /**
2187 * @tc.name: Demuxer_ReadSample_URI_AVI_0002
2188 * @tc.desc: Copy current sample to buffer (AVI)
2189 * @tc.type: FUNC
2190 */
2191 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0002, TestSize.Level1)
2192 {
2193 std::string pluginName = "avdemux_avi";
2194 std::string filePath = g_aviPath2;
2195 InitResourceURI(filePath, pluginName);
2196 ASSERT_TRUE(initStatus_);
2197 CheckAllFrames({602, 386}, {3, 386}, {0, 250, 500});
2198 }
2199
2200 /**
2201 * @tc.name: Demuxer_ReadSample_URI_AVI_0003
2202 * @tc.desc: Copy current sample to buffer (AVI)
2203 * @tc.type: FUNC
2204 */
2205 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0003, TestSize.Level1)
2206 {
2207 std::string pluginName = "avdemux_avi";
2208 std::string filePath = g_aviPath3;
2209 InitResourceURI(filePath, pluginName);
2210 ASSERT_TRUE(initStatus_);
2211 CheckAllFrames({604, 433}, {51, 433}, {0, 12, 24, 36, 48, 60, 72, 84, 96, 108,
2212 120, 132, 144, 156, 168, 180, 192, 204, 216,
2213 228, 240, 252, 264, 276, 288, 300, 312, 324,
2214 336, 348, 360, 372, 384, 396, 408, 420, 432,
2215 444, 456, 468, 480, 492, 504, 516, 528, 540,
2216 552, 564, 576, 588, 600});
2217 }
2218
2219 /**
2220 * @tc.name: Demuxer_ReadSample_URI_AVI_0004
2221 * @tc.desc: Copy current sample to buffer (AVI)
2222 * @tc.type: FUNC
2223 */
2224 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0004, TestSize.Level1)
2225 {
2226 std::string pluginName = "avdemux_avi";
2227 std::string filePath = g_aviPath4;
2228 InitResourceURI(filePath, pluginName);
2229 ASSERT_TRUE(initStatus_);
2230 CheckAllFrames({103, 174}, {103, 174}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2231 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
2232 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
2233 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2234 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2235 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2236 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
2237 100, 101, 102});
2238 }
2239
2240 /**
2241 * @tc.name: Demuxer_ReadSample_URI_AVI_0005
2242 * @tc.desc: Copy current sample to buffer (AVI)
2243 * @tc.type: FUNC
2244 */
2245 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0005, TestSize.Level1)
2246 {
2247 std::string pluginName = "avdemux_avi";
2248 std::string filePath = g_aviPath5;
2249 InitResourceURI(filePath, pluginName);
2250 ASSERT_TRUE(initStatus_);
2251 CheckAllFrames({103, 156}, {9, 156}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
2252 }
2253
2254 /**
2255 * @tc.name: Demuxer_ReadSample_URI_AVI_0006
2256 * @tc.desc: Copy current sample to buffer (AVI)
2257 * @tc.type: FUNC
2258 */
2259 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_AVI_0006, TestSize.Level1)
2260 {
2261 std::string pluginName = "avdemux_avi";
2262 std::string filePath = g_aviPath6;
2263 InitResourceURI(filePath, pluginName);
2264 ASSERT_TRUE(initStatus_);
2265 CheckAllFrames({103, 155}, {9, 155}, {0, 12, 24, 36, 48, 60, 72, 84, 96});
2266 }
2267
2268 /**
2269 * @tc.name: Demuxer_ReadSample_URI_MPG_0001
2270 * @tc.desc: Copy current sample to buffer (MPG)
2271 * @tc.type: FUNC
2272 */
2273 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPG_0001, TestSize.Level1)
2274 {
2275 std::string pluginName = "avdemux_mpeg";
2276 std::string filePath = g_mpgPath1;
2277 InitResourceURI(filePath, pluginName);
2278 ASSERT_TRUE(initStatus_);
2279 CheckAllFrames({1253, 2164}, {109, 2164}, {0, 12, 14, 26, 38, 50, 62, 74, 86,
2280 98, 110, 122, 134, 146, 158, 170, 182, 194,
2281 206, 218, 230, 242, 254, 266, 278, 290, 302,
2282 314, 326, 338, 350, 362, 374, 386, 396, 408,
2283 420, 432, 444, 456, 468, 480, 492, 504, 516,
2284 528, 540, 552, 564, 571, 583, 595, 607, 619,
2285 621, 633, 645, 657, 658, 670, 672, 684, 696,
2286 708, 720, 732, 744, 756, 768, 780, 792, 804,
2287 816, 828, 840, 852, 864, 876, 888, 900, 912,
2288 924, 936, 948, 960, 972, 984, 996, 1008, 1020,
2289 1032, 1044, 1056, 1068, 1080, 1092, 1104, 1116,
2290 1128, 1140, 1152, 1164, 1176, 1188, 1200, 1212,
2291 1224, 1236, 1248});
2292 }
2293
2294 /**
2295 * @tc.name: Demuxer_ReadSample_URI_MPG_0002
2296 * @tc.desc: Copy current sample to buffer (MPG)
2297 * @tc.type: FUNC
2298 */
2299 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPG_0002, TestSize.Level1)
2300 {
2301 std::string pluginName = "avdemux_mpeg";
2302 std::string filePath = g_mpgPath2;
2303 InitResourceURI(filePath, pluginName);
2304 ASSERT_TRUE(initStatus_);
2305 CheckAllFrames({1253, 2165}, {120, 2165}, {0, 12, 14, 17, 29, 41, 53, 65, 77, 89, 101, 113,
2306 125, 137, 149, 161, 173, 185, 197, 209,
2307 217, 218, 219, 220, 221, 222, 234, 246, 258, 270, 282,
2308 294, 306, 318, 330, 334, 346, 358,
2309 370, 382, 394, 396, 408, 420, 432, 435, 447, 459, 471,
2310 483, 495, 507, 519, 531, 543, 555,
2311 567, 571, 583, 595, 607, 619, 631, 643, 655, 667, 672,
2312 679, 680, 681, 693, 705, 717, 729,
2313 741, 753, 765, 772, 773, 774, 775, 787, 799, 811,
2314 823, 835, 847, 859, 871, 883, 895, 907,
2315 919, 931, 943, 955, 967, 979, 991, 1003, 1015,
2316 1027, 1039, 1051, 1063, 1075, 1087, 1099,
2317 1111, 1123, 1135, 1147, 1159, 1171, 1183, 1195,
2318 1207, 1219, 1231, 1243});
2319 }
2320
2321 /**
2322 * @tc.name: Demuxer_ReadSample_URI_MPG_0003
2323 * @tc.desc: Copy current sample to buffer (MPG)
2324 * @tc.type: FUNC
2325 */
2326 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_MPG_0003, TestSize.Level1)
2327 {
2328 std::string pluginName = "avdemux_mpeg";
2329 std::string filePath = g_mpgPath3;
2330 InitResourceURI(filePath, pluginName);
2331 ASSERT_TRUE(initStatus_);
2332 CheckAllFrames({1253, 2164}, {19, 2164}, {0, 89, 123, 193, 224, 288, 334, 396, 436, 531,
2333 571, 621, 658, 684, 727, 772, 867, 1117, 1163});
2334 }
2335
2336 /**
2337 * @tc.name: Demuxer_ReadSample_URI_SRT_0001
2338 * @tc.desc: Copy current sample to buffer (SRT)
2339 * @tc.type: FUNC
2340 */
2341 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_SRT_0001, TestSize.Level1)
2342 {
2343 std::string pluginName = "avdemux_srt";
2344 std::string filePath = g_srtPath1;
2345 InitResourceURI(filePath, pluginName);
2346 ASSERT_TRUE(initStatus_);
2347 CheckAllFrames({5}, {5}, {0, 1, 2, 3, 4});
2348 }
2349
2350 /**
2351 * @tc.name: Demuxer_ReadSample_URI_VTT_0001
2352 * @tc.desc: Copy current sample to buffer (VTT)
2353 * @tc.type: FUNC
2354 */
2355 HWTEST_F(DemuxerPluginUnitTest, Demuxer_ReadSample_URI_VTT_0001, TestSize.Level1)
2356 {
2357 std::string pluginName = "avdemux_webvtt";
2358 std::string filePath = g_vttPath1;
2359 InitResourceURI(filePath, pluginName);
2360 ASSERT_TRUE(initStatus_);
2361 CheckAllFrames({4}, {4}, {0, 1, 2, 3});
2362 }