Avoids update of WebRTC.Audio.SourceMatchesRecordingSession for Android < N

Before this change we always logged false in WebRTC.Audio.SourceMatchesRecordingSession
even when a test had not been executed (happens e.g. for Android < N).

This issue is now fixed and we only update WebRTC.Audio.SourceMatchesRecordingSession
if a valid test has been performed.

No-Try: True
TBR: glaznev
Bug: webrtc:10971
Change-Id: I907197476f00b812c67bb71e8fdcd6f297cfbdee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154563
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29324}
This commit is contained in:
henrika
2019-09-26 16:00:58 +02:00
committed by Commit Bot
parent a21d50c1f3
commit ee8ee2f103
2 changed files with 22 additions and 11 deletions

View File

@ -158,13 +158,17 @@ int32_t AudioRecordJni::StopRecording() {
if (!initialized_ || !recording_) {
return 0;
}
const bool session_was_ok =
Java_WebRtcAudioRecord_isAudioSourceMatchingRecordingSession(
env_, j_audio_record_);
RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.SourceMatchesRecordingSession",
session_was_ok);
RTC_LOG(INFO) << "HISTOGRAM(WebRTC.Audio.SourceMatchesRecordingSession): "
<< session_was_ok;
// Check if the audio source matched the activated recording session but only
// if a valid results exists to avoid invalid statistics.
if (Java_WebRtcAudioRecord_isAudioConfigVerified(env_, j_audio_record_)) {
const bool session_was_ok =
Java_WebRtcAudioRecord_isAudioSourceMatchingRecordingSession(
env_, j_audio_record_);
RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.SourceMatchesRecordingSession",
session_was_ok);
RTC_LOG(INFO) << "HISTOGRAM(WebRTC.Audio.SourceMatchesRecordingSession): "
<< session_was_ok;
}
if (!Java_WebRtcAudioRecord_stopRecording(env_, j_audio_record_)) {
RTC_LOG(LS_ERROR) << "StopRecording failed";
return -1;