mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Fix crash on undetected codec
Player StreamInfo might return a null if codec is undetermined
This commit is contained in:
@@ -218,12 +218,13 @@ var Widget = GObject.registerClass({
|
|||||||
};
|
};
|
||||||
|
|
||||||
for(let info of streamList) {
|
for(let info of streamList) {
|
||||||
let type, text;
|
let type, text, codec;
|
||||||
|
|
||||||
switch(info.constructor) {
|
switch(info.constructor) {
|
||||||
case GstPlayer.PlayerVideoInfo:
|
case GstPlayer.PlayerVideoInfo:
|
||||||
type = 'video';
|
type = 'video';
|
||||||
text = info.get_codec() + ', ' +
|
codec = info.get_codec() || 'Undetermined';
|
||||||
|
text = codec + ', ' +
|
||||||
+ info.get_width() + 'x'
|
+ info.get_width() + 'x'
|
||||||
+ info.get_height();
|
+ info.get_height();
|
||||||
let fps = info.get_framerate();
|
let fps = info.get_framerate();
|
||||||
@@ -233,7 +234,7 @@ var Widget = GObject.registerClass({
|
|||||||
break;
|
break;
|
||||||
case GstPlayer.PlayerAudioInfo:
|
case GstPlayer.PlayerAudioInfo:
|
||||||
type = 'audio';
|
type = 'audio';
|
||||||
let codec = info.get_codec();
|
codec = info.get_codec() || 'Undetermined';
|
||||||
if(codec.includes('(')) {
|
if(codec.includes('(')) {
|
||||||
codec = codec.substring(
|
codec = codec.substring(
|
||||||
codec.indexOf('(') + 1,
|
codec.indexOf('(') + 1,
|
||||||
|
Reference in New Issue
Block a user