Open
Conversation
There was a problem hiding this comment.
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
Comment on lines
+283
to
304
| 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.
[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.
Contributor
Author
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test on windows10 & msvc 2022 and wsl(ubuntu) & gcc