audio: Report unknown stream positions explicitly
Instead of using 'STATUS_NO_INIT' in the case when stream
position can not be reported, use a special value for Position
fields. This streamlines processing of statuses on the client
side, by removing the need to treat 'STATUS_NO_INIT' specially.
Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I13c9c8d165b632900ca76de144759ef7b9200eff
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index c5d00a2..d1efb02 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -87,12 +87,13 @@
void StreamWorkerCommonLogic::populateReply(StreamDescriptor::Reply* reply,
bool isConnected) const {
+ reply->status = STATUS_OK;
if (isConnected) {
- reply->status = STATUS_OK;
reply->observable.frames = mFrameCount;
reply->observable.timeNs = ::android::elapsedRealtimeNano();
} else {
- reply->status = STATUS_NO_INIT;
+ reply->observable.frames = StreamDescriptor::Position::UNKNOWN;
+ reply->observable.timeNs = StreamDescriptor::Position::UNKNOWN;
}
}