mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-13 19:36:34 +00:00
Fix overrun of input buffers with large frames
This commit is contained in:
committed by
Iwan Timmer
parent
70970e9b27
commit
e215252dc8
@@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <ilclient.h>
|
#include <ilclient.h>
|
||||||
#include <bcm_host.h>
|
#include <bcm_host.h>
|
||||||
|
|
||||||
|
#define MAX_DECODE_UNIT_SIZE 262144
|
||||||
|
|
||||||
static TUNNEL_T tunnel[2];
|
static TUNNEL_T tunnel[2];
|
||||||
static COMPONENT_T *list[3];
|
static COMPONENT_T *list[3];
|
||||||
static ILCLIENT_T *client;
|
static ILCLIENT_T *client;
|
||||||
@@ -58,8 +60,6 @@ static void decoder_renderer_setup(int width, int height, int redrawRate, void*
|
|||||||
OMX_VIDEO_PARAM_PORTFORMATTYPE format;
|
OMX_VIDEO_PARAM_PORTFORMATTYPE format;
|
||||||
OMX_TIME_CONFIG_CLOCKSTATETYPE cstate;
|
OMX_TIME_CONFIG_CLOCKSTATETYPE cstate;
|
||||||
COMPONENT_T *clock = NULL;
|
COMPONENT_T *clock = NULL;
|
||||||
unsigned int data_len = 0;
|
|
||||||
int packet_size = 80<<10;
|
|
||||||
|
|
||||||
memset(list, 0, sizeof(list));
|
memset(list, 0, sizeof(list));
|
||||||
memset(tunnel, 0, sizeof(tunnel));
|
memset(tunnel, 0, sizeof(tunnel));
|
||||||
@@ -109,8 +109,27 @@ static void decoder_renderer_setup(int width, int height, int redrawRate, void*
|
|||||||
unit.eUnitType = OMX_DataUnitCodedPicture;
|
unit.eUnitType = OMX_DataUnitCodedPicture;
|
||||||
unit.eEncapsulationType = OMX_DataEncapsulationElementaryStream;
|
unit.eEncapsulationType = OMX_DataEncapsulationElementaryStream;
|
||||||
|
|
||||||
if(OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamVideoPortFormat, &format) == OMX_ErrorNone &&
|
if(OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamVideoPortFormat, &format) != OMX_ErrorNone ||
|
||||||
OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamBrcmDataUnit, &unit) == OMX_ErrorNone &&
|
OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamBrcmDataUnit, &unit) != OMX_ErrorNone) {
|
||||||
|
fprintf(stderr, "Failed to set video parameters\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
OMX_PARAM_PORTDEFINITIONTYPE port;
|
||||||
|
|
||||||
|
memset(&port, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
|
||||||
|
port.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
|
||||||
|
port.nVersion.nVersion = OMX_VERSION;
|
||||||
|
port.nPortIndex = 130;
|
||||||
|
if(OMX_GetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamPortDefinition, &port) != OMX_ErrorNone) {
|
||||||
|
fprintf(stderr, "Failed to get decoder port definition\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the buffer size to fit the largest possible frame
|
||||||
|
port.nBufferSize = MAX_DECODE_UNIT_SIZE;
|
||||||
|
|
||||||
|
if(OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamPortDefinition, &port) == OMX_ErrorNone &&
|
||||||
ilclient_enable_port_buffers(video_decode, 130, NULL, NULL, NULL) == 0) {
|
ilclient_enable_port_buffers(video_decode, 130, NULL, NULL, NULL) == 0) {
|
||||||
|
|
||||||
port_settings_changed = 0;
|
port_settings_changed = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user