Android: print Java traces for MediaRecorder when in debug mode.

Change-Id: Ie39dd16227c49c8c07831750869e0cc28d2cc8ee
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
Yoann Lopes
2014-03-13 16:29:49 +01:00
committed by The Qt Project
parent 8463aae9c0
commit 5b4b108d64

View File

@@ -88,6 +88,9 @@ bool JMediaRecorder::prepare()
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("prepare"); callMethod<void>("prepare");
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
return false; return false;
} }
@@ -104,6 +107,9 @@ bool JMediaRecorder::start()
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("start"); callMethod<void>("start");
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
return false; return false;
} }
@@ -114,9 +120,13 @@ void JMediaRecorder::stop()
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("stop"); callMethod<void>("stop");
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setAudioChannels(int numChannels) void JMediaRecorder::setAudioChannels(int numChannels)
{ {
@@ -127,9 +137,13 @@ void JMediaRecorder::setAudioEncoder(AudioEncoder encoder)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setAudioEncoder", "(I)V", int(encoder)); callMethod<void>("setAudioEncoder", "(I)V", int(encoder));
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setAudioEncodingBitRate(int bitRate) void JMediaRecorder::setAudioEncodingBitRate(int bitRate)
{ {
@@ -145,9 +159,13 @@ void JMediaRecorder::setAudioSource(AudioSource source)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setAudioSource", "(I)V", int(source)); callMethod<void>("setAudioSource", "(I)V", int(source));
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setCamera(JCamera *camera) void JMediaRecorder::setCamera(JCamera *camera)
{ {
@@ -159,9 +177,13 @@ void JMediaRecorder::setVideoEncoder(VideoEncoder encoder)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setVideoEncoder", "(I)V", int(encoder)); callMethod<void>("setVideoEncoder", "(I)V", int(encoder));
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setVideoEncodingBitRate(int bitRate) void JMediaRecorder::setVideoEncodingBitRate(int bitRate)
{ {
@@ -172,41 +194,61 @@ void JMediaRecorder::setVideoFrameRate(int rate)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setVideoFrameRate", "(I)V", rate); callMethod<void>("setVideoFrameRate", "(I)V", rate);
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setVideoSize(const QSize &size) void JMediaRecorder::setVideoSize(const QSize &size)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setVideoSize", "(II)V", size.width(), size.height()); callMethod<void>("setVideoSize", "(II)V", size.width(), size.height());
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setVideoSource(VideoSource source) void JMediaRecorder::setVideoSource(VideoSource source)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setVideoSource", "(I)V", int(source)); callMethod<void>("setVideoSource", "(I)V", int(source));
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setOrientationHint(int degrees) void JMediaRecorder::setOrientationHint(int degrees)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setOrientationHint", "(I)V", degrees); callMethod<void>("setOrientationHint", "(I)V", degrees);
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setOutputFormat(OutputFormat format) void JMediaRecorder::setOutputFormat(OutputFormat format)
{ {
QJNIEnvironmentPrivate env; QJNIEnvironmentPrivate env;
callMethod<void>("setOutputFormat", "(I)V", int(format)); callMethod<void>("setOutputFormat", "(I)V", int(format));
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
void JMediaRecorder::setOutputFile(const QString &path) void JMediaRecorder::setOutputFile(const QString &path)
{ {
@@ -214,9 +256,13 @@ void JMediaRecorder::setOutputFile(const QString &path)
callMethod<void>("setOutputFile", callMethod<void>("setOutputFile",
"(Ljava/lang/String;)V", "(Ljava/lang/String;)V",
QJNIObjectPrivate::fromString(path).object()); QJNIObjectPrivate::fromString(path).object());
if (env->ExceptionCheck()) if (env->ExceptionCheck()) {
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif
env->ExceptionClear(); env->ExceptionClear();
} }
}
static JNINativeMethod methods[] = { static JNINativeMethod methods[] = {
{"notifyError", "(JII)V", (void *)notifyError}, {"notifyError", "(JII)V", (void *)notifyError},