mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-02 18:47:18 -05:00 
			
		
		
		
	Fix AC-4 Sample rate check
Some Audio codec will have a null CodecTag, check for that to avoid null reference If the client already requests a specific sample rate, use that instead of our default sample rate for AC-4 Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
		
							parent
							
								
									5262439300
								
							
						
					
					
						commit
						992eed5ef7
					
				@ -1735,18 +1735,17 @@ public class DynamicHlsController : BaseJellyfinApiController
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (state.AudioStream is not null && state.AudioStream.CodecTag.Equals("ac-4", StringComparison.Ordinal))
 | 
					        if (state.OutputAudioSampleRate.HasValue)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            args += " -ar " + state.OutputAudioSampleRate.Value.ToString(CultureInfo.InvariantCulture);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (state.AudioStream?.CodecTag is not null && state.AudioStream.CodecTag.Equals("ac-4", StringComparison.Ordinal))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // ac-4 audio tends to hava a super weird sample rate that will fail most encoders
 | 
					            // ac-4 audio tends to hava a super weird sample rate that will fail most encoders
 | 
				
			||||||
            // force resample it to 48KHz
 | 
					            // force resample it to 48KHz
 | 
				
			||||||
            args += " -ar 48000";
 | 
					            args += " -ar 48000";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (state.OutputAudioSampleRate.HasValue)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            args += " -ar " + state.OutputAudioSampleRate.Value.ToString(CultureInfo.InvariantCulture);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        args += _encodingHelper.GetAudioFilterParam(state, _encodingOptions);
 | 
					        args += _encodingHelper.GetAudioFilterParam(state, _encodingOptions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return args;
 | 
					        return args;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user