diff --git a/src/emu/video.c b/src/emu/video.c index bded8fc9b23..cb89df2c93a 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -2539,8 +2539,8 @@ void video_avi_begin_recording(running_machine *machine, const char *name) info.video_depth = 24; info.audio_format = 0; - info.audio_timescale = 1; - info.audio_sampletime = machine->sample_rate; + info.audio_timescale = machine->sample_rate; + info.audio_sampletime = 1; info.audio_numsamples = 0; info.audio_channels = 2; info.audio_samplebits = 16; diff --git a/src/lib/util/aviio.c b/src/lib/util/aviio.c index 3ea062c9240..022ea603c53 100644 --- a/src/lib/util/aviio.c +++ b/src/lib/util/aviio.c @@ -643,14 +643,6 @@ avi_error avi_close(avi_file *file) if (avierr == AVIERR_NONE && file->riffbase == 0) avierr = write_idx1_chunk(file); - /* close the RIFF chunk */ - if (avierr == AVIERR_NONE) - avierr = chunk_close(file); - - /* update the avih chunk */ - if (avierr == AVIERR_NONE) - avierr = write_avih_chunk(file, FALSE); - /* update the strh and indx chunks for each stream */ for (strnum = 0; strnum < file->streams; strnum++) { @@ -659,6 +651,14 @@ avi_error avi_close(avi_file *file) if (avierr == AVIERR_NONE) avierr = write_indx_chunk(file, &file->stream[strnum], FALSE); } + + /* update the avih chunk */ + if (avierr == AVIERR_NONE) + avierr = write_avih_chunk(file, FALSE); + + /* close the RIFF chunk */ + if (avierr == AVIERR_NONE) + avierr = chunk_close(file); } /* close the file */