Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java

Issue 2903253004: Reland of Removes usage of native base::android::GetApplicationContext() (Closed)
Patch Set: Deprecated comment. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
index 762a903f0df9a6844fe5114ec91248a9bceb2533..ba93ea1fb20a3c5aefb2a2032b7a46c060a6dbea 100644
--- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
+++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
@@ -19,6 +19,7 @@ import android.os.Process;
import java.lang.System;
import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;
+import org.webrtc.ContextUtils;
import org.webrtc.Logging;
import org.webrtc.ThreadUtils;
@@ -47,7 +48,6 @@ public class WebRtcAudioRecord {
private static final long AUDIO_RECORD_THREAD_JOIN_TIMEOUT_MS = 2000;
private final long nativeAudioRecord;
- private final Context context;
private WebRtcAudioEffects effects = null;
@@ -139,9 +139,8 @@ public class WebRtcAudioRecord {
}
}
- WebRtcAudioRecord(Context context, long nativeAudioRecord) {
+ WebRtcAudioRecord(long nativeAudioRecord) {
Logging.d(TAG, "ctor" + WebRtcAudioUtils.getThreadInfo());
- this.context = context;
this.nativeAudioRecord = nativeAudioRecord;
if (DEBUG) {
WebRtcAudioUtils.logDeviceInfo(TAG);
@@ -169,7 +168,8 @@ public class WebRtcAudioRecord {
private int initRecording(int sampleRate, int channels) {
Logging.d(TAG, "initRecording(sampleRate=" + sampleRate + ", channels=" + channels + ")");
- if (!WebRtcAudioUtils.hasPermission(context, android.Manifest.permission.RECORD_AUDIO)) {
+ if (!WebRtcAudioUtils.hasPermission(
+ ContextUtils.getApplicationContext(), android.Manifest.permission.RECORD_AUDIO)) {
reportWebRtcAudioRecordInitError("RECORD_AUDIO permission is missing");
return -1;
}

Powered by Google App Engine
This is Rietveld 408576698