Skip to content

Commit

Permalink
Merge pull request jellyfin#1662 from dmitrylyzo/fix-ios-transcode
Browse files Browse the repository at this point in the history
Add h264 codec profile for TS container
  • Loading branch information
anthonylavado committed Jul 27, 2020
2 parents 6bcb01d + fbe8127 commit 58198df
Showing 1 changed file with 50 additions and 27 deletions.
77 changes: 50 additions & 27 deletions src/scripts/browserDeviceProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,33 +707,29 @@ define(['browser'], function (browser) {
}
}

profile.CodecProfiles.push({
Type: 'Video',
Codec: 'h264',
Conditions: [
{
Condition: 'NotEquals',
Property: 'IsAnamorphic',
Value: 'true',
IsRequired: false
},
{
Condition: 'EqualsAny',
Property: 'VideoProfile',
Value: h264Profiles,
IsRequired: false
},
{
Condition: 'LessThanEqual',
Property: 'VideoLevel',
Value: maxH264Level.toString(),
IsRequired: false
}
]
});
const h264CodecProfileConditions = [
{
Condition: 'NotEquals',
Property: 'IsAnamorphic',
Value: 'true',
IsRequired: false
},
{
Condition: 'EqualsAny',
Property: 'VideoProfile',
Value: h264Profiles,
IsRequired: false
},
{
Condition: 'LessThanEqual',
Property: 'VideoLevel',
Value: maxH264Level.toString(),
IsRequired: false
}
];

if (!browser.edgeUwp && !browser.tizen && !browser.web0s) {
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
h264CodecProfileConditions.push({
Condition: 'NotEquals',
Property: 'IsInterlaced',
Value: 'true',
Expand All @@ -742,7 +738,7 @@ define(['browser'], function (browser) {
}

if (maxVideoWidth) {
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
h264CodecProfileConditions.push({
Condition: 'LessThanEqual',
Property: 'Width',
Value: maxVideoWidth.toString(),
Expand All @@ -755,14 +751,41 @@ define(['browser'], function (browser) {
var h264MaxVideoBitrate = globalMaxVideoBitrate;

if (h264MaxVideoBitrate) {
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
h264CodecProfileConditions.push({
Condition: 'LessThanEqual',
Property: 'VideoBitrate',
Value: h264MaxVideoBitrate,
IsRequired: true
});
}

// On iOS 12.x, for TS container max h264 level is 4.2
if (browser.iOS && browser.iOSVersion < 13) {
const codecProfile = {
Type: 'Video',
Codec: 'h264',
Container: 'ts',
Conditions: h264CodecProfileConditions.filter((condition) => {
return condition.Property !== 'VideoLevel';
})
};

codecProfile.Conditions.push({
Condition: 'LessThanEqual',
Property: 'VideoLevel',
Value: '42',
IsRequired: false
});

profile.CodecProfiles.push(codecProfile);
}

profile.CodecProfiles.push({
Type: 'Video',
Codec: 'h264',
Conditions: h264CodecProfileConditions
});

var globalVideoConditions = [];

if (globalMaxVideoBitrate) {
Expand Down

0 comments on commit 58198df

Please sign in to comment.