mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-28 03:17:31 +09:00
[ffvpx] Revert Mozilla hack in FFmpeg code
This hack was added by Mozilla to work around a potential data race, however the root cause was fixed by upstream in release 3.4 so this hack is no longer needed.
This commit is contained in:
parent
e241e6e34c
commit
7005e37b98
2 changed files with 16 additions and 32 deletions
|
|
@ -30,10 +30,3 @@ replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
|
||||||
|
|
||||||
config_win32/64.h/asm:
|
config_win32/64.h/asm:
|
||||||
add to configure command: --toolchain=msvc
|
add to configure command: --toolchain=msvc
|
||||||
|
|
||||||
23 Sept 2016: libavcodec/pthread_frame.c has been patched so as to avoid
|
|
||||||
generating large numbers of warnings from TSan (Thread Sanitizer) when
|
|
||||||
decoding vp9 streams. This will likely be fixed upstream sometime soon.
|
|
||||||
When resyncing with upstream, first un-apply the patch shown at
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1274256#c60, then resync,
|
|
||||||
then assess whether the patch is still necessary.
|
|
||||||
|
|
|
||||||
|
|
@ -43,29 +43,9 @@
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/thread.h"
|
#include "libavutil/thread.h"
|
||||||
|
|
||||||
#if defined(MOZ_TSAN)
|
|
||||||
typedef _Atomic(int) atomic_int;
|
|
||||||
#else
|
|
||||||
typedef volatile int atomic_int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context used by codec threads and stored in their AVCodecInternal thread_ctx.
|
* Context used by codec threads and stored in their AVCodecInternal thread_ctx.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
|
||||||
STATE_INPUT_READY, ///< Set when the thread is awaiting a packet.
|
|
||||||
STATE_SETTING_UP, ///< Set before the codec has called ff_thread_finish_setup().
|
|
||||||
STATE_GET_BUFFER, /**<
|
|
||||||
* Set when the codec calls get_buffer().
|
|
||||||
* State is returned to STATE_SETTING_UP afterwards.
|
|
||||||
*/
|
|
||||||
STATE_GET_FORMAT, /**<
|
|
||||||
* Set when the codec calls get_format().
|
|
||||||
* State is returned to STATE_SETTING_UP afterwards.
|
|
||||||
*/
|
|
||||||
STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup().
|
|
||||||
} State;
|
|
||||||
|
|
||||||
typedef struct PerThreadContext {
|
typedef struct PerThreadContext {
|
||||||
struct FrameThreadContext *parent;
|
struct FrameThreadContext *parent;
|
||||||
|
|
||||||
|
|
@ -86,7 +66,19 @@ typedef struct PerThreadContext {
|
||||||
int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
|
int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
|
||||||
int result; ///< The result of the last codec decode/encode() call.
|
int result; ///< The result of the last codec decode/encode() call.
|
||||||
|
|
||||||
atomic_int state;
|
enum {
|
||||||
|
STATE_INPUT_READY, ///< Set when the thread is awaiting a packet.
|
||||||
|
STATE_SETTING_UP, ///< Set before the codec has called ff_thread_finish_setup().
|
||||||
|
STATE_GET_BUFFER, /**<
|
||||||
|
* Set when the codec calls get_buffer().
|
||||||
|
* State is returned to STATE_SETTING_UP afterwards.
|
||||||
|
*/
|
||||||
|
STATE_GET_FORMAT, /**<
|
||||||
|
* Set when the codec calls get_format().
|
||||||
|
* State is returned to STATE_SETTING_UP afterwards.
|
||||||
|
*/
|
||||||
|
STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup().
|
||||||
|
} state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of frames passed to ff_thread_release_buffer().
|
* Array of frames passed to ff_thread_release_buffer().
|
||||||
|
|
@ -366,8 +358,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||||
while (p->state == STATE_SETTING_UP)
|
while (p->state == STATE_SETTING_UP)
|
||||||
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
|
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
|
||||||
|
|
||||||
State p_state = (State)p->state;
|
switch (p->state) {
|
||||||
switch (p_state) {
|
|
||||||
case STATE_GET_BUFFER:
|
case STATE_GET_BUFFER:
|
||||||
p->result = ff_get_buffer(p->avctx, p->requested_frame, p->requested_flags);
|
p->result = ff_get_buffer(p->avctx, p->requested_frame, p->requested_flags);
|
||||||
break;
|
break;
|
||||||
|
|
@ -480,7 +471,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
|
||||||
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
|
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
|
||||||
{
|
{
|
||||||
PerThreadContext *p;
|
PerThreadContext *p;
|
||||||
atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;
|
volatile int *progress = f->progress ? (int*)f->progress->data : NULL;
|
||||||
|
|
||||||
if (!progress || progress[field] >= n) return;
|
if (!progress || progress[field] >= n) return;
|
||||||
|
|
||||||
|
|
@ -498,7 +489,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field)
|
||||||
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
|
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
|
||||||
{
|
{
|
||||||
PerThreadContext *p;
|
PerThreadContext *p;
|
||||||
atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;
|
volatile int *progress = f->progress ? (int*)f->progress->data : NULL;
|
||||||
|
|
||||||
if (!progress || progress[field] >= n) return;
|
if (!progress || progress[field] >= n) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue