Skip to content

Conversation

futz12
Copy link
Contributor

@futz12 futz12 commented May 4, 2025

test on windows10 & msvc 2022 and wsl(ubuntu) & gcc

@nihui nihui requested a review from Copilot May 5, 2025 06:13
Copy link

@Copilot Copilot AI left a 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

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);
Copy link
Preview

Copilot AI May 5, 2025

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.

@futz12
Copy link
Contributor Author

futz12 commented Aug 3, 2025

@nihui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants