mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
cscore: Support multiple levels of JPEG compression (#1223)
This allows two streams with different compression levels, and also allows a stream to receive a different compression level than provided by a JPEG camera (decompress and recompress).
This commit is contained in:
@@ -114,7 +114,7 @@ class MjpegServerImpl::ConnThread : public wpi::SafeThread {
|
||||
|
||||
int m_width{0};
|
||||
int m_height{0};
|
||||
int m_compression{80};
|
||||
int m_compression{-1};
|
||||
int m_fps{0};
|
||||
};
|
||||
|
||||
@@ -635,8 +635,8 @@ void MjpegServerImpl::ConnThread::SendStream(wpi::raw_socket_ostream& os) {
|
||||
|
||||
int width = m_width != 0 ? m_width : frame.GetOriginalWidth();
|
||||
int height = m_height != 0 ? m_height : frame.GetOriginalHeight();
|
||||
Image* image =
|
||||
frame.GetImage(width, height, VideoMode::kMJPEG, m_compression);
|
||||
Image* image = frame.GetImageMJPEG(
|
||||
width, height, m_compression, m_compression == -1 ? 80 : m_compression);
|
||||
if (!image) {
|
||||
// Shouldn't happen, but just in case...
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
@@ -695,7 +695,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() {
|
||||
// Reset per-request settings
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
m_compression = 80;
|
||||
m_compression = -1;
|
||||
m_fps = 0;
|
||||
|
||||
// Read the request string from the stream
|
||||
|
||||
Reference in New Issue
Block a user