Cap resolution options at 1080p on Steam Link and Raspberry Pi due to hardware limitations

This commit is contained in:
Cameron Gutman 2020-02-23 00:43:43 -08:00
parent 46bcbda972
commit 979de190dc
12 changed files with 42 additions and 5 deletions

View File

@ -114,7 +114,7 @@ void SystemProperties::querySdlVideoInfo()
return; return;
} }
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen); Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, maximumResolution);
SDL_DestroyWindow(testWindow); SDL_DestroyWindow(testWindow);

View File

@ -20,6 +20,7 @@ public:
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT) Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged) Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT) Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
Q_INVOKABLE QRect getDesktopResolution(int displayIndex); Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
Q_INVOKABLE QRect getNativeResolution(int displayIndex); Q_INVOKABLE QRect getNativeResolution(int displayIndex);
@ -40,6 +41,7 @@ private:
bool hasDiscordIntegration; bool hasDiscordIntegration;
QString unmappedGamepads; QString unmappedGamepads;
int maximumStreamingFrameRate; int maximumStreamingFrameRate;
QSize maximumResolution;
QList<QRect> monitorDesktopResolutions; QList<QRect> monitorDesktopResolutions;
QList<QRect> monitorNativeResolutions; QList<QRect> monitorNativeResolutions;
}; };

View File

@ -131,6 +131,20 @@ Flickable {
} }
} }
// Prune resolutions that are over the decoder's maximum
var max_pixels = SystemProperties.maximumResolution.width * SystemProperties.maximumResolution.height;
if (max_pixels > 0) {
for (var j = 0; j < resolutionComboBox.count; j++) {
var existing_width = parseInt(resolutionListModel.get(j).video_width);
var existing_height = parseInt(resolutionListModel.get(j).video_height);
if (existing_width * existing_height > max_pixels) {
resolutionListModel.remove(j)
j--
}
}
}
// load the saved width/height, and iterate through the ComboBox until a match is found // load the saved width/height, and iterate through the ComboBox until a match is found
// and set it to that index. // and set it to that index.
var saved_width = StreamingPreferences.width var saved_width = StreamingPreferences.width

View File

@ -253,7 +253,7 @@ int Session::drSubmitDecodeUnit(PDECODE_UNIT du)
} }
void Session::getDecoderInfo(SDL_Window* window, void Session::getDecoderInfo(SDL_Window* window,
bool& isHardwareAccelerated, bool& isFullScreenOnly) bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution)
{ {
IVideoDecoder* decoder; IVideoDecoder* decoder;
@ -266,6 +266,7 @@ void Session::getDecoderInfo(SDL_Window* window,
isHardwareAccelerated = decoder->isHardwareAccelerated(); isHardwareAccelerated = decoder->isHardwareAccelerated();
isFullScreenOnly = decoder->isAlwaysFullScreen(); isFullScreenOnly = decoder->isAlwaysFullScreen();
maxResolution = decoder->getDecoderMaxResolution();
delete decoder; delete decoder;
} }

View File

@ -26,7 +26,7 @@ public:
static static
void getDecoderInfo(SDL_Window* window, void getDecoderInfo(SDL_Window* window,
bool& isHardwareAccelerated, bool& isFullScreenOnly); bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution);
static Session* get() static Session* get()
{ {

View File

@ -46,6 +46,7 @@ public:
virtual bool isAlwaysFullScreen() = 0; virtual bool isAlwaysFullScreen() = 0;
virtual int getDecoderCapabilities() = 0; virtual int getDecoderCapabilities() = 0;
virtual int getDecoderColorspace() = 0; virtual int getDecoderColorspace() = 0;
virtual QSize getDecoderMaxResolution() = 0;
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0; virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
virtual void renderFrameOnMainThread() = 0; virtual void renderFrameOnMainThread() = 0;
}; };

View File

@ -134,8 +134,8 @@ enum AVPixelFormat MmalRenderer::getPreferredPixelFormat(int videoFormat)
int MmalRenderer::getRendererAttributes() int MmalRenderer::getRendererAttributes()
{ {
// This renderer can only draw in full-screen // This renderer can only draw in full-screen and maxes out at 1080p
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY; return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY | RENDERER_ATTRIBUTE_1080P_MAX;
} }
bool MmalRenderer::needsTestFrame() bool MmalRenderer::needsTestFrame()

View File

@ -10,6 +10,7 @@ extern "C" {
} }
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01 #define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
class IFFmpegRenderer : public Overlay::IOverlayRenderer { class IFFmpegRenderer : public Overlay::IOverlayRenderer {
public: public:

View File

@ -71,6 +71,17 @@ int FFmpegVideoDecoder::getDecoderColorspace()
return m_FrontendRenderer->getDecoderColorspace(); return m_FrontendRenderer->getDecoderColorspace();
} }
QSize FFmpegVideoDecoder::getDecoderMaxResolution()
{
if (m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_1080P_MAX) {
return QSize(1920, 1080);
}
else {
// No known maximum
return QSize(0, 0);
}
}
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context, enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
const enum AVPixelFormat* pixFmts) const enum AVPixelFormat* pixFmts)
{ {

View File

@ -19,6 +19,7 @@ public:
virtual bool isAlwaysFullScreen() override; virtual bool isAlwaysFullScreen() override;
virtual int getDecoderCapabilities() override; virtual int getDecoderCapabilities() override;
virtual int getDecoderColorspace() override; virtual int getDecoderColorspace() override;
virtual QSize getDecoderMaxResolution() override;
virtual int submitDecodeUnit(PDECODE_UNIT du) override; virtual int submitDecodeUnit(PDECODE_UNIT du) override;
virtual void renderFrameOnMainThread() override; virtual void renderFrameOnMainThread() override;

View File

@ -42,6 +42,11 @@ SLVideoDecoder::getDecoderColorspace()
return COLORSPACE_REC_709; return COLORSPACE_REC_709;
} }
QSize SLVideoDecoder::getDecoderMaxResolution()
{
return QSize(1920, 1080);
}
bool bool
SLVideoDecoder::initialize(PDECODER_PARAMETERS params) SLVideoDecoder::initialize(PDECODER_PARAMETERS params)
{ {

View File

@ -14,6 +14,7 @@ public:
virtual bool isAlwaysFullScreen(); virtual bool isAlwaysFullScreen();
virtual int getDecoderCapabilities(); virtual int getDecoderCapabilities();
virtual int getDecoderColorspace(); virtual int getDecoderColorspace();
virtual QSize getDecoderMaxResolution();
virtual int submitDecodeUnit(PDECODE_UNIT du); virtual int submitDecodeUnit(PDECODE_UNIT du);
// Unused since rendering is done directly from the decode thread // Unused since rendering is done directly from the decode thread