[FFmpeg-devel] [PATCH] FFplay : Fix segfault when playing mono audio streams.
Jai Menon
jmenon86
Wed Jul 7 15:56:10 CEST 2010
---
ffplay.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ffplay.c b/ffplay.c
index a43dbb1..5dfb898 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -941,7 +941,8 @@ static void video_audio_display(VideoState *s)
for(y=0; y<s->height; y++){
double w= 1/sqrt(nb_freq);
int a= sqrt(w*sqrt(data[0][2*y+0]*data[0][2*y+0] + data[0][2*y+1]*data[0][2*y+1]));
- int b= sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0] + data[1][2*y+1]*data[1][2*y+1]));
+ int b= (nb_display_channels == 2 ) ? sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0]
+ + data[1][2*y+1]*data[1][2*y+1])) : 0;
a= FFMIN(a,255);
b= FFMIN(b,255);
fgcolor = SDL_MapRGB(screen->format, a, b, (a+b)/2);
--
1.7.1.1
More information about the ffmpeg-devel
mailing list