Showing the changes to libswresample (1 of 1 file). Show all
Unified · Split
| @@ -152,6 +152,7 @@ av_cold void swr_close(SwrContext *s){ · 151 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | av_cold int swr_init(struct SwrContext *s){ |
| 154 | 154 | int ret; |
| 155 | + char l1[1024], l2[1024]; | |
| 155 | 156 | |
| 156 | 157 | clear_context(s); |
| 157 | 158 | |
| @@ -277,10 +278,18 @@ av_cold int swr_init(struct SwrContext *s){ · 119 unmodified lines | ||
| 277 | 278 | return -1; |
| 278 | 279 | } |
| 279 | 280 | |
| 281 | + av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout); | |
| 282 | + av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout); | |
| 283 | + if (s->out_ch_layout && s->out.ch_count != av_get_channel_layout_nb_channels(s->out_ch_layout)) { | |
| 284 | + av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified channel count %d\n", l2, s->out.ch_count); | |
| 285 | + return AVERROR(EINVAL); | |
| 286 | + } | |
| 287 | + if (s->in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s->in_ch_layout)) { | |
| 288 | + av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_count); | |
| 289 | + return AVERROR(EINVAL); | |
| 290 | + } | |
| 291 | + | |
| 280 | 292 | if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) { |
| 281 | − char l1[1024], l2[1024]; | |
| 282 | − av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout); | |
| 283 | − av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout); | |
| 284 | 293 | av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s " |
| 285 | 294 | "but there is not enough information to do it\n", l1, l2); |
| 286 | 295 | return -1; |