Merge "Update TVInput impl and vts to create and validate queue" into main
This commit is contained in:
commit
8995c298a5
3 changed files with 20 additions and 4 deletions
|
@ -43,6 +43,9 @@ void TvInput::init() {
|
|||
new TvStreamConfigWrapper(11, 360, 480, false))}};
|
||||
mStreamConfigs[3] = {{5, shared_ptr<TvStreamConfigWrapper>(
|
||||
new TvStreamConfigWrapper(5, 1080, 1920, false))}};
|
||||
|
||||
mQueue = shared_ptr<AidlMessageQueue<int8_t, SynchronizedReadWrite>>(
|
||||
new (std::nothrow) AidlMessageQueue<int8_t, SynchronizedReadWrite>(8));
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInput::setCallback(const shared_ptr<ITvInputCallback>& in_callback) {
|
||||
|
@ -74,7 +77,9 @@ void TvInput::init() {
|
|||
return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
|
||||
}
|
||||
|
||||
// When calling notifyTvMessage, make sure to verify against this map.
|
||||
mTvMessageEventEnabled[deviceId][streamId][in_type] = enabled;
|
||||
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
@ -82,11 +87,17 @@ void TvInput::init() {
|
|||
MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
|
||||
int32_t in_streamId) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
::ndk::ScopedAStatus status = ::ndk::ScopedAStatus::ok();
|
||||
if (mStreamConfigs.count(in_deviceId) == 0) {
|
||||
ALOGW("Device with id %d isn't available", in_deviceId);
|
||||
return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
|
||||
status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
|
||||
} else if (!mQueue->isValid()) {
|
||||
ALOGE("Tv Message Queue was not properly initialized");
|
||||
status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
|
||||
} else {
|
||||
*out_queue = mQueue->dupeDesc();
|
||||
}
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
return status;
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId,
|
||||
|
|
|
@ -66,6 +66,7 @@ class TvInput : public BnTvInput {
|
|||
map<int32_t, shared_ptr<TvInputDeviceInfoWrapper>> mDeviceInfos;
|
||||
map<int32_t, map<int32_t, shared_ptr<TvStreamConfigWrapper>>> mStreamConfigs;
|
||||
TvMessageEnabledMap mTvMessageEventEnabled;
|
||||
shared_ptr<AidlMessageQueue<int8_t, SynchronizedReadWrite>> mQueue;
|
||||
};
|
||||
|
||||
} // namespace input
|
||||
|
|
|
@ -355,8 +355,12 @@ TEST_P(TvInputAidlTest, GetTvMessageQueueTest) {
|
|||
}
|
||||
int32_t stream_id = streamConfigs[0].streamId;
|
||||
ALOGD("GetTvMessageQueueTest: device_id=%d, stream_id=%d", device_id, stream_id);
|
||||
MQDescriptor<int8_t, SynchronizedReadWrite> queue;
|
||||
tv_input_->getTvMessageQueueDesc(&queue, device_id, stream_id);
|
||||
MQDescriptor<int8_t, SynchronizedReadWrite> queueDescriptor;
|
||||
AidlMessageQueue<int8_t, SynchronizedReadWrite>* queue;
|
||||
tv_input_->getTvMessageQueueDesc(&queueDescriptor, device_id, stream_id);
|
||||
queue = new (std::nothrow) AidlMessageQueue<int8_t, SynchronizedReadWrite>(queueDescriptor);
|
||||
ASSERT_TRUE(queue->isValid());
|
||||
delete queue;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest,
|
||||
|
|
Loading…
Reference in a new issue