58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
$OpenBSD: patch-src_xine-engine_metronom_c,v 1.1 2012/04/07 05:48:49 ajacoutot Exp $
|
|
|
|
Fix race in metronom_get_option(): reading int64 is not atomic in 32-bit systems
|
|
|
|
--- src/xine-engine/metronom.c.orig Fri Apr 6 19:53:44 2012
|
|
+++ src/xine-engine/metronom.c Fri Apr 6 19:56:49 2012
|
|
@@ -745,23 +745,41 @@ static void metronom_clock_set_option (metronom_clock_
|
|
|
|
static int64_t metronom_get_option (metronom_t *this, int option) {
|
|
|
|
- if (this->master)
|
|
- return this->master->get_option(this->master, option);
|
|
+ int64_t result;
|
|
|
|
+ pthread_mutex_lock (&this->lock);
|
|
+
|
|
+ if (this->master) {
|
|
+ result = this->master->get_option(this->master, option);
|
|
+ pthread_mutex_unlock (&this->lock);
|
|
+ return result;
|
|
+ }
|
|
+
|
|
switch (option) {
|
|
case METRONOM_AV_OFFSET:
|
|
- return this->av_offset;
|
|
+ result = this->av_offset;
|
|
+ break;
|
|
case METRONOM_SPU_OFFSET:
|
|
- return this->spu_offset;
|
|
+ result = this->spu_offset;
|
|
+ break;
|
|
case METRONOM_FRAME_DURATION:
|
|
- return this->img_duration;
|
|
+ result = this->img_duration;
|
|
+ break;
|
|
case METRONOM_VPTS_OFFSET:
|
|
- return this->vpts_offset;
|
|
+ result = this->vpts_offset;
|
|
+ break;
|
|
case METRONOM_PREBUFFER:
|
|
- return this->prebuffer;
|
|
+ result = this->prebuffer;
|
|
+ break;
|
|
+ default:
|
|
+ result = 0;
|
|
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
|
|
+ break;
|
|
}
|
|
- xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
|
|
- return 0;
|
|
+
|
|
+ pthread_mutex_unlock (&this->lock);
|
|
+
|
|
+ return result;
|
|
}
|
|
|
|
static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) {
|