@@ -129,8 +129,8 @@ export class StreamingDelegate implements CameraStreamingDelegate {
129
129
}
130
130
131
131
private determineResolution ( request : SnapshotRequest | VideoInfo , isSnapshot = false ) : ResolutionInfo {
132
- let width = request . width ;
133
- let height = request . height ;
132
+ let width = Math . floor ( request . width / 2 ) * 2 ;
133
+ let height = Math . floor ( request . height / 2 ) * 2 ;
134
134
if ( ! isSnapshot ) {
135
135
if ( ( this . videoConfig . forceMax && this . videoConfig . maxWidth ) ||
136
136
( request . width > this . videoConfig . maxWidth ) ) {
@@ -151,7 +151,9 @@ export class StreamingDelegate implements CameraStreamingDelegate {
151
151
vf . push ( 'scale=' + ( width > 0 ? '\'min(' + width + ',iw)\'' : 'iw' ) + ':' +
152
152
( height > 0 ? '\'min(' + height + ',ih)\'' : 'ih' ) +
153
153
( this . videoConfig . preserveRatio ? ':force_original_aspect_ratio=decrease' : '' ) ) ;
154
- vf . push ( 'scale=trunc(iw/2)*2:trunc(ih/2)*2' ) ; // Force to fit encoder restrictions
154
+ if ( this . videoConfig . preserveRatio ) {
155
+ vf . push ( 'scale=trunc(iw/2)*2:trunc(ih/2)*2' ) ; // Force to fit encoder restrictions
156
+ }
155
157
}
156
158
}
157
159
@@ -334,7 +336,7 @@ export class StreamingDelegate implements CameraStreamingDelegate {
334
336
' -f null' +
335
337
' -ar ' + request . audio . sample_rate + 'k' +
336
338
' -b:a ' + request . audio . max_bit_rate + 'k' +
337
- ' -ac 1' +
339
+ ' -ac ' + request . audio . channel +
338
340
' -payload_type ' + request . audio . pt ;
339
341
340
342
ffmpegArgs += // Audio Stream
@@ -363,10 +365,10 @@ export class StreamingDelegate implements CameraStreamingDelegate {
363
365
}
364
366
activeSession . timeout = setTimeout ( ( ) => {
365
367
activeSession . socket ?. close ( ) ;
366
- this . log . info ( 'Device appears to be inactive for over 5 seconds . Stopping stream.' , this . cameraName ) ;
368
+ this . log . info ( 'Device appears to be inactive. Stopping stream.' , this . cameraName ) ;
367
369
this . controller . forceStopStreamingSession ( request . sessionID ) ;
368
370
this . stopStream ( request . sessionID ) ;
369
- } , 5000 ) ;
371
+ } , request . video . rtcp_interval * 2 * 1000 ) ;
370
372
} ) ;
371
373
activeSession . socket . bind ( sessionInfo . videoReturnPort , sessionInfo . localAddress ) ;
372
374
0 commit comments