You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	lavc: set channel count from channel layout in avcodec_open2().
Some decoders (e.g. nellymoser) only set channel_layout and do not set channel count.
This commit is contained in:
		| @@ -856,12 +856,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code | ||||
|  | ||||
|     if (av_codec_is_decoder(avctx->codec)) { | ||||
|         /* validate channel layout from the decoder */ | ||||
|         if (avctx->channel_layout && | ||||
|             av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { | ||||
|             av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n"); | ||||
|         if (avctx->channel_layout) { | ||||
|             int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); | ||||
|             if (!avctx->channels) | ||||
|                 avctx->channels = channels; | ||||
|             else if (channels != avctx->channels) { | ||||
|                 av_log(avctx, AV_LOG_WARNING, | ||||
|                        "channel layout does not match number of channels\n"); | ||||
|                 avctx->channel_layout = 0; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| end: | ||||
|     entangled_thread_counter--; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user