mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +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_dsp_state dsp;
|
||||||
vorbis_block block;
|
vorbis_block block;
|
||||||
|
|
||||||
auto cleanup = finally( [&] {
|
|
||||||
ogg_stream_clear(&stream);
|
|
||||||
|
|
||||||
vorbis_block_clear(&block);
|
auto cleanup1 = finally( [&] {
|
||||||
vorbis_dsp_clear(&dsp);
|
|
||||||
vorbis_info_clear(&info);
|
vorbis_info_clear(&info);
|
||||||
vorbis_comment_clear(&comment);
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Many of the library functions called below return 0 for success and
|
// Many of the library functions called below return 0 for success and
|
||||||
// various nonzero codes for failure.
|
// various nonzero codes for failure.
|
||||||
|
|
||||||
@ -211,22 +208,28 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||||||
vorbis_info_init(&info);
|
vorbis_info_init(&info);
|
||||||
if (vorbis_encode_init_vbr(&info, numChannels, (int)(rate + 0.5), quality)) {
|
if (vorbis_encode_init_vbr(&info, numChannels, (int)(rate + 0.5), quality)) {
|
||||||
// TODO: more precise message
|
// TODO: more precise message
|
||||||
AudacityMessageBox(_("Unable to export"));
|
AudacityMessageBox(_("Unable to export - rate or quality problem"));
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto cleanup2 = finally( [&] {
|
||||||
|
ogg_stream_clear(&stream);
|
||||||
|
|
||||||
|
vorbis_block_clear(&block);
|
||||||
|
vorbis_dsp_clear(&dsp);
|
||||||
|
vorbis_comment_clear(&comment);
|
||||||
|
} );
|
||||||
|
|
||||||
// Retrieve tags
|
// Retrieve tags
|
||||||
if (!FillComment(project, &comment, metadata)) {
|
if (!FillComment(project, &comment, metadata)) {
|
||||||
// TODO: more precise message
|
AudacityMessageBox(_("Unable to export - problem with metadata"));
|
||||||
AudacityMessageBox(_("Unable to export"));
|
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up analysis state and auxiliary encoding storage
|
// Set up analysis state and auxiliary encoding storage
|
||||||
if (vorbis_analysis_init(&dsp, &info) ||
|
if (vorbis_analysis_init(&dsp, &info) ||
|
||||||
vorbis_block_init(&dsp, &block)) {
|
vorbis_block_init(&dsp, &block)) {
|
||||||
// TODO: more precise message
|
AudacityMessageBox(_("Unable to export - problem initialising"));
|
||||||
AudacityMessageBox(_("Unable to export"));
|
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +238,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||||||
// chained streams with concatenation.
|
// chained streams with concatenation.
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
if (ogg_stream_init(&stream, rand())) {
|
if (ogg_stream_init(&stream, rand())) {
|
||||||
// TODO: more precise message
|
AudacityMessageBox(_("Unable to export - problem creating stream"));
|
||||||
AudacityMessageBox(_("Unable to export"));
|
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,8 +260,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||||||
ogg_stream_packetin(&stream, &bitstream_header) ||
|
ogg_stream_packetin(&stream, &bitstream_header) ||
|
||||||
ogg_stream_packetin(&stream, &comment_header) ||
|
ogg_stream_packetin(&stream, &comment_header) ||
|
||||||
ogg_stream_packetin(&stream, &codebook_header)) {
|
ogg_stream_packetin(&stream, &codebook_header)) {
|
||||||
// TODO: more precise message
|
AudacityMessageBox(_("Unable to export - problem with packets"));
|
||||||
AudacityMessageBox(_("Unable to export"));
|
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,8 +269,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||||||
while (ogg_stream_flush(&stream, &page)) {
|
while (ogg_stream_flush(&stream, &page)) {
|
||||||
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
||||||
outFile.Write(page.body, page.body_len).GetLastError()) {
|
outFile.Write(page.body, page.body_len).GetLastError()) {
|
||||||
// TODO: more precise message
|
AudacityMessageBox(_("Unable to export - problem with file"));
|
||||||
AudacityMessageBox(_("Unable to export"));
|
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user