C2SoftFlacEnc: Avoid mapping C2LinearBlock twice
C2LinearBlock can be mapped to C2WriteView at most once at the same
time. This CL eliminates a local C2WriteView which is used to check
the status of C2LinearBlock, to avoid mapping C2LinearBlock twice.
Bug: 168052467
Test: android.media.cts.MediaCodecTest#testFlacIdentity
Change-Id: Ie798eac9979d867fa5c398cb3f3960341569c63d
(cherry picked from commit 96e1e1c22c50e49228ead2bfe1ec5186f5570c04)
diff --git a/media/codec2/components/flac/C2SoftFlacEnc.cpp b/media/codec2/components/flac/C2SoftFlacEnc.cpp
index 408db7e..72910c5 100644
--- a/media/codec2/components/flac/C2SoftFlacEnc.cpp
+++ b/media/codec2/components/flac/C2SoftFlacEnc.cpp
@@ -262,9 +262,10 @@
work->result = C2_NO_MEMORY;
return;
}
- C2WriteView wView = mOutputBlock->map().get();
- if (wView.error()) {
- ALOGE("write view map failed %d", wView.error());
+
+ err = mOutputBlock->map().get().error();
+ if (err) {
+ ALOGE("write view map failed %d", err);
work->result = C2_CORRUPTED;
return;
}