Unified · Split
| @@ -1755,8 +1755,9 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, · 1754 unmodified lines | ||
| 1755 | 1755 | if (got_stream_frame_ptr) { |
| 1756 | 1756 | memcpy(&s->samples[s->current_stream * 2 + 0][s->offset[s->current_stream] * 512], |
| 1757 | 1757 | s->frames[s->current_stream]->extended_data[0], 512 * 4); |
| 1758 | − memcpy(&s->samples[s->current_stream * 2 + 1][s->offset[s->current_stream] * 512], | |
| 1759 | − s->frames[s->current_stream]->extended_data[1], 512 * 4); | |
| 1758 | + if (avctx->channels > 1) | |
| 1759 | + memcpy(&s->samples[s->current_stream * 2 + 1][s->offset[s->current_stream] * 512], | |
| 1760 | + s->frames[s->current_stream]->extended_data[1], 512 * 4); | |
| 1760 | 1761 | s->offset[s->current_stream]++; |
| 1761 | 1762 | } |
| 1762 | 1763 | |
| @@ -1794,7 +1795,7 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, · 31 unmodified lines | ||
| 1794 | 1795 | s->xma[i].skip_packets = FFMAX(0, s->xma[i].skip_packets - 1); |
| 1795 | 1796 | } |
| 1796 | 1797 | |
| 1797 | − for (i = 0; i < avctx->channels / 2; i++) { | |
| 1798 | + for (i = 0; i < (avctx->channels + 1) / 2; i++) { | |
| 1798 | 1799 | offset = FFMIN(offset, s->offset[i]); |
| 1799 | 1800 | } |
| 1800 | 1801 | |
| @@ -1803,13 +1804,15 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, · 2 unmodified lines | ||
| 1803 | 1804 | if ((bret = ff_get_buffer(avctx, frame, 0)) < 0) |
| 1804 | 1805 | return bret; |
| 1805 | 1806 | |
| 1806 | − for (i = 0; i < avctx->channels / 2; i++) { | |
| 1807 | + for (i = 0; i < (avctx->channels + 1) / 2; i++) { | |
| 1807 | 1808 | memcpy(frame->extended_data[i * 2 + 0], s->samples[i * 2 + 0], frame->nb_samples * 4); |
| 1808 | − memcpy(frame->extended_data[i * 2 + 1], s->samples[i * 2 + 1], frame->nb_samples * 4); | |
| 1809 | + if (avctx->channels > 1) | |
| 1810 | + memcpy(frame->extended_data[i * 2 + 1], s->samples[i * 2 + 1], frame->nb_samples * 4); | |
| 1809 | 1811 | s->offset[i] -= offset; |
| 1810 | 1812 | if (s->offset[i]) { |
| 1811 | 1813 | memmove(s->samples[i * 2 + 0], s->samples[i * 2 + 0] + frame->nb_samples, s->offset[i] * 4 * 512); |
| 1812 | − memmove(s->samples[i * 2 + 1], s->samples[i * 2 + 1] + frame->nb_samples, s->offset[i] * 4 * 512); | |
| 1814 | + if (avctx->channels > 1) | |
| 1815 | + memmove(s->samples[i * 2 + 1], s->samples[i * 2 + 1] + frame->nb_samples, s->offset[i] * 4 * 512); | |
| 1813 | 1816 | } |
| 1814 | 1817 | } |
| 1815 | 1818 | |