summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2017-09-25 17:42:13 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2017-09-25 17:42:13 -0400
commit694b039b12c4129096e3ad5ba8681f4151df2792 (patch)
treed2d7f50ab50c6ce13dcaab3066caec334b707ef1
parentc38e85f34ae5ebad13bc5a6b3d87abb474583e90 (diff)
downloadsdl_core-fix/video_capabilities_validation.tar.gz
Validate outgoing video paramsfix/video_capabilities_validation
Reverts this section back to https://github.com/shoamano83/sdl_core/commit/f6ea1262c4b6a3d1e10dc89fa570720a6c85ea9d#diff-4a7a19ae471dc741759dcc42796f9fc3R1513
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 7f30017856..35a3fb032a 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -1538,12 +1538,37 @@ void ProtocolHandlerImpl::NotifySessionStartedResult(
}
BsonObject start_session_ack_params;
+ bson_object_initialize_default(&start_session_ack_params);
// when video service is successfully started, copy input parameters
// ("width", "height", "videoProtocol", "videoCodec") to the ACK packet
if (packet->service_type() == kMobileNav && packet->data() != NULL) {
- start_session_ack_params = bson_object_from_bytes(packet->data());
- } else {
- bson_object_initialize_default(&start_session_ack_params);
+ BsonObject req_param = bson_object_from_bytes(packet->data());
+ BsonElement* element = NULL;
+
+ if ((element = bson_object_get(&req_param, strings::height)) != NULL &&
+ element->type == TYPE_INT32) {
+ bson_object_put_int32(&start_session_ack_params,
+ strings::height,
+ bson_object_get_int32(&req_param, strings::height));
+ }
+ if ((element = bson_object_get(&req_param, strings::width)) != NULL &&
+ element->type == TYPE_INT32) {
+ bson_object_put_int32(&start_session_ack_params,
+ strings::width,
+ bson_object_get_int32(&req_param, strings::width));
+ }
+ char* protocol =
+ bson_object_get_string(&req_param, strings::video_protocol);
+ if (protocol != NULL) {
+ bson_object_put_string(
+ &start_session_ack_params, strings::video_protocol, protocol);
+ }
+ char* codec = bson_object_get_string(&req_param, strings::video_codec);
+ if (codec != NULL) {
+ bson_object_put_string(
+ &start_session_ack_params, strings::video_codec, codec);
+ }
+ bson_object_deinitialize(&req_param);
}
ProtocolPacket::ProtocolVersion* fullVersion;