📄 avstreams_i.cpp
字号:
FlowEndPoint_Map,
0);
for (i=0; i< flow_spec.length ();i++)
{
TAO_Forward_FlowSpec_Entry *entry;
ACE_NEW_RETURN (entry,
TAO_Forward_FlowSpec_Entry,
0);
entry->parse (flow_spec[i].in ());
ACE_CString fep_key (entry->flowname ());
AVStreams::FlowEndPoint_var fep;
result = a_fep_map->find (fep_key, fep);
if (result == -1)
ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on A side for flowname: %s\n", flow_spec[i].in ()), 0);
result = spec_fep_map_a->bind (fep_key, fep);
if (result == -1)
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));
result = b_fep_map->find (fep_key, fep);
if (result == -1)
ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on B side for flowname: %s\n", flow_spec[i].in ()), 0);
result = spec_fep_map_b->bind (fep_key, fep);
if (result == -1)
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));
}
map_a = spec_fep_map_a;
map_b = spec_fep_map_b;
}
TAO_AV_QoS qos (stream_qos);
// Now go thru the list of flow endpoint and match them.
// uses the first match policy.
FlowEndPoint_Map_Iterator a_feps_iterator (*map_a);
FlowEndPoint_Map_Entry *a_feps_entry, *b_feps_entry;
ACE_TRY_EX (flow_connect)
{
for (;a_feps_iterator.next (a_feps_entry) != 0;
a_feps_iterator.advance ())
{
AVStreams::FlowEndPoint_var fep_a = a_feps_entry->int_id_;
AVStreams::FlowEndPoint_var connected_to =
fep_a->get_connected_fep (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
if (!CORBA::is_nil (connected_to.in ()))
{
// Skip this one, it is already connected...
continue;
}
FlowEndPoint_Map_Iterator b_feps_iterator (*map_b);
for (;b_feps_iterator.next (b_feps_entry) != 0;
b_feps_iterator.advance ())
{
AVStreams::FlowEndPoint_var fep_b = b_feps_entry->int_id_;
AVStreams::FlowConnection_var flow_connection;
AVStreams::FlowEndPoint_var connected_to =
fep_b->get_connected_fep (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
if (!CORBA::is_nil (connected_to.in ()))
{
// Skip this one, it is already connected...
continue;
}
if (fep_a->is_fep_compatible (fep_b.in()
ACE_ENV_ARG_PARAMETER) == 1)
{
ACE_TRY_CHECK_EX (flow_connect);
// assume that flow names are same so that we
// can use either of them.
CORBA::Object_var flow_connection_obj;
CORBA::Any_var flowname_any =
fep_a->get_property_value ("FlowName"
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
const char *flowname = 0;
flowname_any.in () >>= flowname;
ACE_TRY_EX (flow_connection)
{
flow_connection_obj =
this->get_flow_connection (flowname
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connection);
flow_connection =
AVStreams::FlowConnection::_narrow (flow_connection_obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connection);
}
ACE_CATCHANY
{
TAO_FlowConnection *flowConnection;
ACE_NEW_RETURN (flowConnection,
TAO_FlowConnection,
0);
flow_connection = flowConnection->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
this->set_flow_connection (flowname,
flow_connection.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
// make sure that a_feps is flow_producer
// and b_feps is flow_consumer
// There should be a way to find which flow
// endpoint is producer and which is
// consumer.
AVStreams::FlowProducer_var producer;
AVStreams::FlowConsumer_var consumer;
ACE_TRY_EX (producer_check)
{
producer =
AVStreams::FlowProducer::_narrow (fep_a.in()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (producer_check);
consumer =
AVStreams::FlowConsumer::_narrow (fep_b.in()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (producer_check);
// If the types don't match then try in
// the opposite order
if (CORBA::is_nil (producer.in ()))
{
producer =
AVStreams::FlowProducer::_narrow (fep_b.in()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (producer_check);
consumer =
AVStreams::FlowConsumer::_narrow (fep_a.in()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (producer_check);
}
// At this point they should both be
// non-nil
// @@ raise an exception (which one?) if
// this is not true...
ACE_ASSERT (!CORBA::is_nil (producer.in ()));
ACE_ASSERT (!CORBA::is_nil (consumer.in ()));
}
ACE_CATCHANY
{
//Yamuna : Recheck this
ACE_RE_THROW;//_EX (producer_check);
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
CORBA::String_var fep_a_name, fep_b_name;
flowname_any = fep_a->get_property_value ("FlowName"
ACE_ENV_ARG_PARAMETER);
const char *temp_name;
flowname_any.in () >>= temp_name;
fep_a_name = CORBA::string_dup (temp_name);
flowname_any = fep_b->get_property_value ("FlowName"
ACE_ENV_ARG_PARAMETER);
flowname_any.in () >>= temp_name;
fep_b_name = CORBA::string_dup (temp_name);
AVStreams::QoS flow_qos;
flow_qos.QoSType = fep_a_name;
flow_qos.QoSParams.length (0);
result = qos.get_flow_qos (fep_a_name.in (), flow_qos);
if (result == -1)
{
flow_qos.QoSType = fep_b_name;
result = qos.get_flow_qos (fep_b_name.in (),
flow_qos);
if (result == -1 && TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"No QoS Specified for this flow <%s>\n", flowname));
}
flow_connection->connect (producer.in (),
consumer.in (),
flow_qos
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK_EX (flow_connect);
}
}
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"TAO_StreamCtrl::bind:flow_connect block");
return 0;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
}
ACE_CATCHANY
{
// error was thrown because one of the streamendpoints is light profile.
// Now connect the streams together
this->sep_a_->connect (this->sep_b_.in (),
stream_qos,
flow_spec
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
return 1;
}
void
TAO_StreamCtrl::unbind (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::streamOpFailed))
{
ACE_TRY
{
if (this->flow_connection_map_.current_size () > 0)
return;
AVStreams::flowSpec flow_spec;
flow_spec.length(0);
MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
MMDevice_Map::ENTRY *entry = 0;
for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
{
entry->int_id_.sep_->destroy (flow_spec ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
{
entry->int_id_.sep_->destroy (flow_spec ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_StreamCtrl::unbind");
return;
}
ACE_ENDTRY;
ACE_CHECK;
}
void
TAO_StreamCtrl::unbind_party (AVStreams::StreamEndPoint_ptr /* the_ep */,
const AVStreams::flowSpec &/* the_spec */
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::streamOpFailed,
AVStreams::noSuchFlow))
{
}
void
TAO_StreamCtrl::unbind_dev (AVStreams::MMDevice_ptr /* dev */,
const AVStreams::flowSpec & /* the_spec */
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::streamOpFailed,
AVStreams::noSuchFlow))
{
}
AVStreams::VDev_ptr
TAO_StreamCtrl::get_related_vdev (AVStreams::MMDevice_ptr adev,
AVStreams::StreamEndPoint_out sep
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::streamOpFailed))
{
MMDevice_Map_Hash_Key key (adev);
MMDevice_Map_Entry entry;
int result = -1;
result = this->mmdevice_a_map_.find (key, entry);
if (result < 0)
{
result = this->mmdevice_a_map_.find (key, entry);
if (result < 0)
return AVStreams::VDev::_nil ();
}
sep = AVStreams::StreamEndPoint::_duplicate (entry.sep_.in ());
return AVStreams::VDev::_duplicate (entry.vdev_.in ());
}
CORBA::Boolean
TAO_StreamCtrl::modify_QoS (AVStreams::streamQoS &new_qos,
const AVStreams::flowSpec &the_spec
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
AVStreams::noSuchFlow,
AVStreams::QoSRequestFailed))
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"TAO_StreamCtrl::modify_QoS\n"));
if (this->mcastconfigif_ != 0)
{
// call modify_Qos on the root VDev which is the mcast configif.
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Cannot Modify the Qos for multipoint streams\n"));
}
else
{
ACE_TRY
{
AVStreams::flowSpec in_flowspec;
AVStreams::flowSpec out_flowspec;
in_flowspec.length (0);
out_flowspec.length (0);
int in_index = 0;
int out_index = 0;
AVStreams::flowSpec flowspec;
if (the_spec.length () == 0)
{
// Apply modify_qos to all the flows
flowspec = this->flows_;
MMDevice_Map_Iterator iterator (this->mmdevice_a_map_);
MMDevice_Map::ENTRY *entry = 0;
for (;iterator.next (entry) != 0;iterator.advance ())
{
flowspec = entry->int_id_.flowspec_;
}
}
else
{
flowspec = the_spec;
}
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"TAO_StreamCtrl::modify_QoS\n"));
for (u_int i=0;i < flowspec.length ();i++)
{
TAO_Forward_FlowSpec_Entry entry;
entry.parse (flowspec [i].in ());
int direction = entry.direction ();
if (direction == 0)
{
in_flowspec.length (in_index + 1);
in_flowspec [in_index++] = CORBA::string_dup (entry.entry_to_string ());
}
else
{
out_flowspec.length (out_index + 1);
out_flowspec [out_index++] = CORBA::string_dup (entry.entry_to_string ());
}
}
if (in_flowspec.length () != 0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -