| 392 | } |
| 393 | |
| 394 | void SrtMainLoop::InputRunner() |
| 395 | { |
| 396 | srt::ThreadName::set("InputRN"); |
| 397 | // An extra thread with a loop that reads from the external input |
| 398 | // and writes into the SRT medium. When echoback mode is used, |
| 399 | // this thread isn't started at all and instead the SRT reading |
| 400 | // serves as both SRT reading and input reading. |
| 401 | |
| 402 | auto on_return_set = OnReturnSet(m_input_running, false); |
| 403 | |
| 404 | Verb() << VerbLock << "RUNNING INPUT LOOP"; |
| 405 | for (;;) |
| 406 | { |
| 407 | applog.Debug() << "SrtMainLoop::InputRunner: extracting..."; |
| 408 | auto data = m_input_medium.Extract(); |
| 409 | |
| 410 | if (data.payload.empty()) |
| 411 | { |
| 412 | Verb() << "INPUT READING INTERRUPTED."; |
| 413 | break; |
| 414 | } |
| 415 | |
| 416 | //Verb() << "INPUT [" << data.size() << "] " << VerbNoEOL; |
| 417 | applog.Debug() << "SrtMainLoop::InputRunner: [" << data.payload.size() << "] CLIENT -> SRT-RELAY"; |
| 418 | m_srt_relay->Write(data); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | void SrtMainLoop::run() |
| 423 | { |