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

Function process_client_msg

cmdline/example/syncPlayer.cpp:182–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180};
181
182static void process_client_msg(cicadaCont &cicada, unique_ptr<messageClient> &client, string &msg, bool &quite)
183{
184 msg = client->readMessage();
185 if (!msg.empty()) {
186 AF_LOGE("client msg %s\n", msg.c_str());
187 if (msg == playerMessage::start) {
188 cicada.player->Start();
189 cicada.masterClock.start();
190 } else if (msg == playerMessage::pause) {
191 cicada.player->Pause();
192 cicada.masterClock.pause();
193 } else if (msg == playerMessage::exit) {
194 quite = true;
195 } else if (msg == playerMessage::prepare) {
196 cicada.player->Prepare();
197 } else if (msg == playerMessage::clock) {
198 int64_t pts = atoll(client->readMessage().c_str());
199 cicada.masterClock.set(pts);
200 if (llabs(pts - cicada.player->GetMasterClockPts()) > 40000) {
201 AF_LOGW("delta pts is %lld\n", pts - cicada.player->GetMasterClockPts());
202 }
203 } else if (msg == playerMessage::fullScreen) {
204#ifdef ENABLE_SDL
205 bool full = atoll(client->readMessage().c_str()) != 0;
206 SDL_SetWindowFullscreen(cicada.window, full ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
207#endif
208 } else if (msg == playerMessage::seekAccurate) {
209 int64_t ms = atoll(client->readMessage().c_str());
210 cicada.player->SeekTo(ms, SEEK_MODE_ACCURATE);
211 } else if (msg == playerMessage::seek) {
212 int64_t ms = atoll(client->readMessage().c_str());
213 cicada.player->SeekTo(ms, SEEK_MODE_INACCURATE);
214 }
215 }
216}
217int main(int argc, const char **argv)
218{
219 string url;

Callers 1

mainFunction · 0.85

Calls 10

readMessageMethod · 0.80
startMethod · 0.65
pauseMethod · 0.65
emptyMethod · 0.45
StartMethod · 0.45
PauseMethod · 0.45
PrepareMethod · 0.45
setMethod · 0.45
GetMasterClockPtsMethod · 0.45
SeekToMethod · 0.45

Tested by

no test coverage detected