Fix test endpoints reporting pre-filter image dimensions

- WebSocket test: move w,h capture to after PP filter application
  so downscaler effect is reflected in reported resolution
- HTTP test: read actual thumbnail dimensions from filtered image
  instead of using pre-computed values

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 01:10:23 +03:00
parent ec58282c19
commit 90acae5207
2 changed files with 5 additions and 3 deletions

View File

@@ -188,12 +188,13 @@ async def stream_capture_test(
tc = total_capture_time tc = total_capture_time
fps = fc / elapsed if elapsed > 0 else 0 fps = fc / elapsed if elapsed > 0 else 0
avg_ms = (tc / fc * 1000) if fc > 0 else 0 avg_ms = (tc / fc * 1000) if fc > 0 else 0
w, h = final_frame.size
# Apply PP filters to final images # Apply PP filters to final images
if pp_filters: if pp_filters:
final_frame = _apply_pp_filters(final_frame, pp_filters) final_frame = _apply_pp_filters(final_frame, pp_filters)
w, h = final_frame.size
full_uri = _encode_jpeg(final_frame, FINAL_JPEG_QUALITY) full_uri = _encode_jpeg(final_frame, FINAL_JPEG_QUALITY)
thumb = _make_thumbnail(final_frame, FINAL_THUMBNAIL_WIDTH) thumb = _make_thumbnail(final_frame, FINAL_THUMBNAIL_WIDTH)
thumb_uri = _encode_jpeg(thumb, 85) thumb_uri = _encode_jpeg(thumb, 85)

View File

@@ -298,6 +298,7 @@ async def test_pp_template(
actual_fps = frame_count / actual_duration if actual_duration > 0 else 0 actual_fps = frame_count / actual_duration if actual_duration > 0 else 0
avg_capture_time_ms = (total_capture_time / frame_count * 1000) if frame_count > 0 else 0 avg_capture_time_ms = (total_capture_time / frame_count * 1000) if frame_count > 0 else 0
width, height = pil_image.size width, height = pil_image.size
thumb_w, thumb_h = thumbnail.size
return TemplateTestResponse( return TemplateTestResponse(
full_capture=CaptureImage( full_capture=CaptureImage(
@@ -305,8 +306,8 @@ async def test_pp_template(
full_image=full_data_uri, full_image=full_data_uri,
width=width, width=width,
height=height, height=height,
thumbnail_width=thumbnail_width, thumbnail_width=thumb_w,
thumbnail_height=thumbnail_height, thumbnail_height=thumb_h,
), ),
border_extraction=None, border_extraction=None,
performance=PerformanceMetrics( performance=PerformanceMetrics(