-
-
Notifications
You must be signed in to change notification settings - Fork 417
httpjpg for windows #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
httpjpg for windows #196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces Windows support for the HTTP JPEG streaming feature (“httpjpg”) by adding conditional compilation branches for Windows in both the highgui writer and the videowriter modules.
- Updated copyright and attribution.
- Added Win32-specific networking, thread creation, and synchronization code.
- Adjusted conditional compilation in videowriter to include Windows.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
highgui/src/writer_http.h | Updated copyright header with new attribution. |
highgui/src/writer_http.cpp | Added Windows-specific network/socket, thread and sync code; refactored status checks using a helper function. |
highgui/src/videowriter.cpp | Modified conditional compilation to include Windows support for httpjpg. |
Files not reviewed (1)
- highgui/CMakeLists.txt: Language not supported
while (jpg_data) | ||
{ | ||
while (jpg_data) | ||
{ | ||
pthread_cond_wait(&cond, &mutex); | ||
} | ||
SleepConditionVariableCS(&cond, &mutex, INFINITE); | ||
} | ||
|
||
jpgbuf = _jpgbuf; | ||
jpg_data = jpgbuf.data(); | ||
jpg_size = jpgbuf.size(); | ||
jpgbuf = _jpgbuf; | ||
jpg_data = jpgbuf.data(); | ||
jpg_size = (int)jpgbuf.size(); | ||
LeaveCriticalSection(&mutex); | ||
WakeConditionVariable(&cond); | ||
#else | ||
pthread_mutex_lock(&mutex); | ||
while (jpg_data) | ||
{ | ||
pthread_cond_wait(&cond, &mutex); | ||
} | ||
pthread_mutex_unlock(&mutex); | ||
|
||
jpgbuf = _jpgbuf; | ||
jpg_data = jpgbuf.data(); | ||
jpg_size = (int)jpgbuf.size(); | ||
pthread_mutex_unlock(&mutex); | ||
pthread_cond_signal(&cond); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Review the concurrency pattern in writer_http_impl::write_jpgbuf to ensure that the Windows (using SleepConditionVariableCS) and POSIX (using pthread_cond_wait) branches provide identical behavior and avoid race conditions.
Copilot uses AI. Check for mistakes.
test on windows10 & msvc 2022 and wsl(ubuntu) & gcc