more stream progress, threaded connections toxav video sending

This commit is contained in:
2024-09-16 20:24:07 +02:00
parent 964f6de656
commit b4373e0d9a
10 changed files with 395 additions and 141 deletions

View File

@ -126,7 +126,7 @@ SDLVideoCameraContent::SDLVideoCameraContent(void) {
bool someone_listening {false};
{
SDLVideoFrame new_frame_non_owning {
timestampNS,
timestampNS/1000,
sdl_frame_next
};

View File

@ -12,7 +12,8 @@ inline void nopSurfaceDestructor(SDL_Surface*) {}
// this is very sdl specific
struct SDLVideoFrame {
// TODO: sequence numbering?
uint64_t timestampNS {0};
// micro seconds (nano is way too much)
uint64_t timestampUS {0};
std::unique_ptr<SDL_Surface, decltype(&SDL_DestroySurface)> surface {nullptr, &SDL_DestroySurface};
@ -21,12 +22,12 @@ struct SDLVideoFrame {
uint64_t ts,
SDL_Surface* surf
) {
timestampNS = ts;
timestampUS = ts;
surface = {surf, &nopSurfaceDestructor};
}
// copy
SDLVideoFrame(const SDLVideoFrame& other) {
timestampNS = other.timestampNS;
timestampUS = other.timestampUS;
if (static_cast<bool>(other.surface)) {
//surface = {
// SDL_CreateSurface(
@ -39,7 +40,7 @@ struct SDLVideoFrame {
//SDL_BlitSurface(other.surface.get(), nullptr, surface.get(), nullptr);
surface = {
SDL_DuplicateSurface(other.surface.get()),
&SDL_DestroySurface
&SDL_DestroySurface
};
}
}