MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / update

Method update

src/input/stream/Streamer.cpp:158–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 bool Streamer::update() {
159 SI_LOG_INFO("Stream: %d, Updating frontend...", _streamID);
160 if (_deviceData.hasDeviceDataChanged()) {
161 _deviceData.resetDeviceDataChanged();
162 _udpMultiListen.closeFD();
163 }
164 if (_udpMultiListen.getFD() == -1) {
165 // Open mutlicast stream
166 const std::string multiAddr = _deviceData.getMultiAddr();
167 const int port = _deviceData.getPort();
168 if(initMutlicastUDPSocket(_udpMultiListen, multiAddr, _bindIPAddress, port)) {
169 SI_LOG_INFO("Stream: %d, Streamer reading from: %s:%d fd %d", _streamID,
170 multiAddr.c_str(), port, _udpMultiListen.getFD());
171 // set receive buffer to 8MB
172 constexpr int bufferSize = 1024 * 1024 * 8;
173 _udpMultiListen.setNetworkReceiveBufferSize(bufferSize);
174
175 _pfd[0].events = POLLIN | POLLHUP | POLLRDNORM | POLLERR;
176 _pfd[0].revents = 0;
177 _pfd[0].fd = _udpMultiListen.getFD();
178
179 } else {
180 SI_LOG_ERROR("Stream: %d, Init UDP Multicast socket failed", _streamID);
181 }
182 }
183 SI_LOG_DEBUG("Stream: %d, Updating frontend (Finished)", _streamID);
184 return true;
185 }
186
187 bool Streamer::teardown() {
188 _deviceData.initialize();

Callers

nothing calls this directly

Calls 7

getFDMethod · 0.80
getMultiAddrMethod · 0.80
getPortMethod · 0.80
hasDeviceDataChangedMethod · 0.45
closeFDMethod · 0.45

Tested by

no test coverage detected