mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 22:19:07 +02:00
Bug 2199 - crash after attempting to export as OGG at very high sample rate
This commit is contained in:
parent
569028268d
commit
c32b92c377
@ -195,15 +195,12 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
vorbis_dsp_state dsp;
|
||||
vorbis_block block;
|
||||
|
||||
auto cleanup = finally( [&] {
|
||||
ogg_stream_clear(&stream);
|
||||
|
||||
vorbis_block_clear(&block);
|
||||
vorbis_dsp_clear(&dsp);
|
||||
auto cleanup1 = finally( [&] {
|
||||
vorbis_info_clear(&info);
|
||||
vorbis_comment_clear(&comment);
|
||||
} );
|
||||
|
||||
|
||||
// Many of the library functions called below return 0 for success and
|
||||
// various nonzero codes for failure.
|
||||
|
||||
@ -211,22 +208,28 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
vorbis_info_init(&info);
|
||||
if (vorbis_encode_init_vbr(&info, numChannels, (int)(rate + 0.5), quality)) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - rate or quality problem"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
auto cleanup2 = finally( [&] {
|
||||
ogg_stream_clear(&stream);
|
||||
|
||||
vorbis_block_clear(&block);
|
||||
vorbis_dsp_clear(&dsp);
|
||||
vorbis_comment_clear(&comment);
|
||||
} );
|
||||
|
||||
// Retrieve tags
|
||||
if (!FillComment(project, &comment, metadata)) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - problem with metadata"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Set up analysis state and auxiliary encoding storage
|
||||
if (vorbis_analysis_init(&dsp, &info) ||
|
||||
vorbis_block_init(&dsp, &block)) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - problem initialising"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
@ -235,8 +238,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
// chained streams with concatenation.
|
||||
srand(time(NULL));
|
||||
if (ogg_stream_init(&stream, rand())) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - problem creating stream"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
@ -258,8 +260,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
ogg_stream_packetin(&stream, &bitstream_header) ||
|
||||
ogg_stream_packetin(&stream, &comment_header) ||
|
||||
ogg_stream_packetin(&stream, &codebook_header)) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - problem with packets"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
@ -268,8 +269,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
while (ogg_stream_flush(&stream, &page)) {
|
||||
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
||||
outFile.Write(page.body, page.body_len).GetLastError()) {
|
||||
// TODO: more precise message
|
||||
AudacityMessageBox(_("Unable to export"));
|
||||
AudacityMessageBox(_("Unable to export - problem with file"));
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user