CVSROOT: /sources/gnash Module name: gnash Changes by: Tomas Groth <tgc> 07/06/08 11:38:17
Modified files: . : ChangeLog backend : sound_handler_sdl.cpp Log message: * backend/sound_handler_sdl.cpp: Fixed an assertion fault when non-mp3 audio was looping. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3495&r2=1.3496 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.68&r2=1.69 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3495 retrieving revision 1.3496 diff -u -b -r1.3495 -r1.3496 --- ChangeLog 7 Jun 2007 22:13:46 -0000 1.3495 +++ ChangeLog 8 Jun 2007 11:38:16 -0000 1.3496 @@ -1,3 +1,8 @@ +2007-06-08 Tomas Groth Christensen <[EMAIL PROTECTED]> + + * backend/sound_handler_sdl.cpp: Fixed an assertion fault + when non-mp3 audio was looping. + 2007-06-07 Tomas Groth Christensen <[EMAIL PROTECTED]> * libbase/embedVideoDecoderFfmpeg.cpp: Free the av_frame after use. Index: backend/sound_handler_sdl.cpp =================================================================== RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -u -b -r1.68 -r1.69 --- backend/sound_handler_sdl.cpp 31 May 2007 16:42:06 -0000 1.68 +++ backend/sound_handler_sdl.cpp 8 Jun 2007 11:38:17 -0000 1.69 @@ -18,7 +18,7 @@ // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003 // which has been donated to the Public Domain. -// $Id: sound_handler_sdl.cpp,v 1.68 2007/05/31 16:42:06 strk Exp $ +// $Id: sound_handler_sdl.cpp,v 1.69 2007/06/08 11:38:17 tgc Exp $ #ifdef HAVE_CONFIG_H #include "config.h" @@ -155,7 +155,7 @@ // @@ does a negative handle_id have any meaning ? // should we change it to unsigned instead ? if (handle_id < 0 || (unsigned int) handle_id+1 > m_sound_data.size()) { - return 1; + return -1; } int start_size = 0; sound_data* sounddata = m_sound_data[handle_id]; @@ -187,11 +187,10 @@ sounddata->data_size += adjusted_size; std::vector<active_sound*> asounds = sounddata->m_active_sounds; + // If playback has already started, we also update the active sounds for(uint32_t i=0; i < asounds.size(); i++) { active_sound* sound = asounds[i]; - sound->set_data(sounddata->data); - sound->data_size = sounddata->data_size; - sound->position = sounddata->data_size; + sound->raw_data_size = sounddata->data_size; sound->set_raw_data(sounddata->data); } } @@ -312,7 +311,8 @@ sound->raw_data_size = sounddata->data_size; sound->set_raw_data(sounddata->data); sound->raw_position = 0; - sound->position = sounddata->data_size; + sound->position = 0; + sound->data_size = 0; } @@ -766,6 +766,19 @@ } + // If this isn't MP3 (which means its NATIVE16) there is nothing to decode, + // reusing the available data is the only option. + if (sounddata->format != 2) { + if (index < buffer_length) { + sound->loop_count--; + sound->raw_position = 0; + unsigned int mix_length = ((buffer_length - index) > sound->raw_data_size ? sound->raw_data_size : (buffer_length - index)); + do_mixing(stream+index, sound, sound->get_raw_data_ptr(sound->raw_position), + mix_length, sounddata->volume); + } + continue; + } + // Then we decode some data // We loop until the size of the decoded sound is greater than the buffer size, // or there is no more to decode. _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit