MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_error

Function hb_error

libhb/common.c:4549–4641  ·  view source on GitHub ↗

* hb_error ********************************************************************** * Using whatever output is available display this error. *********************************************************************/

Source from the content-addressed store, hash-verified

4547 * Using whatever output is available display this error.
4548 *********************************************************************/
4549void hb_error( char * log, ... )
4550{
4551 char string[181]; /* 180 chars + \0 */
4552 char rep_string[181];
4553 static char last_string[181];
4554 static int last_error_count = 0;
4555 static uint64_t last_series_error_time = 0;
4556 static hb_lock_t *mutex = 0;
4557 va_list args;
4558 uint64_t time_now;
4559
4560 /* Convert the message to a string */
4561 va_start( args, log );
4562 vsnprintf( string, 180, log, args );
4563 va_end( args );
4564
4565 if( !mutex )
4566 {
4567 mutex = hb_lock_init();
4568 }
4569
4570 hb_lock( mutex );
4571
4572 time_now = hb_get_date();
4573
4574 if( strcmp( string, last_string) == 0 )
4575 {
4576 /*
4577 * The last error and this one are the same, don't log it
4578 * just count it instead, unless it was more than one second
4579 * ago.
4580 */
4581 last_error_count++;
4582 if( last_series_error_time + ( 1000 * 1 ) > time_now )
4583 {
4584 hb_unlock( mutex );
4585 return;
4586 }
4587 }
4588
4589 /*
4590 * A new error, or the same one more than 10sec since the last one
4591 * did we have any of the same counted up?
4592 */
4593 if( last_error_count > 0 )
4594 {
4595 /*
4596 * Print out the last error to ensure context for the last
4597 * repeated message.
4598 */
4599 if( error_handler )
4600 {
4601 error_handler( last_string );
4602 } else {
4603 hb_log( "%s", last_string );
4604 }
4605
4606 if( last_error_count > 1 )

Callers 15

encavcodecaInitFunction · 0.85
encavcodecaWorkFunction · 0.85
crop_scale_infoFunction · 0.85
hb_sws_get_contextFunction · 0.85
hb_picture_fillFunction · 0.85
hb_save_previewFunction · 0.85
hb_read_previewFunction · 0.85
hb_get_previewFunction · 0.85
hb_add_filter2Function · 0.85
hb_global_initFunction · 0.85
InitFunction · 0.85
presets_doFunction · 0.85

Calls 5

hb_lock_initFunction · 0.85
hb_lockFunction · 0.85
hb_get_dateFunction · 0.85
hb_unlockFunction · 0.85
hb_logFunction · 0.85

Tested by

no test coverage detected