Temporary fix to allow Invoke() calls for VP8 HW encoder and decoder.

BUG=
R=jiayl@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/24849004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7387 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
glaznev@webrtc.org 2014-10-07 17:11:36 +00:00
parent 963b979510
commit 46ffc70878

View File

@ -1234,6 +1234,13 @@ static int64_t GetCurrentTimeMs() {
return TickTime::Now().Ticks() / 1000000LL;
}
// Allow Invoke() calls from from current thread.
static void AllowBlockingCalls() {
Thread* current_thread = Thread::Current();
if (current_thread != NULL)
current_thread->SetAllowBlockingCalls(true);
}
// MediaCodecVideoEncoder is a webrtc::VideoEncoder implementation that uses
// Android's MediaCodec SDK API behind the scenes to implement (hopefully)
// HW-backed video encode. This C++ class is implemented as a very thin shim,
@ -1417,6 +1424,7 @@ MediaCodecVideoEncoder::MediaCodecVideoEncoder(JNIEnv* jni)
j_info_presentation_timestamp_us_field_ = GetFieldID(
jni, j_output_buffer_info_class, "presentationTimestampUs", "J");
CHECK_EXCEPTION(jni) << "MediaCodecVideoEncoder ctor failed";
AllowBlockingCalls();
}
int32_t MediaCodecVideoEncoder::InitEncode(
@ -2142,6 +2150,7 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder(JNIEnv* jni)
if (render_egl_context_ == NULL)
use_surface_ = false;
memset(&codec_, 0, sizeof(codec_));
AllowBlockingCalls();
}
MediaCodecVideoDecoder::~MediaCodecVideoDecoder() {