Skip to content

Abstracted some complexity related to WebcamStream.#3004

Open
slaff wants to merge 20 commits intoSmingHub:developfrom
slaff:feature/webcam-fps
Open

Abstracted some complexity related to WebcamStream.#3004
slaff wants to merge 20 commits intoSmingHub:developfrom
slaff:feature/webcam-fps

Conversation

@slaff
Copy link
Contributor

@slaff slaff commented Feb 9, 2026

Every camera should be able to report its frames per second.

Every camera should be able to report its frames per second.
@slaff slaff added this to the 6.3.0 milestone Feb 9, 2026
@what-the-diff
Copy link

what-the-diff bot commented Feb 9, 2026

PR Summary

  • Introduction of Frame Rate Retrieval Function
    A new function getFramesPerSecond(), has been added to the CameraInterface. This function fetches the frame rate from the camera, which is essential information for processing video data.

  • New Fixed Frame Rate for FakeCamera
    The getFramesPerSecond() function has been implemented in FakeCamera to return a fixed frame rate of 10 fps for testing purposes.

  • Creation of WebcamPictureStream Class
    A new class, WebcamPictureStream, has been introduced for managing streams of images from the camera. This class will handle the continuous flow of frames coming in from the camera.

  • Enhancement of WebcamStream
    The WebcamStream class has been updated to extend MultipartStream, and it now utilizes WebcamPictureStream. This change integrates the newly introduced class into the existing stream management infrastructure.

  • Rate Control in ReadMemoryBlock()
    The readMemoryBlock() function in WebcamStream has been refactored. It now integrates frame rate controls to ensure that frames are produced consistently at the defined frames per second. This ensures smoother and more consistent video output.

  • Snapshot Function Replaced
    The old snapshot producer function in application.cpp has been replaced. The application now directly uses WebcamStream, simplifying the process of capturing frames from the camera.

  • Code Clean-Up
    Several unnecessary lines of code have been removed, and other sections have been cleaned up for increased readability. This makes the code easier to understand and maintain.

@slaff slaff requested a review from mikee47 February 9, 2026 11:28
@slaff slaff requested a review from mikee47 February 9, 2026 16:26
Copy link
Contributor

@mikee47 mikee47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting any images through on the web interface. Tried in in host and on esp8266...

spiffs_mount();

WifiStation.enable(true);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed this as well:

WifiStation.config(WIFI_SSID, WIFI_PWD);
WifiAccessPoint.enable(false);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting any images through on the web interface. Tried in in host and on esp8266...

Strange. I am able to get images using Host and Esp8266 MCU. Without making changes to the WIFI setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with my phone, and it works. But not with firefox on Fedora desktop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So with it running on the phone, as soon as I try to view on desktop the phone one stops.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I installed chromium and that works. But can only stream to one client at a time, even with framerate reduced to 5.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the above WiFi setup, the esp8266 only works in AP mode. (Try make flashinit && make flash)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But can only stream to one client at a time,

Now you should be able to have multiple clients running at the same time...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frame rate regulation doesn't seem to work for me. Either I get full frame rate or 1 frame per second. Also seems like a use for timer classes - I've been playing around with this https://github.com/mikee47/Sming/tree/feature/webcam-fps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mikee47. I have merged your changes into this PR. Will test it later today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frame rate regulation doesn't seem to work for me.

Tried with your timer code which is integrated into this PR. The visible frame rate still does not match the expected :(.

slav-at-attachix and others added 14 commits February 10, 2026 13:54
…e the snapshots. Which is very energy intensive even if there are zero consumers.
1. Less camera operations: The camera till capture a picture only if there is at least one request.
2. Less network traffic: New image on the same TCP socket will be sent only when there is a new image. The old version used to send over and over again the same image until it has changed.
Every camera should be able to report its frames per second.
…e the snapshots. Which is very energy intensive even if there are zero consumers.
1. Less camera operations: The camera till capture a picture only if there is at least one request.
2. Less network traffic: New image on the same TCP socket will be sent only when there is a new image. The old version used to send over and over again the same image until it has changed.
@slaff slaff force-pushed the feature/webcam-fps branch from dbd74ad to f3b428b Compare February 19, 2026 10:07
slav-at-attachix and others added 3 commits February 19, 2026 11:11
Author:    mikee47 <mike@sillyhouse.net>
Date:      Thu Feb 12 11:40:05 2026 +0000
@slaff slaff force-pushed the feature/webcam-fps branch from 8be125f to 34dd43c Compare February 19, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants