1 /*
2 * Copyright (C) 2023 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 <string>
17 #include <malloc.h>
18 #include <sys/stat.h>
19 #include <cinttypes>
20 #include <fcntl.h>
21 #include <list>
22 #include <map>
23 #include <cmath>
24 #include "gtest/gtest.h"
25 #include "avcodec_errors.h"
26 #include "media_description.h"
27 #include "file_server_demo.h"
28 #include "demuxer_unit_test.h"
29
30 #define LOCAL true
31 #define URI false
32
33 using namespace OHOS;
34 using namespace OHOS::Media;
35 using namespace OHOS::MediaAVCodec;
36 using namespace testing::ext;
37 using namespace std;
38
39 namespace {
40 unique_ptr<FileServerDemo> server = nullptr;
41 static const string TEST_FILE_PATH = "/data/test/media/";
42 static const string TEST_URI_PATH = "http://127.0.0.1:46666/";
43 static const string TEST_URI_PATH2 = "http://192.168.3.11:8080/share/";
44
45 const std::string HEVC_LIB_PATH = std::string(AV_CODEC_PATH) + "/libav_codec_hevc_parser.z.so";
46 const int64_t SOURCE_OFFSET = 0;
47 list<SeekMode> seekModes = {SeekMode::SEEK_NEXT_SYNC, SeekMode::SEEK_PREVIOUS_SYNC,
48 SeekMode::SEEK_CLOSEST_SYNC};
49
50 string g_hdrVividPath = TEST_FILE_PATH + string("hdrvivid_720p_2s.mp4");
51 string g_hdrVividUri = TEST_URI_PATH + string("hdrvivid_720p_2s.mp4");
52 string g_mp4HevcPath = TEST_FILE_PATH + string("camera_h265_aac_rotate270.mp4");
53 string g_mp4HevcUri = TEST_URI_PATH + string("camera_h265_aac_rotate270.mp4");
54 string g_mkvHevcAccPath = TEST_FILE_PATH + string("h265_aac_4sec.mkv");
55 string g_mkvHevcAccUri = TEST_URI_PATH + string("h265_aac_4sec.mkv");
56 string g_mkvAvcOpusPath = TEST_FILE_PATH + string("h264_opus_4sec.mkv");
57 string g_mkvAvcOpusUri = TEST_URI_PATH + string("h264_opus_4sec.mkv");
58 string g_mkvAvcMp3Path = TEST_FILE_PATH + string("h264_mp3_4sec.mkv");
59 string g_mkvAvcMp3Uri = TEST_URI_PATH + string("h264_mp3_4sec.mkv");
60 string g_tsHevcAacPath = TEST_FILE_PATH + string("hevc_aac_1920x1080_g30_30fps.ts");
61 string g_tsHevcAacUri = TEST_URI_PATH + string("hevc_aac_1920x1080_g30_30fps.ts");
62 string g_tsHevcAac4KPath = TEST_FILE_PATH + string("hevc_aac_3840x2160_30frames.ts");
63 string g_flvPath = TEST_FILE_PATH + string("h265_enhanced.flv");
64 string g_flvUri = TEST_URI_PATH + string("h265_enhanced.flv");
65 string g_fmp4HevcPath = TEST_FILE_PATH + string("h265_fmp4.mp4");
66 string g_fmp4HevcUri = TEST_URI_PATH + string("h265_fmp4.mp4");
67 string g_doubleVividPath = TEST_FILE_PATH + string("audiovivid_hdrvivid_2s.mp4");
68 string g_doubleVividUri = TEST_URI_PATH + string("audiovivid_hdrvivid_2s.mp4");
69 string g_hls = TEST_URI_PATH2 + string("index_265.m3u8");
70 string g_mp4265InfoParsePath = TEST_FILE_PATH + string("test_265_B_Gop25_4sec.mp4");
71 string g_265pcmPath = TEST_FILE_PATH + string("265_pcm_s16le.mov");
72 string g_265pcmUri = TEST_URI_PATH + string("265_pcm_s16le.mov");
73
74 std::map<std::string, std::map<std::string, std::vector<int32_t>>> infoMap = {
75 {"hdrVivid", {{"frames", {76, 125}}, {"kFrames", {3, 125}}}},
76 {"mp4Hevc", {{"frames", {60, 87 }}, {"kFrames", {1, 87 }}}},
77 {"mkvHevcAcc", {{"frames", {242, 173}}, {"kFrames", {1, 173}}}},
78 {"mkvAvcOpus", {{"frames", {240, 199}}, {"kFrames", {4, 199}}}},
79 {"mkvAvcMp3", {{"frames", {239, 153}}, {"kFrames", {4, 153}}}},
80 {"tsHevcAac", {{"frames", {303, 433}}, {"kFrames", {11, 433}}}},
81 {"movHevc", {{"frames", {604, 433}}, {"kFrames", {3, 433}}}},
82 {"fmp4Hevc", {{"frames", {604, 433}}, {"kFrames", {3, 433}}}},
83 {"doubleVivid", {{"frames", {76, 116}}, {"kFrames", {3, 116}}}},
84 {"mp4265InfoParse", {{"frames", {103, 174}}, {"kFrames", {5, 174}}}},
85 };
86
87 std::map<std::string, std::vector<int32_t>> discardFrameIndexMap = {
88 {g_mp4265InfoParsePath, {-1, 1}}
89 };
90 } // namespace
91
InitResource(const std::string & path,bool local)92 void DemuxerUnitTest::InitResource(const std::string &path, bool local)
93 {
94 printf("---- %s ------\n", path.c_str());
95 if (local) {
96 fd_ = OpenFile(path);
97 int64_t size = GetFileSize(path);
98 source_ = AVSourceMockFactory::CreateSourceWithFD(fd_, SOURCE_OFFSET, size);
99 ASSERT_NE(source_, nullptr);
100 } else {
101 source_ = AVSourceMockFactory::CreateSourceWithURI(const_cast<char*>(path.data()));
102 ASSERT_NE(source_, nullptr);
103 }
104 format_ = source_->GetSourceFormat();
105 ASSERT_NE(format_, nullptr);
106 ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_TRACK_COUNT, nbStreams_));
107 demuxer_ = AVDemuxerMockFactory::CreateDemuxer(source_);
108 ASSERT_NE(demuxer_, nullptr);
109 initStatus_ = true;
110 }
111
ReadSample(const std::string & path,bool local,bool checkBufferInfo)112 void DemuxerUnitTest::ReadSample(const std::string &path, bool local, bool checkBufferInfo)
113 {
114 InitResource(path, local);
115 ASSERT_TRUE(initStatus_);
116 SetInitValue();
117 for (auto idx : selectedTrackIds_) {
118 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
119 }
120 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
121 ASSERT_NE(sharedMem_, nullptr);
122
123 while (!isEOS(eosFlag_)) {
124 for (auto idx : selectedTrackIds_) {
125 ASSERT_EQ(demuxer_->ReadSample(idx, sharedMem_, &info_, flag_, checkBufferInfo), AV_ERR_OK);
126 CountFrames(idx);
127 if (checkBufferInfo && discardFrameIndexMap.count(path) != 0 &&
128 flag_ & static_cast<uint32_t>(AVBufferFlag::DISCARD)) {
129 printf("[track %d] frame %d flag is discard\n", idx, frames_[idx]);
130 ASSERT_EQ(discardFrameIndexMap[path][idx], frames_[idx]);
131 }
132 }
133 }
134 }
135
136 namespace {
137 /**
138 * @tc.name: Demuxer_ReadSample_1220
139 * @tc.desc: copy current sample to buffer, local
140 * @tc.type: FUNC
141 */
142 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1220, TestSize.Level1)
143 {
144 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
145 return;
146 }
147 ReadSample(g_hdrVividPath, LOCAL);
148 for (auto idx : selectedTrackIds_) {
149 ASSERT_EQ(frames_[idx], infoMap["hdrVivid"]["frames"][idx]);
150 ASSERT_EQ(keyFrames_[idx], infoMap["hdrVivid"]["kFrames"][idx]);
151 }
152 RemoveValue();
153 selectedTrackIds_.clear();
154 }
155
156 /**
157 * @tc.name: Demuxer_ReadSample_1221
158 * @tc.desc: copy current sample to buffer, uri
159 * @tc.type: FUNC
160 */
161 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1221, TestSize.Level1)
162 {
163 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
164 return;
165 }
166 ReadSample(g_hdrVividUri, URI);
167 for (auto idx : selectedTrackIds_) {
168 ASSERT_EQ(frames_[idx], infoMap["hdrVivid"]["frames"][idx]);
169 ASSERT_EQ(keyFrames_[idx], infoMap["hdrVivid"]["kFrames"][idx]);
170 }
171 RemoveValue();
172 selectedTrackIds_.clear();
173 }
174
175 /**
176 * @tc.name: Demuxer_ReadSample_1200
177 * @tc.desc: copy current sample to buffer, local
178 * @tc.type: FUNC
179 */
180 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1200, TestSize.Level1)
181 {
182 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
183 return;
184 }
185 ReadSample(g_mp4HevcPath, LOCAL);
186 for (auto idx : selectedTrackIds_) {
187 ASSERT_EQ(frames_[idx], infoMap["mp4Hevc"]["frames"][idx]);
188 ASSERT_EQ(keyFrames_[idx], infoMap["mp4Hevc"]["kFrames"][idx]);
189 }
190 RemoveValue();
191 selectedTrackIds_.clear();
192 }
193
194 /**
195 * @tc.name: Demuxer_ReadSample_1201
196 * @tc.desc: copy current sample to buffer, uri
197 * @tc.type: FUNC
198 */
199 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1201, TestSize.Level1)
200 {
201 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
202 return;
203 }
204 ReadSample(g_mp4HevcUri, URI);
205 for (auto idx : selectedTrackIds_) {
206 ASSERT_EQ(frames_[idx], infoMap["mp4Hevc"]["frames"][idx]);
207 ASSERT_EQ(keyFrames_[idx], infoMap["mp4Hevc"]["kFrames"][idx]);
208 }
209 RemoveValue();
210 selectedTrackIds_.clear();
211 }
212
213 /**
214 * @tc.name: Demuxer_ReadSample_1210
215 * @tc.desc: copy current sample to buffer, local
216 * @tc.type: FUNC
217 */
218 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1210, TestSize.Level1)
219 {
220 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
221 return;
222 }
223 ReadSample(g_mkvHevcAccPath, LOCAL);
224 for (auto idx : selectedTrackIds_) {
225 ASSERT_EQ(frames_[idx], infoMap["mkvHevcAcc"]["frames"][idx]);
226 ASSERT_EQ(keyFrames_[idx], infoMap["mkvHevcAcc"]["kFrames"][idx]);
227 }
228 RemoveValue();
229 selectedTrackIds_.clear();
230 }
231
232 /**
233 * @tc.name: Demuxer_ReadSample_1211
234 * @tc.desc: copy current sample to buffer, local
235 * @tc.type: FUNC
236 */
237 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1211, TestSize.Level1)
238 {
239 ReadSample(g_mkvAvcOpusPath, LOCAL);
240 for (auto idx : selectedTrackIds_) {
241 ASSERT_EQ(frames_[idx], infoMap["mkvAvcOpus"]["frames"][idx]);
242 ASSERT_EQ(keyFrames_[idx], infoMap["mkvAvcOpus"]["kFrames"][idx]);
243 }
244 RemoveValue();
245 selectedTrackIds_.clear();
246 }
247
248 /**
249 * @tc.name: Demuxer_ReadSample_1212
250 * @tc.desc: copy current sample to buffer, local
251 * @tc.type: FUNC
252 */
253 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1212, TestSize.Level1)
254 {
255 ReadSample(g_mkvAvcMp3Path, LOCAL);
256 for (auto idx : selectedTrackIds_) {
257 ASSERT_EQ(frames_[idx], infoMap["mkvAvcMp3"]["frames"][idx]);
258 ASSERT_EQ(keyFrames_[idx], infoMap["mkvAvcMp3"]["kFrames"][idx]);
259 }
260 RemoveValue();
261 selectedTrackIds_.clear();
262 }
263
264 /**
265 * @tc.name: Demuxer_ReadSample_1213
266 * @tc.desc: copy current sample to buffer, uri
267 * @tc.type: FUNC
268 */
269 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1213, TestSize.Level1)
270 {
271 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
272 return;
273 }
274 ReadSample(g_mkvHevcAccUri, URI);
275 for (auto idx : selectedTrackIds_) {
276 ASSERT_EQ(frames_[idx], infoMap["mkvHevcAcc"]["frames"][idx]);
277 ASSERT_EQ(keyFrames_[idx], infoMap["mkvHevcAcc"]["kFrames"][idx]);
278 }
279 RemoveValue();
280 selectedTrackIds_.clear();
281 }
282
283 /**
284 * @tc.name: Demuxer_ReadSample_1214
285 * @tc.desc: copy current sample to buffer, uri
286 * @tc.type: FUNC
287 */
288 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1214, TestSize.Level1)
289 {
290 ReadSample(g_mkvAvcOpusUri, URI);
291 for (auto idx : selectedTrackIds_) {
292 ASSERT_EQ(frames_[idx], infoMap["mkvAvcOpus"]["frames"][idx]);
293 ASSERT_EQ(keyFrames_[idx], infoMap["mkvAvcOpus"]["kFrames"][idx]);
294 }
295 RemoveValue();
296 selectedTrackIds_.clear();
297 }
298
299 /**
300 * @tc.name: Demuxer_ReadSample_1215
301 * @tc.desc: copy current sample to buffer, uri
302 * @tc.type: FUNC
303 */
304 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1215, TestSize.Level1)
305 {
306 ReadSample(g_mkvAvcMp3Uri, URI);
307 for (auto idx : selectedTrackIds_) {
308 ASSERT_EQ(frames_[idx], infoMap["mkvAvcMp3"]["frames"][idx]);
309 ASSERT_EQ(keyFrames_[idx], infoMap["mkvAvcMp3"]["kFrames"][idx]);
310 }
311 RemoveValue();
312 selectedTrackIds_.clear();
313 }
314
315 /**
316 * @tc.name: Demuxer_ReadSample_2306
317 * @tc.desc: copy current sample to buffer(265-pcm), local
318 * @tc.type: FUNC
319 */
320 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_2306, TestSize.Level1)
321 {
322 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
323 return;
324 }
325 ReadSample(g_265pcmPath, LOCAL);
326 for (auto idx : selectedTrackIds_) {
327 ASSERT_EQ(frames_[idx], infoMap["movHevc"]["frames"][idx]);
328 ASSERT_EQ(keyFrames_[idx], infoMap["movHevc"]["kFrames"][idx]);
329 }
330 RemoveValue();
331 selectedTrackIds_.clear();
332 }
333
334 /**
335 * @tc.name: Demuxer_ReadSample_2307
336 * @tc.desc: copy current sample to buffer(265-pcm), uri
337 * @tc.type: FUNC
338 */
339 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_2307, TestSize.Level1)
340 {
341 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
342 return;
343 }
344 ReadSample(g_265pcmUri, URI);
345 for (auto idx : selectedTrackIds_) {
346 ASSERT_EQ(frames_[idx], infoMap["movHevc"]["frames"][idx]);
347 ASSERT_EQ(keyFrames_[idx], infoMap["movHevc"]["kFrames"][idx]);
348 }
349 RemoveValue();
350 selectedTrackIds_.clear();
351 }
352
353 /**
354 * @tc.name: Demuxer_ReadSample_1216
355 * @tc.desc: copy current sample to buffer, local(ts)
356 * @tc.type: FUNC
357 */
358 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1216, TestSize.Level1)
359 {
360 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
361 return;
362 }
363 ReadSample(g_tsHevcAacPath, LOCAL);
364 for (auto idx : selectedTrackIds_) {
365 ASSERT_EQ(frames_[idx], infoMap["tsHevcAac"]["frames"][idx]);
366 ASSERT_EQ(keyFrames_[idx], infoMap["tsHevcAac"]["kFrames"][idx]);
367 }
368 RemoveValue();
369 selectedTrackIds_.clear();
370 }
371
372 /**
373 * @tc.name: Demuxer_ReadSample_1217
374 * @tc.desc: copy current sample to buffer, uri(ts)
375 * @tc.type: FUNC
376 */
377 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1217, TestSize.Level1)
378 {
379 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
380 return;
381 }
382 ReadSample(g_tsHevcAacPath, URI);
383 for (auto idx : selectedTrackIds_) {
384 ASSERT_EQ(frames_[idx], infoMap["tsHevcAac"]["frames"][idx]);
385 ASSERT_EQ(keyFrames_[idx], infoMap["tsHevcAac"]["kFrames"][idx]);
386 }
387 RemoveValue();
388 selectedTrackIds_.clear();
389 }
390
391 /**
392 * @tc.name: Demuxer_ReadSample_1218
393 * @tc.desc: copy current sample to buffer, local(ts)
394 * @tc.type: FUNC
395 */
396 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1218, TestSize.Level1)
397 {
398 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
399 return;
400 }
401 string path = TEST_FILE_PATH + string("hevc_aac_3840x2160_30frames.ts");
402 ReadSample(path, LOCAL);
403 for (auto idx : selectedTrackIds_) {
404 ASSERT_EQ(frames_[idx], 30);
405 ASSERT_EQ(keyFrames_[idx], 1);
406 }
407 RemoveValue();
408 selectedTrackIds_.clear();
409 }
410
411 /**
412 * @tc.name: Demuxer_ReadSample_1226
413 * @tc.desc: copy current sample to buffer, local
414 * @tc.type: FUNC
415 */
416 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1226, TestSize.Level1)
417 {
418 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
419 return;
420 }
421 ReadSample(g_fmp4HevcPath, LOCAL);
422 for (auto idx : selectedTrackIds_) {
423 ASSERT_EQ(frames_[idx], infoMap["fmp4Hevc"]["frames"][idx]);
424 ASSERT_EQ(keyFrames_[idx], infoMap["fmp4Hevc"]["kFrames"][idx]);
425 }
426 RemoveValue();
427 selectedTrackIds_.clear();
428 }
429
430 /**
431 * @tc.name: Demuxer_ReadSample_1227
432 * @tc.desc: copy current sample to buffer, uri
433 * @tc.type: FUNC
434 */
435 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1227, TestSize.Level1)
436 {
437 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
438 return;
439 }
440 ReadSample(g_fmp4HevcUri, URI);
441 for (auto idx : selectedTrackIds_) {
442 ASSERT_EQ(frames_[idx], infoMap["fmp4Hevc"]["frames"][idx]);
443 ASSERT_EQ(keyFrames_[idx], infoMap["fmp4Hevc"]["kFrames"][idx]);
444 }
445 RemoveValue();
446 selectedTrackIds_.clear();
447 }
448
449 /**
450 * @tc.name: Demuxer_ReadSample_1231
451 * @tc.desc: copy current sample to buffer, local
452 * @tc.type: FUNC
453 */
454 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1231, TestSize.Level1)
455 {
456 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
457 return;
458 }
459 ReadSample(g_doubleVividPath, LOCAL);
460 for (auto idx : selectedTrackIds_) {
461 ASSERT_EQ(frames_[idx], infoMap["doubleVivid"]["frames"][idx]);
462 ASSERT_EQ(keyFrames_[idx], infoMap["doubleVivid"]["kFrames"][idx]);
463 }
464 RemoveValue();
465 selectedTrackIds_.clear();
466 }
467
468 /**
469 * @tc.name: Demuxer_ReadSample_1232
470 * @tc.desc: copy current sample to buffer, uri
471 * @tc.type: FUNC
472 */
473 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1232, TestSize.Level1)
474 {
475 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
476 return;
477 }
478 ReadSample(g_doubleVividUri, URI);
479 for (auto idx : selectedTrackIds_) {
480 ASSERT_EQ(frames_[idx], infoMap["doubleVivid"]["frames"][idx]);
481 ASSERT_EQ(keyFrames_[idx], infoMap["doubleVivid"]["kFrames"][idx]);
482 }
483 RemoveValue();
484 selectedTrackIds_.clear();
485 }
486
487 /**
488 * @tc.name: Demuxer_SeekToTime_1170
489 * @tc.desc: seek to the specified time(h265 mp4 fd)
490 * @tc.type: FUNC
491 */
492 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1170, TestSize.Level1)
493 {
494 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
495 return;
496 }
497 InitResource(g_mp4HevcPath, LOCAL);
498 ASSERT_TRUE(initStatus_);
499 SetInitValue();
500 for (auto idx : selectedTrackIds_) {
501 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
502 }
503 list<int64_t> toPtsList = {0, 1500, 1000, 1740, 1970, 2100}; // ms
504 vector<int32_t> videoVals = {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60};
505 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
506 ASSERT_NE(sharedMem_, nullptr);
507 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
508 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
509 ret_ = demuxer_->SeekToTime(*toPts, *mode);
510 if (ret_ != AV_ERR_OK) {
511 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
512 continue;
513 }
514 ReadData();
515 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
516 ASSERT_EQ(frames_[0], videoVals[numbers_]);
517 numbers_ += 1;
518 RemoveValue();
519 selectedTrackIds_.clear();
520 }
521 }
522 }
523
524 /**
525 * @tc.name: Demuxer_SeekToTime_1171
526 * @tc.desc: seek to the specified time(h265 mp4 uri)
527 * @tc.type: FUNC
528 */
529 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1171, TestSize.Level1)
530 {
531 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
532 return;
533 }
534 InitResource(g_mp4HevcUri, URI);
535 ASSERT_TRUE(initStatus_);
536 SetInitValue();
537 for (auto idx : selectedTrackIds_) {
538 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
539 }
540 list<int64_t> toPtsList = {0, 1500, 1000, 1740, 1970, 2100}; // ms
541 vector<int32_t> videoVals = {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60};
542 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
543 ASSERT_NE(sharedMem_, nullptr);
544 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
545 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
546 ret_ = demuxer_->SeekToTime(*toPts, *mode);
547 if (ret_ != AV_ERR_OK) {
548 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
549 continue;
550 }
551 ReadData();
552 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
553 ASSERT_EQ(frames_[0], videoVals[numbers_]);
554 numbers_ += 1;
555 RemoveValue();
556 selectedTrackIds_.clear();
557 }
558 }
559 }
560
561 /**
562 * @tc.name: Demuxer_SeekToTime_1180
563 * @tc.desc: seek to the specified time(h265+aac(mkv) fd)
564 * @tc.type: FUNC
565 */
566 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1180, TestSize.Level1)
567 {
568 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
569 return;
570 }
571 InitResource(g_mkvHevcAccPath, LOCAL);
572 ASSERT_TRUE(initStatus_);
573 SetInitValue();
574 for (auto idx : selectedTrackIds_) {
575 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
576 }
577 list<int64_t> toPtsList = {0, 1000, 2000, 1500, 2160, 3630, 2850, 4017, 4300}; // ms
578 vector<int32_t> videoVals = {242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
579 242, 242, 242, 242, 242, 242, 242, 242, 242};
580 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
581 ASSERT_NE(sharedMem_, nullptr);
582 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
583 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
584 ret_ = demuxer_->SeekToTime(*toPts, *mode);
585 if (ret_ != AV_ERR_OK) {
586 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
587 continue;
588 }
589 ReadData();
590 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
591 ASSERT_EQ(frames_[0], videoVals[numbers_]);
592 numbers_ += 1;
593 RemoveValue();
594 selectedTrackIds_.clear();
595 }
596 }
597 }
598
599 /**
600 * @tc.name: Demuxer_SeekToTime_1181
601 * @tc.desc: seek to the specified time(h264+opus(mkv) fd)
602 * @tc.type: FUNC
603 */
604 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1181, TestSize.Level1)
605 {
606 InitResource(g_mkvAvcOpusPath, LOCAL);
607 ASSERT_TRUE(initStatus_);
608 SetInitValue();
609 for (auto idx : selectedTrackIds_) {
610 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
611 }
612 list<int64_t> toPtsList = {0, 2000, 1500, 1720, 2700, 3980, 4000, 4100}; // ms
613 vector<int32_t> videoVals = {240, 240, 240, 120, 120, 120, 120, 180, 180,
614 120, 180, 120, 60, 120, 60, 60, 60, 60, 60, 60, 60};
615 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
616 ASSERT_NE(sharedMem_, nullptr);
617 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
618 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
619 ret_ = demuxer_->SeekToTime(*toPts, *mode);
620 if (ret_ != AV_ERR_OK) {
621 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
622 continue;
623 }
624 ReadData();
625 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
626 ASSERT_EQ(frames_[0], videoVals[numbers_]);
627 numbers_ += 1;
628 RemoveValue();
629 selectedTrackIds_.clear();
630 }
631 }
632 }
633
634 /**
635 * @tc.name: Demuxer_SeekToTime_1182
636 * @tc.desc: seek to the specified time(h264+mp3(mkv) fd)
637 * @tc.type: FUNC
638 */
639 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1182, TestSize.Level1)
640 {
641 InitResource(g_mkvAvcMp3Path, LOCAL);
642 ASSERT_TRUE(initStatus_);
643 SetInitValue();
644 for (auto idx : selectedTrackIds_) {
645 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
646 }
647 list<int64_t> toPtsList = {0, 2025, 1500, 1958, 2600, 3400, 3992, 4100}; // ms
648 vector<int32_t> videoVals = {239, 239, 239, 59, 119, 119, 119, 179, 179, 119, 179, 119,
649 59, 119, 59, 59, 59, 59, 59, 59, 59};
650 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
651 ASSERT_NE(sharedMem_, nullptr);
652 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
653 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
654 ret_ = demuxer_->SeekToTime(*toPts, *mode);
655 if (ret_ != AV_ERR_OK) {
656 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
657 continue;
658 }
659 ReadData();
660 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
661 ASSERT_EQ(frames_[0], videoVals[numbers_]);
662 numbers_ += 1;
663 RemoveValue();
664 selectedTrackIds_.clear();
665 }
666 }
667 }
668
669 /**
670 * @tc.name: Demuxer_SeekToTime_2308
671 * @tc.desc: seek to the specified time(h265-pcm), local
672 * @tc.type: FUNC
673 */
674 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_2308, TestSize.Level1)
675 {
676 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
677 return;
678 }
679 InitResource(g_265pcmPath, LOCAL);
680 ASSERT_TRUE(initStatus_);
681 SetInitValue();
682 for (auto idx : selectedTrackIds_) {
683 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
684 }
685 list<int64_t> toPtsList = {0, 4500, 7000, 2000}; // ms
686 vector<int32_t> videoVals = {604, 604, 604, 107, 358, 358, 107, 358, 107, 358, 604, 604};
687 vector<int32_t> audioVals = {433, 433, 433, 76, 257, 257, 76, 257, 76, 256, 433, 433};
688 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
689 ASSERT_NE(sharedMem_, nullptr);
690 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
691 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
692 ret_ = demuxer_->SeekToTime(*toPts, *mode);
693 if (ret_ != AV_ERR_OK) {
694 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
695 continue;
696 }
697 ReadData();
698 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
699 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
700 ASSERT_EQ(frames_[0], videoVals[numbers_]);
701 ASSERT_EQ(frames_[1], audioVals[numbers_]);
702 numbers_ += 1;
703 RemoveValue();
704 selectedTrackIds_.clear();
705 }
706 }
707 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
708 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
709 }
710
711 /**
712 * @tc.name: Demuxer_SeekToTime_2309+
713 * @tc.desc: seek to the specified time(h265-pcm), uri
714 * @tc.type: FUNC
715 */
716 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_2309, TestSize.Level1)
717 {
718 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
719 return;
720 }
721 InitResource(g_265pcmUri, URI);
722 ASSERT_TRUE(initStatus_);
723 SetInitValue();
724 for (auto idx : selectedTrackIds_) {
725 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
726 }
727 list<int64_t> toPtsList = {0, 4500, 7000, 2000}; // ms
728 vector<int32_t> videoVals = {604, 604, 604, 107, 358, 358, 107, 358, 107, 358, 604, 604};
729 vector<int32_t> audioVals = {433, 433, 433, 76, 257, 257, 76, 257, 76, 256, 433, 433};
730 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
731 ASSERT_NE(sharedMem_, nullptr);
732 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
733 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
734 ret_ = demuxer_->SeekToTime(*toPts, *mode);
735 if (ret_ != AV_ERR_OK) {
736 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
737 continue;
738 }
739 ReadData();
740 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
741 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
742 ASSERT_EQ(frames_[0], videoVals[numbers_]);
743 ASSERT_EQ(frames_[1], audioVals[numbers_]);
744 numbers_ += 1;
745 RemoveValue();
746 selectedTrackIds_.clear();
747 }
748 }
749 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
750 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
751 }
752
753 /**
754 * @tc.name: Demuxer_SeekToTime_1183
755 * @tc.desc: seek to the specified time(h265+aac(mkv) uri)
756 * @tc.type: FUNC
757 */
758 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1183, TestSize.Level1)
759 {
760 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
761 return;
762 }
763 InitResource(g_mkvHevcAccUri, URI);
764 ASSERT_TRUE(initStatus_);
765 SetInitValue();
766 for (auto idx : selectedTrackIds_) {
767 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
768 }
769 list<int64_t> toPtsList = {0, 1000, 2000, 1500, 2160, 3630, 2850, 4017, 4300}; // ms
770 vector<int32_t> videoVals = {242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
771 242, 242, 242, 242, 242, 242, 242, 242, 242};
772 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
773 ASSERT_NE(sharedMem_, nullptr);
774 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
775 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
776 ret_ = demuxer_->SeekToTime(*toPts, *mode);
777 if (ret_ != AV_ERR_OK) {
778 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
779 continue;
780 }
781 ReadData();
782 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
783 ASSERT_EQ(frames_[0], videoVals[numbers_]);
784 numbers_ += 1;
785 RemoveValue();
786 selectedTrackIds_.clear();
787 }
788 }
789 }
790
791 /**
792 * @tc.name: Demuxer_SeekToTime_1184
793 * @tc.desc: seek to the specified time(h264+opus(mkv) uri)
794 * @tc.type: FUNC
795 */
796 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1184, TestSize.Level1)
797 {
798 InitResource(g_mkvAvcOpusUri, URI);
799 ASSERT_TRUE(initStatus_);
800 SetInitValue();
801 for (auto idx : selectedTrackIds_) {
802 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
803 }
804 list<int64_t> toPtsList = {0, 2000, 1500, 1720, 2700, 3980, 4000, 4100}; // ms
805 vector<int32_t> videoVals = {240, 240, 240, 120, 120, 120, 120, 180, 180,
806 120, 180, 120, 60, 120, 60, 60, 60, 60, 60, 60, 60};
807 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
808 ASSERT_NE(sharedMem_, nullptr);
809 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
810 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
811 ret_ = demuxer_->SeekToTime(*toPts, *mode);
812 if (ret_ != AV_ERR_OK) {
813 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
814 continue;
815 }
816 ReadData();
817 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
818 ASSERT_EQ(frames_[0], videoVals[numbers_]);
819 numbers_ += 1;
820 RemoveValue();
821 selectedTrackIds_.clear();
822 }
823 }
824 }
825
826 /**
827 * @tc.name: Demuxer_SeekToTime_1185
828 * @tc.desc: seek to the specified time(h264+mp3(mkv) uri)
829 * @tc.type: FUNC
830 */
831 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1185, TestSize.Level1)
832 {
833 InitResource(g_mkvAvcMp3Uri, URI);
834 ASSERT_TRUE(initStatus_);
835 SetInitValue();
836 for (auto idx : selectedTrackIds_) {
837 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
838 }
839 list<int64_t> toPtsList = {0, 2025, 1500, 1958, 2600, 3400, 3992, 4100}; // ms
840 vector<int32_t> videoVals = {239, 239, 239, 59, 119, 119, 119, 179, 179, 119, 179, 119,
841 59, 119, 59, 59, 59, 59, 59, 59, 59};
842 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
843 ASSERT_NE(sharedMem_, nullptr);
844 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
845 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
846 ret_ = demuxer_->SeekToTime(*toPts, *mode);
847 if (ret_ != AV_ERR_OK) {
848 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
849 continue;
850 }
851 ReadData();
852 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
853 ASSERT_EQ(frames_[0], videoVals[numbers_]);
854 numbers_ += 1;
855 RemoveValue();
856 selectedTrackIds_.clear();
857 }
858 }
859 }
860
861 /**
862 * @tc.name: Demuxer_SeekToTime_1190
863 * @tc.desc: seek to the specified time(hdrvivid mp4 fd)
864 * @tc.type: FUNC
865 */
866 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1190, TestSize.Level1)
867 {
868 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
869 return;
870 }
871 InitResource(g_hdrVividPath, LOCAL);
872 ASSERT_TRUE(initStatus_);
873 SetInitValue();
874 for (auto idx : selectedTrackIds_) {
875 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
876 }
877 list<int64_t> toPtsList = {0, 1166, 2000, 1500, 2666, 2800}; // ms
878 vector<int32_t> videoVals = {76, 76, 76, 16, 46, 46, 16, 16, 16, 16, 46, 46, 16, 16};
879 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
880 ASSERT_NE(sharedMem_, nullptr);
881 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
882 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
883 ret_ = demuxer_->SeekToTime(*toPts, *mode);
884 if (ret_ != AV_ERR_OK) {
885 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
886 continue;
887 }
888 ReadData();
889 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
890 ASSERT_EQ(frames_[0], videoVals[numbers_]);
891 numbers_ += 1;
892 RemoveValue();
893 selectedTrackIds_.clear();
894 }
895 }
896 }
897
898 /**
899 * @tc.name: Demuxer_SeekToTime_1191
900 * @tc.desc: seek to the specified time(hdrvivid mp4 uri)
901 * @tc.type: FUNC
902 */
903 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1191, TestSize.Level1)
904 {
905 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
906 return;
907 }
908 InitResource(g_hdrVividUri, URI);
909 ASSERT_TRUE(initStatus_);
910 SetInitValue();
911 for (auto idx : selectedTrackIds_) {
912 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
913 }
914 list<int64_t> toPtsList = {0, 1166, 2000, 1500, 2666, 2800}; // ms
915 vector<int32_t> videoVals = {76, 76, 76, 16, 46, 46, 16, 16, 16, 16, 46, 46, 16, 16};
916 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
917 ASSERT_NE(sharedMem_, nullptr);
918 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
919 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
920 ret_ = demuxer_->SeekToTime(*toPts, *mode);
921 if (ret_ != AV_ERR_OK) {
922 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
923 continue;
924 }
925 ReadData();
926 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
927 ASSERT_EQ(frames_[0], videoVals[numbers_]);
928 numbers_ += 1;
929 RemoveValue();
930 selectedTrackIds_.clear();
931 }
932 }
933 }
934
935 /**
936 * @tc.name: Demuxer_SeekToTime_1192
937 * @tc.desc: seek to the specified time(h265 ts fd)
938 * @tc.type: FUNC
939 */
940 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1192, TestSize.Level1)
941 {
942 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
943 return;
944 }
945 InitResource(g_tsHevcAacPath, LOCAL);
946 ASSERT_TRUE(initStatus_);
947 SetInitValue();
948 for (auto idx : selectedTrackIds_) {
949 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
950 }
951 list<int64_t> toPtsList = {0, 1500, 10000, 4600}; // ms
952 vector<int32_t> videoVals = {303, 303, 303, 258, 258, 258, 3, 3, 3, 165, 165, 165};
953 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
954 ASSERT_NE(sharedMem_, nullptr);
955 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
956 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
957 ret_ = demuxer_->SeekToTime(*toPts, *mode);
958 if (ret_ != AV_ERR_OK) {
959 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
960 continue;
961 }
962 ReadData();
963 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
964 ASSERT_EQ(frames_[0], videoVals[numbers_]);
965 numbers_ += 1;
966 RemoveValue();
967 selectedTrackIds_.clear();
968 }
969 }
970 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
971 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
972 }
973
974 /**
975 * @tc.name: Demuxer_SeekToTime_1193
976 * @tc.desc: seek to the specified time(h265 ts uri)
977 * @tc.type: FUNC
978 */
979 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1193, TestSize.Level1)
980 {
981 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
982 return;
983 }
984 InitResource(g_tsHevcAacUri, URI);
985 ASSERT_TRUE(initStatus_);
986 SetInitValue();
987 for (auto idx : selectedTrackIds_) {
988 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
989 }
990 list<int64_t> toPtsList = {0, 1500, 10000, 4600}; // ms
991 vector<int32_t> videoVals = {303, 303, 303, 258, 258, 258, 3, 3, 3, 165, 165, 165};
992 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
993 ASSERT_NE(sharedMem_, nullptr);
994 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
995 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
996 ret_ = demuxer_->SeekToTime(*toPts, *mode);
997 if (ret_ != AV_ERR_OK) {
998 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
999 continue;
1000 }
1001 ReadData();
1002 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1003 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1004 numbers_ += 1;
1005 RemoveValue();
1006 selectedTrackIds_.clear();
1007 }
1008 }
1009 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1010 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1011 }
1012
1013 /**
1014 * @tc.name: Demuxer_SeekToTime_1198
1015 * @tc.desc: seek to the specified time(h265 fmp4 fd)
1016 * @tc.type: FUNC
1017 */
1018 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1198, TestSize.Level1)
1019 {
1020 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1021 return;
1022 }
1023 InitResource(g_fmp4HevcPath, LOCAL);
1024 ASSERT_TRUE(initStatus_);
1025 SetInitValue();
1026 for (auto idx : selectedTrackIds_) {
1027 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1028 }
1029 list<int64_t> toPtsList = {0, 4500, 7000, 2000}; // ms
1030 vector<int32_t> videoVals = {604, 604, 604, 107, 358, 358, 107, 358, 107, 358, 604, 604};
1031 vector<int32_t> audioVals = {433, 433, 433, 78, 259, 259, 78, 259, 78, 258, 433, 433};
1032 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1033 ASSERT_NE(sharedMem_, nullptr);
1034 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1035 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1036 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1037 if (ret_ != AV_ERR_OK) {
1038 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1039 continue;
1040 }
1041 ReadData();
1042 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1043 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
1044 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1045 ASSERT_EQ(frames_[1], audioVals[numbers_]);
1046 numbers_ += 1;
1047 RemoveValue();
1048 selectedTrackIds_.clear();
1049 }
1050 }
1051 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1052 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1053 }
1054
1055 /**
1056 * @tc.name: Demuxer_SeekToTime_1199
1057 * @tc.desc: seek to the specified time(h265 fmp4 uri)
1058 * @tc.type: FUNC
1059 */
1060 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1199, TestSize.Level1)
1061 {
1062 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1063 return;
1064 }
1065 InitResource(g_fmp4HevcUri, URI);
1066 ASSERT_TRUE(initStatus_);
1067 SetInitValue();
1068 for (auto idx : selectedTrackIds_) {
1069 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1070 }
1071 list<int64_t> toPtsList = {0, 4500, 7000, 2000}; // ms
1072 vector<int32_t> videoVals = {604, 604, 604, 107, 358, 358, 107, 358, 107, 358, 604, 604};
1073 vector<int32_t> audioVals = {433, 433, 433, 78, 259, 259, 78, 259, 78, 258, 433, 433};
1074 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1075 ASSERT_NE(sharedMem_, nullptr);
1076 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1077 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1078 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1079 if (ret_ != AV_ERR_OK) {
1080 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1081 continue;
1082 }
1083 ReadData();
1084 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1085 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
1086 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1087 ASSERT_EQ(frames_[1], audioVals[numbers_]);
1088 numbers_ += 1;
1089 RemoveValue();
1090 selectedTrackIds_.clear();
1091 }
1092 }
1093 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1094 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1095 }
1096
1097 /**
1098 * @tc.name: Demuxer_SeekToTime_1207
1099 * @tc.desc: seek to the specified time(doublevivid fd)
1100 * @tc.type: FUNC
1101 */
1102 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1207, TestSize.Level1)
1103 {
1104 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1105 return;
1106 }
1107 InitResource(g_doubleVividPath, LOCAL);
1108 ASSERT_TRUE(initStatus_);
1109 SetInitValue();
1110 for (auto idx : selectedTrackIds_) {
1111 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1112 }
1113 list<int64_t> toPtsList = {0, 1166, 2000, 1500, 2666, 2800}; // ms
1114 vector<int32_t> videoVals = {76, 76, 76, 46, 46, 46, 16, 46, 16, 16, 46, 46, 16, 16};
1115 vector<int32_t> audioVals = {116, 116, 116, 65, 66, 65, 22, 66, 22, 22, 66, 66, 23, 23};
1116 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1117 ASSERT_NE(sharedMem_, nullptr);
1118 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1119 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1120 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1121 if (ret_ != AV_ERR_OK) {
1122 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1123 continue;
1124 }
1125 ReadData();
1126 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1127 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
1128 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1129 ASSERT_EQ(frames_[1], audioVals[numbers_]);
1130 numbers_ += 1;
1131 RemoveValue();
1132 selectedTrackIds_.clear();
1133 }
1134 }
1135 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1136 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1137 }
1138
1139 /**
1140 * @tc.name: Demuxer_SeekToTime_1208
1141 * @tc.desc: seek to the specified time(doublevivid fd)
1142 * @tc.type: FUNC
1143 */
1144 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1208, TestSize.Level1)
1145 {
1146 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1147 return;
1148 }
1149 InitResource(g_doubleVividUri, URI);
1150 ASSERT_TRUE(initStatus_);
1151 SetInitValue();
1152 for (auto idx : selectedTrackIds_) {
1153 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1154 }
1155 list<int64_t> toPtsList = {0, 1166, 2000, 1500, 2666, 2800}; // ms
1156 vector<int32_t> videoVals = {76, 76, 76, 46, 46, 46, 16, 46, 16, 16, 46, 46, 16, 16};
1157 vector<int32_t> audioVals = {116, 116, 116, 65, 66, 65, 22, 66, 22, 22, 66, 66, 23, 23};
1158 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1159 ASSERT_NE(sharedMem_, nullptr);
1160 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1161 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1162 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1163 if (ret_ != AV_ERR_OK) {
1164 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1165 continue;
1166 }
1167 ReadData();
1168 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1169 printf("time = %" PRId64 " | frames_[1]=%d\n", *toPts, frames_[1]);
1170 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1171 ASSERT_EQ(frames_[1], audioVals[numbers_]);
1172 numbers_ += 1;
1173 RemoveValue();
1174 selectedTrackIds_.clear();
1175 }
1176 }
1177 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1178 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1179 }
1180
1181 /**
1182 * @tc.name: Demuxer_ReadSample_1401
1183 * @tc.desc: copy current sample to buffer(flv_enhanced)
1184 * @tc.type: FUNC
1185 */
1186 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1401, TestSize.Level1)
1187 {
1188 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1189 return;
1190 }
1191 InitResource(g_flvPath, LOCAL);
1192 ASSERT_TRUE(initStatus_);
1193 ASSERT_EQ(demuxer_->SelectTrackByID(0), AV_ERR_OK);
1194 ASSERT_EQ(demuxer_->SelectTrackByID(1), AV_ERR_OK);
1195 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1196 ASSERT_NE(sharedMem_, nullptr);
1197 SetInitValue();
1198 while (!isEOS(eosFlag_)) {
1199 for (auto idx : selectedTrackIds_) {
1200 ASSERT_EQ(demuxer_->ReadSample(idx, sharedMem_, &info_, flag_), AV_ERR_OK);
1201 CountFrames(idx);
1202 }
1203 }
1204 printf("frames_[0]=%d | kFrames[0]=%d\n", frames_[0], keyFrames_[0]);
1205 printf("frames_[1]=%d | kFrames[1]=%d\n", frames_[1], keyFrames_[1]);
1206 ASSERT_EQ(frames_[0], 76);
1207 ASSERT_EQ(frames_[1], 113);
1208 ASSERT_EQ(keyFrames_[0], 1);
1209 ASSERT_EQ(keyFrames_[1], 113);
1210 RemoveValue();
1211 }
1212
1213 /**
1214 * @tc.name: Demuxer_ReadSample_1402
1215 * @tc.desc: copy current sample to buffer(flv_enhanced uri)
1216 * @tc.type: FUNC
1217 */
1218 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1402, TestSize.Level1)
1219 {
1220 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1221 return;
1222 }
1223 InitResource(g_flvUri, URI);
1224 ASSERT_TRUE(initStatus_);
1225 ASSERT_EQ(demuxer_->SelectTrackByID(0), AV_ERR_OK);
1226 ASSERT_EQ(demuxer_->SelectTrackByID(1), AV_ERR_OK);
1227 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1228 ASSERT_NE(sharedMem_, nullptr);
1229 SetInitValue();
1230 while (!isEOS(eosFlag_)) {
1231 for (auto idx : selectedTrackIds_) {
1232 ASSERT_EQ(demuxer_->ReadSample(idx, sharedMem_, &info_, flag_), AV_ERR_OK);
1233 CountFrames(idx);
1234 }
1235 }
1236 printf("frames_[0]=%d | kFrames[0]=%d\n", frames_[0], keyFrames_[0]);
1237 printf("frames_[1]=%d | kFrames[1]=%d\n", frames_[1], keyFrames_[1]);
1238 ASSERT_EQ(frames_[0], 76);
1239 ASSERT_EQ(frames_[1], 113);
1240 ASSERT_EQ(keyFrames_[0], 1);
1241 ASSERT_EQ(keyFrames_[1], 113);
1242 RemoveValue();
1243 }
1244
1245 /**
1246 * @tc.name: Demuxer_SeekToTime_1203
1247 * @tc.desc: seek to the specified time(h265 flv uri)
1248 * @tc.type: FUNC
1249 */
1250 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1203, TestSize.Level1)
1251 {
1252 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1253 return;
1254 }
1255 InitResource(g_flvUri, URI);
1256 ASSERT_TRUE(initStatus_);
1257 SetInitValue();
1258 for (auto idx : selectedTrackIds_) {
1259 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1260 }
1261 list<int64_t> toPtsList = {0, 1500, 1000, 1740, 1970, 2100}; // ms
1262 vector<int32_t> videoVals = {76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76};
1263 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1264 ASSERT_NE(sharedMem_, nullptr);
1265 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1266 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1267 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1268 if (ret_ != AV_ERR_OK) {
1269 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1270 continue;
1271 }
1272 ReadData();
1273 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1274 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1275 numbers_ += 1;
1276 RemoveValue();
1277 selectedTrackIds_.clear();
1278 }
1279 }
1280 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1281 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1282 }
1283
1284 /**
1285 * @tc.name: Demuxer_SeekToTime_1204
1286 * @tc.desc: seek to the specified time(h265 flv local)
1287 * @tc.type: FUNC
1288 */
1289 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1204, TestSize.Level1)
1290 {
1291 if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) {
1292 return;
1293 }
1294 InitResource(g_flvPath, LOCAL);
1295 ASSERT_TRUE(initStatus_);
1296 SetInitValue();
1297 for (auto idx : selectedTrackIds_) {
1298 ASSERT_EQ(demuxer_->SelectTrackByID(idx), AV_ERR_OK);
1299 }
1300 list<int64_t> toPtsList = {0, 1500, 1000, 1740, 1970, 2100}; // ms
1301 vector<int32_t> videoVals = {76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76};
1302 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1303 ASSERT_NE(sharedMem_, nullptr);
1304 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1305 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1306 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1307 if (ret_ != AV_ERR_OK) {
1308 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1309 continue;
1310 }
1311 ReadData();
1312 printf("time = %" PRId64 " | frames_[0]=%d\n", *toPts, frames_[0]);
1313 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1314 numbers_ += 1;
1315 RemoveValue();
1316 selectedTrackIds_.clear();
1317 }
1318 }
1319 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1320 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1321 }
1322
1323 /**
1324 * @tc.name: Demuxer_ReadSample_1412
1325 * @tc.desc: copy current sample to buffer(h265 hls uri)
1326 * @tc.type: FUNC
1327 */
1328 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1412, TestSize.Level1)
1329 {
1330 if (g_hls.find(TEST_URI_PATH2) != std::string::npos) {
1331 return;
1332 }
1333 InitResource(g_hls, URI);
1334 ASSERT_TRUE(initStatus_);
1335 ASSERT_EQ(demuxer_->SelectTrackByID(0), AV_ERR_OK);
1336 ASSERT_EQ(demuxer_->SelectTrackByID(1), AV_ERR_OK);
1337 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1338 ASSERT_NE(sharedMem_, nullptr);
1339 SetInitValue();
1340 while (!isEOS(eosFlag_)) {
1341 for (auto idx : selectedTrackIds_) {
1342 ASSERT_EQ(demuxer_->ReadSample(idx, sharedMem_, &info_, flag_), AV_ERR_OK);
1343 CountFrames(idx);
1344 }
1345 }
1346 printf("frames_[0]=%d | kFrames[0]=%d\n", frames_[0], keyFrames_[0]);
1347 printf("frames_[1]=%d | kFrames[1]=%d\n", frames_[1], keyFrames_[1]);
1348 ASSERT_EQ(frames_[0], 602);
1349 ASSERT_EQ(frames_[1], 433);
1350 ASSERT_EQ(keyFrames_[0], 3);
1351 ASSERT_EQ(keyFrames_[1], 433);
1352 RemoveValue();
1353 }
1354
1355 /**
1356 * @tc.name: Demuxer_SeekToTime_1413
1357 * @tc.desc: seek to the specified time(h265 hls uri)
1358 * @tc.type: FUNC
1359 */
1360 HWTEST_F(DemuxerUnitTest, Demuxer_SeekToTime_1413, TestSize.Level1)
1361 {
1362 if (g_hls.find(TEST_URI_PATH2) != std::string::npos) {
1363 return;
1364 }
1365 InitResource(g_hls, URI);
1366 ASSERT_TRUE(initStatus_);
1367 ASSERT_EQ(demuxer_->SelectTrackByID(0), AV_ERR_OK);
1368 ASSERT_EQ(demuxer_->SelectTrackByID(1), AV_ERR_OK);
1369 list<int64_t> toPtsList = {0, 4500, 7000, 2000, 10000}; // ms
1370 vector<int32_t> videoVals = {602, 602, 602, 102, 352, 352, 102, 352, 102, 352, 602, 602, 102, 102};
1371 vector<int32_t> audioVals = {433, 433, 433, 74, 254, 254, 74, 254, 74, 253, 433, 433, 75, 75};
1372 sharedMem_ = AVMemoryMockFactory::CreateAVMemoryMock(bufferSize_);
1373 ASSERT_NE(sharedMem_, nullptr);
1374 for (auto toPts = toPtsList.begin(); toPts != toPtsList.end(); toPts++) {
1375 for (auto mode = seekModes.begin(); mode != seekModes.end(); mode++) {
1376 ret_ = demuxer_->SeekToTime(*toPts, *mode);
1377 if (ret_ != AV_ERR_OK) {
1378 printf("seek failed, time = %" PRId64 " | ret = %d\n", *toPts, ret_);
1379 continue;
1380 }
1381 ReadData();
1382 printf("time = %" PRId64 " | frames_[0]=%d | kFrames[0]=%d\n", *toPts, frames_[0], keyFrames_[0]);
1383 printf("time = %" PRId64 " | frames_[1]=%d | kFrames[1]=%d\n", *toPts, frames_[1], keyFrames_[1]);
1384 ASSERT_EQ(frames_[0], videoVals[numbers_]);
1385 ASSERT_EQ(frames_[1], audioVals[numbers_]);
1386 numbers_ += 1;
1387 RemoveValue();
1388 selectedTrackIds_.clear();
1389 }
1390 }
1391 ASSERT_NE(demuxer_->SeekToTime(11000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1392 ASSERT_NE(demuxer_->SeekToTime(-1000, SeekMode::SEEK_NEXT_SYNC), AV_ERR_OK);
1393 }
1394
1395 /**
1396 * @tc.name: Demuxer_ReadSample_1200
1397 * @tc.desc: copy current sample to buffer, local
1398 * @tc.type: FUNC
1399 */
1400 HWTEST_F(DemuxerUnitTest, Demuxer_ReadSample_1700, TestSize.Level1)
1401 {
1402 if (access(g_mp4265InfoParsePath.c_str(), F_OK) != 0) {
1403 return;
1404 }
1405 ReadSample(g_mp4265InfoParsePath, LOCAL, true);
1406 for (auto idx : selectedTrackIds_) {
1407 ASSERT_EQ(frames_[idx], infoMap["mp4265InfoParse"]["frames"][idx]);
1408 ASSERT_EQ(keyFrames_[idx], infoMap["mp4265InfoParse"]["kFrames"][idx]);
1409 }
1410 RemoveValue();
1411 selectedTrackIds_.clear();
1412 }
1413 } // namespace
1414