Fix crash on undetected codec

Player StreamInfo might return a null if codec is undetermined
This commit is contained in:
Rafostar
2021-01-04 22:31:25 +01:00
parent d6ef29c17e
commit f6601766f1

View File

@@ -218,12 +218,13 @@ var Widget = GObject.registerClass({
};
for(let info of streamList) {
let type, text;
let type, text, codec;
switch(info.constructor) {
case GstPlayer.PlayerVideoInfo:
type = 'video';
text = info.get_codec() + ', ' +
codec = info.get_codec() || 'Undetermined';
text = codec + ', ' +
+ info.get_width() + 'x'
+ info.get_height();
let fps = info.get_framerate();
@@ -233,7 +234,7 @@ var Widget = GObject.registerClass({
break;
case GstPlayer.PlayerAudioInfo:
type = 'audio';
let codec = info.get_codec();
codec = info.get_codec() || 'Undetermined';
if(codec.includes('(')) {
codec = codec.substring(
codec.indexOf('(') + 1,