2 # User Randell Jesup <rjesup@jesup.org>
3 # Parent 5d4d728adccff4539e44f697b8011fb2eb1a1ad5
5 diff --git a/source/mjpeg_decoder.cc b/source/mjpeg_decoder.cc
6 --- a/source/mjpeg_decoder.cc
7 +++ b/source/mjpeg_decoder.cc
8 @@ -73,18 +73,20 @@ MJpegDecoder::MJpegDecoder()
9 databuf_strides_(NULL) {
10 decompress_struct_ = new jpeg_decompress_struct;
11 source_mgr_ = new jpeg_source_mgr;
13 error_mgr_ = new SetJmpErrorMgr;
14 decompress_struct_->err = jpeg_std_error(&error_mgr_->base);
15 // Override standard exit()-based error handler.
16 error_mgr_->base.error_exit = &ErrorHandler;
18 error_mgr_->base.output_message = &OutputHandler;
21 decompress_struct_->client_data = NULL;
22 source_mgr_->init_source = &init_source;
23 source_mgr_->fill_input_buffer = &fill_input_buffer;
24 source_mgr_->skip_input_data = &skip_input_data;
25 source_mgr_->resync_to_restart = &jpeg_resync_to_restart;
26 source_mgr_->term_source = &term_source;
27 jpeg_create_decompress(decompress_struct_);
28 decompress_struct_->src = source_mgr_;
29 @@ -450,21 +452,22 @@ void ErrorHandler(j_common_ptr cinfo) {
32 SetJmpErrorMgr* mgr = reinterpret_cast<SetJmpErrorMgr*>(cinfo->err);
33 // This rewinds the call stack to the point of the corresponding setjmp()
34 // and causes it to return (for a second time) with value 1.
35 longjmp(mgr->setjmp_buffer, 1);
39 // Suppress fprintf warnings.
40 void OutputHandler(j_common_ptr cinfo) {
47 void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {
48 if (num_outbufs != num_outbufs_) {
49 // We could perhaps optimize this case to resize the output buffers without
50 // necessarily having to delete and recreate each one, but it's not worth
52 DestroyOutputBuffers();