MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / seek_thread

Function seek_thread

framework/data_source/data_source_test.cpp:57–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57static void *seek_thread
58(void *arg)
59{
60 mainCont *pHandle = (mainCont *) arg;
61 auto *pDownloader = pHandle->pDownloader;
62 int total_size = 0;
63 int ret;
64 int read_size = 1024;
65 int64_t seekPos = 0;
66 auto *buffer = static_cast<uint8_t *>(malloc(static_cast<size_t>(read_size + 1)));
67
68 do {
69 ret = pDownloader->Read(buffer, read_size);
70
71 if (ret > 0) {
72 total_size += ret;
73 // buffer[ret] = 0;
74 // printf("%s", buffer);
75 }
76
77// seekPos = rand() % pHandle->fileSize;
78// printf("seek to %lli\n", seekPos);
79// pDownloader->Seek(seekPos, SEEK_SET);
80 } while (ret > 0 && !pHandle->isCanceled);
81
82 // printf("\n");
83 if (ret < 0) {
84 printf("read error %d (%s)\n", ret, pDownloader->Get_error_info(ret).c_str());
85 }
86
87 printf("total_size is %d\n", total_size);
88 free(buffer);
89 pHandle->isEOS = true;
90 return nullptr;
91}
92
93
94int main(int argc, const char **argv)

Callers

nothing calls this directly

Calls 2

ReadMethod · 0.45
Get_error_infoMethod · 0.45

Tested by

no test coverage detected