Skip to content

Commit

Permalink
(Continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Aug 17, 2024
1 parent 57f86b9 commit 6061086
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/hal/plus/gm_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,21 @@ void gm_video_request_idr(char index)
int gm_video_snapshot_grab(short width, short height, char quality, hal_jpegdata *jpeg)
{
int ret;
unsigned int length = 1 * 1024 * 1024;
char *buffer = malloc(length);
char *buffer = malloc(GM_MAX_SNAP);

gm_venc_snap snap;
snap.bind = _gm_venc_fds[0].bind;
snap.quality = quality;
snap.buffer = buffer;
snap.length = length;
snap.length = GM_MAX_SNAP;
snap.dest.width = MIN(width, GM_VENC_SNAP_WIDTH_MAX);
snap.dest.height = MIN(height, GM_VENC_SNAP_HEIGHT_MAX);

if ((ret = gm_lib.fnSnapshot(&snap, 1000)) <= 0)
goto abort;

jpeg->data = buffer;
jpeg->jpegSize = jpeg->length = length;
jpeg->jpegSize = jpeg->length = ret;
return EXIT_SUCCESS;

abort:
Expand Down
1 change: 1 addition & 0 deletions src/hal/plus/gm_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "gm_venc.h"

#define GM_LIB_API "1.0"
#define GM_MAX_SNAP (1024 * 1024)

extern char keepRunning;

Expand Down

0 comments on commit 6061086

Please sign in to comment.