Skip to content

Commit

Permalink
[ARRISEOS-43803]: Disable unsupported resolutions for h264
Browse files Browse the repository at this point in the history
This commit disables unsupported h264 resolutions for eos, eos2008c,
apollo devices.

DEPS=meta-lgi-eos:106588/1
DEPS=meta-lgi-wpe:106590/2
DEPS=meta-lgi-eos2008c:106591/1
DEPS=meta-lgi-eos1008c:106595/1
DEPS=meta-lgi-apollo:106643/1
  • Loading branch information
jaroslaw-bojko-red committed Apr 6, 2023
1 parent f543094 commit a94c92a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@
#define MEDIA_MAX_FRAMERATE 60.0f
#endif

#if PLATFORM(EOS)
#define H264_MAX_WIDTH 1920.0f
#define H264_MAX_HEIGHT 1080.0f
#elif PLATFORM(EOS2008C)
#define H264_MAX_WIDTH 3840.0f
#define H264_MAX_HEIGHT 2160.0f
#elif PLATFORM(APOLLO)
#define H264_MAX_WIDTH 4096.0f
#define H264_MAX_HEIGHT 2160.0f
#else
#define H264_MAX_WIDTH 7680.0f
#define H264_MAX_HEIGHT 4320.0f
#endif
static const char* dumpReadyState(WebCore::MediaPlayer::ReadyState readyState)
{
switch (readyState) {
Expand Down Expand Up @@ -1077,6 +1090,16 @@ bool MediaPlayerPrivateGStreamerMSE::supportsAllCodecs(const Vector<String>& cod
return true;
}

bool MediaPlayerPrivateGStreamerMSE::isAnyCodecH264AndExceedSupportedSize(const Vector<String>& codecs, float width, float height)
{
for (String codec : codecs) {
if(codec.startsWith("avc") && (width > H264_MAX_WIDTH || height > H264_MAX_HEIGHT)) {
return true;
}
}
return false;
}

FloatSize MediaPlayerPrivateGStreamerMSE::naturalSize() const
{
if (!hasVideo())
Expand Down Expand Up @@ -1120,6 +1143,9 @@ MediaPlayer::SupportsType MediaPlayerPrivateGStreamerMSE::supportsType(const Med
if (width > MEDIA_MAX_WIDTH || height > MEDIA_MAX_HEIGHT)
return result;

if(isAnyCodecH264AndExceedSupportedSize(parameters.type.codecs(), width, height))
return result;

float framerate = parameters.type.parameter("framerate"_s).toFloat(&ok);
if (ok && framerate > MEDIA_MAX_FRAMERATE)
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class MediaPlayerPrivateGStreamerMSE : public MediaPlayerPrivateGStreamer {

static bool supportsCodec(String codec);
static bool supportsAllCodecs(const Vector<String>& codecs);
static bool isAnyCodecH264AndExceedSupportedSize(const Vector<String>& codecs, float width, float height);

#if ENABLE(ENCRYPTED_MEDIA)
void dispatchDecryptionStructure(GUniquePtr<GstStructure>&&) final;
Expand Down
12 changes: 12 additions & 0 deletions Source/cmake/OptionsWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ if (ENABLE_CBCS)
add_definitions(-DENABLE_CBCS=1)
endif()

if (PLATFORM_EOS)
add_definitions(-DWTF_PLATFORM_EOS=1)
endif()

if (PLATFORM_EOS2008C)
add_definitions(-DWTF_PLATFORM_EOS2008C=1)
endif()

if (PLATFORM_APOLLO)
add_definitions(-DWTF_PLATFORM_APOLLO=1)
endif()

add_definitions(-DBUILDING_WPE__=1)
add_definitions(-DGETTEXT_PACKAGE="WPE")
add_definitions(-DJSC_GLIB_API_ENABLED)
Expand Down

0 comments on commit a94c92a

Please sign in to comment.