ModernCppCI | This is an example of doing a Modern C project | Continous Integration library
kandi X-RAY | ModernCppCI Summary
kandi X-RAY | ModernCppCI Summary
This is an example of doing a Modern C++ project with CI
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ModernCppCI
ModernCppCI Key Features
ModernCppCI Examples and Code Snippets
Community Discussions
Trending Discussions on ModernCppCI
QUESTION
I use UDP socket to stream image from client to server. For encoding and decoding I use OpenCV. Sometimes I get a wrong decoded image, because one or some packet is lossed (only the header is sent, please see my terminal screen for some info). I have to reduce the quality of jpeg to only 30 to decrease wrong decode image ratio. How can I use condition code to ignore that frame (not do decode work) in which some packet is lossed , or not show the wrong decoded image in imshow function.
Here's the wrong decoded image:
Terminal trace screen:
My Client code:
...ANSWER
Answered 2017-Aug-03 at 08:14If I get your problem correctly, your protocol is:
- Send header (ibuf), which contains number N of expected data packets.
- Send N data packets
and what happens on server side is:
- Receive header
- Receive N-1 data packets (one is lost)
- Receive next header as data packet and throw away current frame.
- Wait whole frame for new header, thus 2 frames are lost.
The thing you miss here is distinguishment between header and data packet. The easiest way that you already use is checking size of packet. Knowing that you can determine what to do with current packet - is it beggining of new frame (so previous is gone) or new data. With that you can start reading new frame and lose only when packet got lost.
This snippet shows an idea of it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ModernCppCI
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page