Bug 1152016: suppress fprintf(stderr)'s from jpeg in MJPEG decode r=pkerr

This commit is contained in:
Randell Jesup 2015-04-07 22:55:48 -04:00
parent ed38b0607f
commit 4d0c270993
2 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,7 @@ class LIBYUV_API MJpegDecoder {
static void term_source(jpeg_decompress_struct* cinfo);
static void ErrorHandler(jpeg_common_struct* cinfo);
static void OutputHandler(jpeg_common_struct* cinfo);
void AllocOutputBuffers(int num_outbufs);
void DestroyOutputBuffers();

View File

@ -63,6 +63,9 @@ MJpegDecoder::MJpegDecoder()
decompress_struct_->err = jpeg_std_error(&error_mgr_->base);
// Override standard exit()-based error handler.
error_mgr_->base.error_exit = &ErrorHandler;
#ifndef DEBUG_MJPEG
error_mgr_->base.output_message = &OutputHandler;
#endif
#endif
decompress_struct_->client_data = NULL;
source_mgr_->init_source = &init_source;
@ -443,7 +446,13 @@ void MJpegDecoder::ErrorHandler(j_common_ptr cinfo) {
// and causes it to return (for a second time) with value 1.
longjmp(mgr->setjmp_buffer, 1);
}
#ifndef DEBUG_MJPEG
void MJpegDecoder::OutputHandler(j_common_ptr cinfo) {
// silently eat messages
}
#endif
#endif // HAVE_SETJMP
void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {
if (num_outbufs != num_outbufs_) {