Bug 1284803 part 6- Suppress MJPEG fprintf() warnings in libyuv r=jesup
☠☠ backed out by 104e19b8f12a ☠ ☠
authorSotaro Ikeda <sotaro.ikeda.g@gmail.com>
Mon, 25 Jul 2016 18:21:45 -0700
changeset 346648 6dbd0dee35720e9ad7a1af3659657104c6a25358
parent 346647 ac2f07864fb1059969eca26ffaa95a192d73cb07
child 346649 f7f503edb55b5641cb22d7b9c0f557f620d461e9
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1284803
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1284803 part 6- Suppress MJPEG fprintf() warnings in libyuv r=jesup
media/libyuv/source/mjpeg_decoder.cc
--- a/media/libyuv/source/mjpeg_decoder.cc
+++ b/media/libyuv/source/mjpeg_decoder.cc
@@ -57,31 +57,35 @@ const int MJpegDecoder::kColorSpaceCMYK 
 const int MJpegDecoder::kColorSpaceYCCK = JCS_YCCK;
 
 // Methods that are passed to jpeglib.
 boolean fill_input_buffer(jpeg_decompress_struct* cinfo);
 void init_source(jpeg_decompress_struct* cinfo);
 void skip_input_data(jpeg_decompress_struct* cinfo, long num_bytes);  // NOLINT
 void term_source(jpeg_decompress_struct* cinfo);
 void ErrorHandler(jpeg_common_struct* cinfo);
+void OutputHandler(jpeg_common_struct* cinfo);
 
 MJpegDecoder::MJpegDecoder()
     : has_scanline_padding_(LIBYUV_FALSE),
       num_outbufs_(0),
       scanlines_(NULL),
       scanlines_sizes_(NULL),
       databuf_(NULL),
       databuf_strides_(NULL) {
   decompress_struct_ = new jpeg_decompress_struct;
   source_mgr_ = new jpeg_source_mgr;
 #ifdef HAVE_SETJMP
   error_mgr_ = new SetJmpErrorMgr;
   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;
   source_mgr_->fill_input_buffer = &fill_input_buffer;
   source_mgr_->skip_input_data = &skip_input_data;
   source_mgr_->resync_to_restart = &jpeg_resync_to_restart;
   source_mgr_->term_source = &term_source;
   jpeg_create_decompress(decompress_struct_);
@@ -451,17 +455,23 @@ void ErrorHandler(j_common_ptr cinfo) {
   // ERROR: Error in jpeglib: buf
 #endif
 
   SetJmpErrorMgr* mgr = reinterpret_cast<SetJmpErrorMgr*>(cinfo->err);
   // This rewinds the call stack to the point of the corresponding setjmp()
   // and causes it to return (for a second time) with value 1.
   longjmp(mgr->setjmp_buffer, 1);
 }
+
+#ifndef DEBUG_MJPEG
+void OutputHandler(j_common_ptr cinfo) {
+  // silently eat messages
+}
 #endif
+#endif // HAVE_SETJMP
 
 void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {
   if (num_outbufs != num_outbufs_) {
     // We could perhaps optimize this case to resize the output buffers without
     // necessarily having to delete and recreate each one, but it's not worth
     // it.
     DestroyOutputBuffers();