#include <AVStreams_i.h>
Inheritance diagram for TAO_StreamCtrl:


Public Member Functions | |
| TAO_StreamCtrl (void) | |
| Default Constructor. | |
| virtual | ~TAO_StreamCtrl (void) |
| virtual destructor. | |
| virtual void | stop (const AVStreams::flowSpec &the_spec) |
| virtual void | start (const AVStreams::flowSpec &the_spec) |
| virtual void | destroy (const AVStreams::flowSpec &the_spec) |
| virtual CORBA::Boolean | bind_devs (AVStreams::MMDevice_ptr a_party, AVStreams::MMDevice_ptr b_party, AVStreams::streamQoS &the_qos, const AVStreams::flowSpec &the_flows) |
| virtual CORBA::Boolean | bind (AVStreams::StreamEndPoint_A_ptr a_party, AVStreams::StreamEndPoint_B_ptr b_party, AVStreams::streamQoS &the_qos, const AVStreams::flowSpec &the_flows) |
| virtual void | unbind_dev (AVStreams::MMDevice_ptr dev, const AVStreams::flowSpec &the_spec) |
| virtual void | unbind_party (AVStreams::StreamEndPoint_ptr the_ep, const AVStreams::flowSpec &the_spec) |
| Unbind the_ep from the stream. Empty the_spec means apply to all flows. | |
| virtual void | unbind (void) |
| unbind the stream. Same effect as Basic_StreamCtrl::destroy () | |
| virtual AVStreams::VDev_ptr | get_related_vdev (AVStreams::MMDevice_ptr adev, AVStreams::StreamEndPoint_out sep) |
| virtual CORBA::Boolean | modify_QoS (AVStreams::streamQoS &new_qos, const AVStreams::flowSpec &the_spec) |
Protected Types | |
| typedef ACE_Hash_Map_Manager< MMDevice_Map_Hash_Key, MMDevice_Map_Entry, ACE_Null_Mutex > | MMDevice_Map |
| typedef ACE_Hash_Map_Iterator< MMDevice_Map_Hash_Key, MMDevice_Map_Entry, ACE_Null_Mutex > | MMDevice_Map_Iterator |
Protected Attributes | |
| MMDevice_Map | mmdevice_a_map_ |
| MMDevice_Map | mmdevice_b_map_ |
| TAO_MCastConfigIf * | mcastconfigif_ |
| AVStreams::MCastConfigIf_var | mcastconfigif_ptr_ |
| AVStreams::StreamCtrl_var | streamctrl_ |
| CORBA::ULong | source_id_ |
Definition at line 194 of file AVStreams_i.h.
|
|
Definition at line 272 of file AVStreams_i.h. |
|
|
Definition at line 273 of file AVStreams_i.h. Referenced by destroy(), modify_QoS(), start(), stop(), and unbind(). |
|
|
Default Constructor.
Definition at line 391 of file AVStreams_i.cpp. References TAO_AV_RTCP::alloc_srcid(), ACE_OS::hostname(), ACE_OS::inet_addr(), source_id_, and streamctrl_.
00392 :mcastconfigif_ (0) 00393 { 00394 try 00395 { 00396 this->streamctrl_ = this->_this (); 00397 char buf [BUFSIZ]; 00398 int result = ACE_OS::hostname (buf, BUFSIZ); 00399 unsigned long ipaddr = 0; 00400 if (result == 0) 00401 ipaddr = ACE_OS::inet_addr (buf); 00402 this->source_id_ = TAO_AV_RTCP::alloc_srcid (ipaddr); 00403 } 00404 catch (const CORBA::Exception& ex) 00405 { 00406 ex._tao_print_exception ("TAO_StreamCtrl::TAO_StreamCtrl"); 00407 } 00408 } |
|
|
virtual destructor.
Definition at line 410 of file AVStreams_i.cpp. References mcastconfigif_.
00411 {
00412 delete this->mcastconfigif_;
00413 }
|
|
||||||||||||||||||||
|
Establish a connection between two streamendpoints. This can be used if the streamendpoints have been created independent of a MMDevice Definition at line 850 of file AVStreams_i.cpp. References ACE_ASSERT, ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), FlowEndPoint_Map, FlowEndPoint_Map_Entry, FlowEndPoint_Map_Iterator, TAO_FlowSpec_Entry::flowname(), AVStreams::flowSpec, TAO_Basic_StreamCtrl::get_flow_connection(), TAO_AV_QoS::get_flow_qos(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, CORBA::is_nil(), LM_DEBUG, LM_ERROR, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), TAO_Forward_FlowSpec_Entry::parse(), AVStreams::QoS::QoSParams, AVStreams::QoS::QoSType, TAO_Basic_StreamCtrl::set_flow_connection(), AVStreams::streamQoS, CORBA::string_dup(), and TAO_debug_level. Referenced by bind_devs().
00854 {
00855 this->sep_a_ = AVStreams::StreamEndPoint_A::_duplicate(sep_a);
00856 this->sep_b_ = AVStreams::StreamEndPoint_B::_duplicate(sep_b);
00857
00858 int result = 0;
00859 try
00860 {
00861 if (CORBA::is_nil (sep_a_.in() ) ||
00862 CORBA::is_nil (sep_b_.in() ))
00863 ACE_ERROR_RETURN ((LM_ERROR,
00864 "(%P|%t) TAO_StreamCtrl::bind:"
00865 "a_party or b_party null!"),
00866 0);
00867
00868 // Define each other as their peers.
00869 CORBA::Any sep_any;
00870 sep_any <<= sep_b;
00871 sep_a_->define_property ("PeerAdapter",
00872 sep_any);
00873 sep_any <<= sep_a;
00874 sep_b_->define_property ("PeerAdapter",
00875 sep_any);
00876 // since its full profile we do the viable stream setup algorithm.
00877 // get the flows for the A streamendpoint.
00878 // the flows spec is empty and hence we do a exhaustive match.
00879 AVStreams::flowSpec a_flows, b_flows;
00880 CORBA::Any_var flows_any;
00881 flows_any = sep_a_->get_property_value ("Flows");
00882 AVStreams::flowSpec *temp_flows;
00883 flows_any.in () >>= temp_flows;
00884 a_flows = *temp_flows;
00885 flows_any = sep_b_->get_property_value ("Flows");
00886 flows_any.in () >>= temp_flows;
00887 b_flows = *temp_flows;
00888 u_int i;
00889 FlowEndPoint_Map *a_fep_map;
00890 FlowEndPoint_Map *b_fep_map;
00891 ACE_NEW_RETURN (a_fep_map,
00892 FlowEndPoint_Map,
00893 0);
00894 ACE_NEW_RETURN (b_fep_map,
00895 FlowEndPoint_Map,
00896 0);
00897 for (i=0;i<a_flows.length ();i++)
00898 {
00899 const char *flowname = a_flows[i];
00900 // get the flowendpoint references.
00901 CORBA::Object_var fep_obj =
00902 sep_a_->get_fep (flowname);
00903 AVStreams::FlowEndPoint_var fep =
00904 AVStreams::FlowEndPoint::_narrow (fep_obj.in ());
00905 ACE_CString fep_key (flowname);
00906 result = a_fep_map->bind (fep_key, fep);
00907 if (result == -1)
00908 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname));
00909 }
00910 // get the flowendpoints for streamendpoint_b
00911 for (i=0;i<b_flows.length ();i++)
00912 {
00913 const char *flowname = b_flows[i];
00914 // get the flowendpoint references.
00915 CORBA::Object_var fep_obj =
00916 sep_b->get_fep (flowname);
00917 AVStreams::FlowEndPoint_var fep =
00918 AVStreams::FlowEndPoint::_narrow (fep_obj.in ());
00919 ACE_CString fep_key (flowname);
00920 result = b_fep_map->bind (fep_key, fep);
00921 if (result == -1)
00922 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::bind failed for %s\n", flowname));
00923 }
00924 FlowEndPoint_Map *map_a = 0, *map_b = 0;
00925 if (flow_spec.length () == 0)
00926 {
00927 map_a = a_fep_map;
00928 map_b = b_fep_map;
00929 }
00930 else
00931 {
00932 FlowEndPoint_Map *spec_fep_map_a, *spec_fep_map_b;
00933 ACE_NEW_RETURN (spec_fep_map_a,
00934 FlowEndPoint_Map,
00935 0);
00936 ACE_NEW_RETURN (spec_fep_map_b,
00937 FlowEndPoint_Map,
00938 0);
00939 for (i=0; i< flow_spec.length ();i++)
00940 {
00941 TAO_Forward_FlowSpec_Entry *entry = 0;
00942 ACE_NEW_RETURN (entry,
00943 TAO_Forward_FlowSpec_Entry,
00944 0);
00945 entry->parse (flow_spec[i]);
00946 ACE_CString fep_key (entry->flowname ());
00947 AVStreams::FlowEndPoint_var fep;
00948 result = a_fep_map->find (fep_key, fep);
00949 if (result == -1)
00950 ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on A side for flowname: %s\n", flow_spec[i].in ()), 0);
00951
00952 result = spec_fep_map_a->bind (fep_key, fep);
00953 if (result == -1)
00954 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));
00955
00956 result = b_fep_map->find (fep_key, fep);
00957 if (result == -1)
00958 ACE_ERROR_RETURN ((LM_ERROR, "Fep not found on B side for flowname: %s\n", flow_spec[i].in ()), 0);
00959
00960 result = spec_fep_map_b->bind (fep_key, fep);
00961 if (result == -1)
00962 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Bind failed for %s\n", flow_spec[i].in ()));
00963 }
00964 map_a = spec_fep_map_a;
00965 map_b = spec_fep_map_b;
00966 }
00967
00968 TAO_AV_QoS qos (stream_qos);
00969 // Now go thru the list of flow endpoint and match them.
00970 // uses the first match policy.
00971 FlowEndPoint_Map_Iterator a_feps_iterator (*map_a);
00972 FlowEndPoint_Map_Entry *a_feps_entry, *b_feps_entry;
00973 try
00974 {
00975
00976 for (;a_feps_iterator.next (a_feps_entry) != 0;
00977 a_feps_iterator.advance ())
00978 {
00979 AVStreams::FlowEndPoint_var fep_a = a_feps_entry->int_id_;
00980 AVStreams::FlowEndPoint_var connected_to =
00981 fep_a->get_connected_fep ();
00982
00983 if (!CORBA::is_nil (connected_to.in ()))
00984 {
00985 // Skip this one, it is already connected...
00986 continue;
00987 }
00988
00989 FlowEndPoint_Map_Iterator b_feps_iterator (*map_b);
00990 for (;b_feps_iterator.next (b_feps_entry) != 0;
00991 b_feps_iterator.advance ())
00992 {
00993 AVStreams::FlowEndPoint_var fep_b = b_feps_entry->int_id_;
00994 AVStreams::FlowConnection_var flow_connection;
00995
00996 AVStreams::FlowEndPoint_var connected_to =
00997 fep_b->get_connected_fep ();
00998
00999 if (!CORBA::is_nil (connected_to.in ()))
01000 {
01001 // Skip this one, it is already connected...
01002 continue;
01003 }
01004
01005 if (fep_a->is_fep_compatible (fep_b.in()) == 1)
01006 {
01007 // assume that flow names are same so that we
01008 // can use either of them.
01009 CORBA::Object_var flow_connection_obj;
01010 CORBA::Any_var flowname_any =
01011 fep_a->get_property_value ("FlowName");
01012 const char *flowname = 0;
01013 flowname_any.in () >>= flowname;
01014 try
01015 {
01016 flow_connection_obj =
01017 this->get_flow_connection (flowname);
01018 flow_connection =
01019 AVStreams::FlowConnection::_narrow (flow_connection_obj.in ());
01020 }
01021 catch (const CORBA::Exception&)
01022 {
01023 TAO_FlowConnection *flowConnection;
01024 ACE_NEW_RETURN (flowConnection,
01025 TAO_FlowConnection,
01026 0);
01027 flow_connection = flowConnection->_this ();
01028 this->set_flow_connection (flowname,
01029 flow_connection.in ());
01030 }
01031
01032 // make sure that a_feps is flow_producer
01033 // and b_feps is flow_consumer
01034 // There should be a way to find which flow
01035 // endpoint is producer and which is
01036 // consumer.
01037
01038 AVStreams::FlowProducer_var producer;
01039 AVStreams::FlowConsumer_var consumer;
01040
01041 try
01042 {
01043 producer =
01044 AVStreams::FlowProducer::_narrow (fep_a.in());
01045 consumer =
01046 AVStreams::FlowConsumer::_narrow (fep_b.in());
01047
01048 // If the types don't match then try in
01049 // the opposite order
01050 if (CORBA::is_nil (producer.in ()))
01051 {
01052 producer =
01053 AVStreams::FlowProducer::_narrow (fep_b.in());
01054 consumer =
01055 AVStreams::FlowConsumer::_narrow (fep_a.in());
01056 }
01057 // At this point they should both be
01058 // non-nil
01059 // @@ raise an exception (which one?) if
01060 // this is not true...
01061 ACE_ASSERT (!CORBA::is_nil (producer.in ()));
01062 ACE_ASSERT (!CORBA::is_nil (consumer.in ()));
01063 }
01064 catch (const CORBA::Exception&)
01065 {
01066 //Yamuna : Recheck this
01067 throw;//_EX (producer_check);
01068 }
01069 CORBA::String_var fep_a_name, fep_b_name;
01070 flowname_any = fep_a->get_property_value ("FlowName");
01071 const char *temp_name;
01072 flowname_any.in () >>= temp_name;
01073 fep_a_name = CORBA::string_dup (temp_name);
01074 flowname_any = fep_b->get_property_value ("FlowName");
01075 flowname_any.in () >>= temp_name;
01076 fep_b_name = CORBA::string_dup (temp_name);
01077 AVStreams::QoS flow_qos;
01078 flow_qos.QoSType = fep_a_name;
01079 flow_qos.QoSParams.length (0);
01080 result = qos.get_flow_qos (fep_a_name.in (), flow_qos);
01081 if (result == -1)
01082 {
01083 flow_qos.QoSType = fep_b_name;
01084 result = qos.get_flow_qos (fep_b_name.in (),
01085 flow_qos);
01086 if (result == -1 && TAO_debug_level > 0)
01087 ACE_DEBUG ((LM_DEBUG,
01088 "No QoS Specified for this flow <%s>\n", flowname));
01089 }
01090 flow_connection->connect (producer.in (),
01091 consumer.in (),
01092 flow_qos);
01093 }
01094 }
01095 }
01096 }
01097 catch (const CORBA::Exception& ex)
01098 {
01099 ex._tao_print_exception ("TAO_StreamCtrl::bind:flow_connect block");
01100 return 0;
01101 }
01102 }
01103 catch (const CORBA::Exception&)
01104 {
01105 // error was thrown because one of the streamendpoints is light profile.
01106 // Now connect the streams together
01107 this->sep_a_->connect (this->sep_b_.in (),
01108 stream_qos,
01109 flow_spec);
01110 }
01111 return 1;
01112 }
|
|
||||||||||||||||||||
|
Establish a stream between a_party and b_party, with qos the_qos, and for the flows in the_flows if the_flows is empty, bind all the flows Causes a connection to be established between the StreamEndpoints. Returns success/failure Definition at line 515 of file AVStreams_i.cpp. References ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, bind(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::bind(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::find(), AVStreams::flowSpec, TAO_StreamCtrl::MMDevice_Map_Entry::flowspec_, CORBA::is_nil(), LM_DEBUG, LM_ERROR, mcastconfigif_, mcastconfigif_ptr_, mmdevice_a_map_, mmdevice_b_map_, TAO_StreamCtrl::MMDevice_Map_Entry::qos_, TAO_StreamCtrl::MMDevice_Map_Entry::sep_, TAO_MCastConfigIf::set_peer(), streamctrl_, AVStreams::streamQoS, TAO_debug_level, TAO_ORB_Core_instance(), and TAO_StreamCtrl::MMDevice_Map_Entry::vdev_. Referenced by TAO_MMDevice::bind().
00519 {
00520 try
00521 {
00522 if (CORBA::is_nil (a_party) && CORBA::is_nil (b_party))
00523 ACE_ERROR_RETURN ((LM_ERROR, "Both parties are nil\n"), 0);
00524 // Check to see if we have non-nil parties to bind!
00525 if (TAO_debug_level > 0)
00526 if (CORBA::is_nil (a_party) ||
00527 CORBA::is_nil (b_party))
00528 if (TAO_debug_level > 0)
00529 ACE_DEBUG ((LM_DEBUG,
00530 "(%P|%t) TAO_StreamCtrl::bind_devs: "
00531 "a_party or b_party is null"
00532 "Multicast mode\n"));
00533
00534 // Request a_party to create the endpoint and vdev
00535 CORBA::Boolean met_qos;
00536 CORBA::String_var named_vdev;
00537
00538 if (!CORBA::is_nil (a_party))
00539 {
00540 MMDevice_Map_Hash_Key find_key (a_party);
00541 MMDevice_Map_Entry find_entry;
00542 int result =
00543 this->mmdevice_a_map_.find (find_key, find_entry);
00544 if (result == 0)
00545 {
00546 if (TAO_debug_level > 0)
00547 {
00548 // Already in the map.
00549 if (TAO_debug_level > 0)
00550 ACE_DEBUG ((LM_DEBUG, "mmdevice a_party is already bound\n"));
00551 }
00552 return 1;
00553 }
00554 else
00555 {
00556 this->sep_a_ =
00557 a_party-> create_A (this->streamctrl_.in (),
00558 this->vdev_a_.out (),
00559 the_qos,
00560 met_qos,
00561 named_vdev.inout (),
00562 the_flows);
00563
00564 if (TAO_debug_level > 0)
00565 ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_A: succeeded\n"));
00566 // Define ourselves as the related_streamctrl property of the sep.
00567 CORBA::Any streamctrl_any;
00568 streamctrl_any <<= this->streamctrl_.in ();
00569 this->sep_a_->define_property ("Related_StreamCtrl",
00570 streamctrl_any);
00571
00572 CORBA::Any vdev_a_any;
00573 vdev_a_any <<= this->vdev_a_.in ();
00574 this->sep_a_->define_property ("Related_VDev",
00575 vdev_a_any);
00576
00577 CORBA::Any streamendpoint_a_any;
00578 streamendpoint_a_any <<= this->sep_a_.in ();
00579 this->vdev_a_->define_property ("Related_StreamEndpoint",
00580 streamendpoint_a_any);
00581
00582
00583 CORBA::Any mmdevice_a_any;
00584 mmdevice_a_any <<= a_party;
00585 this->vdev_a_->define_property ("Related_MMDevice",
00586 mmdevice_a_any);
00587
00588 // add the mmdevice, sep and vdev to the map.
00589 MMDevice_Map_Entry map_entry;
00590 MMDevice_Map_Hash_Key key (a_party);
00591 map_entry.sep_ = AVStreams::StreamEndPoint_A::_duplicate (this->sep_a_.in ());
00592 map_entry.vdev_ = AVStreams::VDev::_duplicate (this->vdev_a_.in ());
00593 map_entry.flowspec_ = the_flows;
00594 map_entry.qos_ = the_qos;
00595 result =
00596 this->mmdevice_a_map_.bind (key, map_entry);
00597 if (result < 0)
00598 if (TAO_debug_level > 0)
00599 ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the a_map"));
00600 }
00601 }
00602 // Request b_party to create the endpoint and vdev
00603 if (!CORBA::is_nil (b_party))
00604 {
00605 MMDevice_Map_Hash_Key find_key (b_party);
00606 MMDevice_Map_Entry find_entry;
00607 int result =
00608 this->mmdevice_b_map_.find (find_key, find_entry);
00609 if (result == 0)
00610 {
00611 // Already in the map.
00612 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "mmdevice b_party is already bound\n"));
00613 return 1;
00614 }
00615 else
00616 {
00617 this->sep_b_ =
00618 b_party-> create_B (this->streamctrl_.in (),
00619 this->vdev_b_.out (),
00620 the_qos,
00621 met_qos,
00622 named_vdev.inout (),
00623 the_flows);
00624
00625 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamCtrl::create_B: succeeded\n"));
00626
00627 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,
00628 "\n(%P|%t)stream_endpoint_b_ = %s",
00629 TAO_ORB_Core_instance ()->orb ()->object_to_string (this->sep_b_.in ())));
00630 // Define ourselves as the related_streamctrl property of the sep.
00631 CORBA::Any streamctrl_any;
00632 streamctrl_any <<= this->streamctrl_.in ();
00633 this->sep_b_->define_property ("Related_StreamCtrl",
00634 streamctrl_any);
00635
00636 CORBA::Any vdev_b_any;
00637 vdev_b_any <<= this->vdev_b_.in ();
00638 this->sep_b_->define_property ("Related_VDev",
00639 vdev_b_any);
00640
00641 CORBA::Any streamendpoint_b_any;
00642 streamendpoint_b_any <<= this->sep_b_.in ();
00643 this->vdev_b_->define_property ("Related_StreamEndpoint",
00644 streamendpoint_b_any);
00645
00646
00647 CORBA::Any mmdevice_b_any;
00648 mmdevice_b_any <<= b_party;
00649 this->vdev_b_->define_property ("Related_MMDevice",
00650 mmdevice_b_any);
00651 // add the mmdevice, sep and vdev to the map.
00652 MMDevice_Map_Entry map_entry;
00653 MMDevice_Map_Hash_Key key (b_party);
00654 map_entry.sep_ = AVStreams::StreamEndPoint::_duplicate (this->sep_b_.in ());
00655 map_entry.vdev_ = AVStreams::VDev::_duplicate(this->vdev_b_.in ());
00656 map_entry.flowspec_ = the_flows;
00657 map_entry.qos_ = the_qos;
00658 int result =
00659 this->mmdevice_b_map_.bind (key, map_entry);
00660 if (result < 0)
00661 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Error binding mmdevice entry in the b_map"));
00662 }
00663 }
00664
00665 // Tell the endpoints about each other.
00666 if ((!CORBA::is_nil (a_party)) && (!CORBA::is_nil (b_party)))
00667 {
00668 CORBA::Any sep_a_peer_any;
00669 CORBA::Any sep_b_peer_any;
00670
00671 sep_a_peer_any <<= this->sep_b_.in();
00672 sep_b_peer_any <<= this->sep_a_.in();
00673 this->sep_a_->define_property ("PeerAdapter",
00674 sep_a_peer_any);
00675
00676 this->sep_b_->define_property ("PeerAdapter",
00677 sep_b_peer_any);
00678 }
00679
00680 // In the full profile case there's no VDev.
00681 if (CORBA::is_nil (b_party) && (!CORBA::is_nil (this->vdev_a_.in ())))
00682 {
00683 // Now set the source id for this A endpoint.
00684 // If the sep contains flow producers then set the source ids for those
00685 // instead.
00686 try
00687 {
00688 CORBA::Any_ptr flows_any = this->sep_a_->get_property_value ("Flows");
00689 AVStreams::flowSpec_var flows;
00690 *flows_any >>= flows.out ();
00691 for (CORBA::ULong i=0; i< flows->length ();++i)
00692 {
00693 CORBA::Object_var fep_obj =
00694 this->sep_a_->get_fep (flows [i]);
00695 try
00696 {
00697 AVStreams::FlowProducer_var producer =
00698 AVStreams::FlowProducer::_narrow (fep_obj.in ());
00699 producer->set_source_id (this->source_id_++);
00700 }
00701 catch (const CORBA::Exception& ex)
00702 {
00703 if (TAO_debug_level > 0)
00704 ACE_DEBUG ((LM_DEBUG, " %s ", static_cast<char const*>(flows[i])));
00705
00706 ex._tao_print_exception (
00707 "producer_check: not a producer");
00708
00709 }
00710 }
00711 }
00712 catch (const CORBA::Exception&)
00713 {
00714 // Since the full profile failed try setting the source id
00715 // for the sep instead.
00716 // @@Naga: What do we do if in the light profile the sep has
00717 // many producers who do not have flow interfaces. Then
00718 // the streamctrl has to give an array of source ids to
00719 // the sep.
00720 this->sep_a_->set_source_id (this->source_id_++);
00721 }
00722 if (!this->mcastconfigif_)
00723 {
00724 ACE_NEW_RETURN (this->mcastconfigif_,
00725 TAO_MCastConfigIf,
00726 0);
00727 // @@: Deactivating the object thru poa means calling remove_ref after _this.
00728 this->mcastconfigif_ptr_ = this->mcastconfigif_->_this ();
00729 }
00730 // Multicast source being added.
00731 CORBA::Boolean result = this->vdev_a_->set_Mcast_peer (this->streamctrl_.in (),
00732 this->mcastconfigif_ptr_.in (),
00733 the_qos,
00734 the_flows);
00735 if (!result)
00736 ACE_ERROR_RETURN ((LM_ERROR, "set_Mcast_peer failed\n"), 0);
00737 }
00738
00739 if (CORBA::is_nil (a_party))
00740 {
00741 if (!CORBA::is_nil (this->vdev_b_.in ()))
00742 {
00743 // Multicast sink being added.
00744 if (!this->mcastconfigif_)
00745 ACE_ERROR_RETURN ((LM_ERROR, "first add a source and then a sink\n"), 0);
00746 this->mcastconfigif_->set_peer (this->vdev_b_.in (),
00747 the_qos,
00748 the_flows);
00749 }
00750
00751 int connect_leaf_success = 0;
00752 try
00753 {
00754 // @@: define null interfaces for Atm so that they can be implemented once
00755 // ACE adds support for ATM multicast.
00756 connect_leaf_success = this->sep_a_->connect_leaf (this->sep_b_.in (),
00757 the_qos,
00758 the_flows);
00759 connect_leaf_success = 1;
00760 }
00761 catch (const AVStreams::notSupported&)
00762 {
00763 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "connect_leaf failed\n"));
00764 connect_leaf_success = 0;
00765 }
00766 catch (const CORBA::Exception& ex)
00767 {
00768 ex._tao_print_exception (
00769 "TAO_StreamCtrl::bind_devs");
00770 }
00771 if (!connect_leaf_success)
00772 {
00773 if (TAO_debug_level > 0)
00774 ACE_DEBUG ((LM_DEBUG,"TAO_StreamCtrl::bind_devs Multiconnect\n"));
00775 AVStreams::flowSpec connect_flows = the_flows;
00776 this->sep_a_->multiconnect (the_qos, connect_flows);
00777 this->sep_b_->multiconnect (the_qos, connect_flows);
00778 }
00779 }
00780
00781 if (!CORBA::is_nil (a_party) && !CORBA::is_nil (b_party))
00782 {
00783 // Check to see if the MMDevice contains FDev objects
00784 // If it contains FDev objects, then we are using the
00785 // Full profile, and we want to call bind() instead
00786 // of connect() on the the streamctrl
00787 if( a_party->is_property_defined("Flows") &&
00788 b_party->is_property_defined("Flows") )
00789 {
00790 if (TAO_debug_level > 0) {
00791 //FUZZ: disable check_for_lack_ACE_OS
00792 ACE_DEBUG ((LM_DEBUG, "(%N,%l) Full profile, invoking bind()\n"));
00793 //FUZZ: enable check_for_lack_ACE_OS
00794 }
00795
00796 // It is full profile
00797 // we have feps in the sep then dont call connect
00798 // instead call bind on the streamctrl.
00799 this->bind (this->sep_a_.in (),
00800 this->sep_b_.in (),
00801 the_qos,
00802 the_flows);
00803
00804
00805
00806 }
00807 // This is the light profile, call connect()
00808 else if (!CORBA::is_nil (this->vdev_a_.in ()) && !CORBA::is_nil (this->vdev_b_.in ()))
00809 {
00810 if (TAO_debug_level > 0) {
00811 //FUZZ: disable check_for_lack_ACE_OS
00812 ACE_DEBUG ((LM_DEBUG, "(%N,%l) Light profile, invoking connect()\n"));
00813 //FUZZ: enable check_for_lack_ACE_OS
00814 }
00815
00816 // Tell the 2 VDev's about one another
00817 this->vdev_a_->set_peer (this->streamctrl_.in (),
00818 this->vdev_b_.in (),
00819 the_qos,
00820 the_flows);
00821
00822 this->vdev_b_->set_peer (this->streamctrl_.in (),
00823 this->vdev_a_.in (),
00824 the_qos,
00825 the_flows);
00826
00827
00828 // Now connect the streams together. This will
00829 // establish the connection
00830 CORBA::Boolean result =
00831 this->sep_a_->connect (this->sep_b_.in (),
00832 the_qos,
00833 the_flows);
00834 if (result == 0)
00835 ACE_ERROR_RETURN ((LM_ERROR, "sep_a->connect (sep_b) failed\n"), 0);
00836 }
00837 }
00838 }
00839 catch (const CORBA::Exception& ex)
00840 {
00841 ex._tao_print_exception ("TAO_StreamCtrl::bind_devs");
00842 return 0;
00843 }
00844 return 1;
00845 }
|
|
|
Tears down the stream. This will close the connection, and delete the streamendpoint and vdev associated with this stream Empty the_spec means apply operation to all flows Reimplemented from TAO_Basic_StreamCtrl. Definition at line 479 of file AVStreams_i.cpp. References ACE_DEBUG, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), TAO_AV_Core::deactivate_servant(), TAO_Basic_StreamCtrl::destroy(), AVStreams::flowSpec, LM_DEBUG, MMDevice_Map_Iterator, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), and TAO_debug_level.
00480 {
00481 try
00482 {
00483 TAO_Basic_StreamCtrl::destroy (flow_spec);
00484 if (this->flow_connection_map_.current_size () > 0)
00485 return;
00486
00487 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
00488 MMDevice_Map::ENTRY *entry = 0;
00489 for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
00490 {
00491 entry->int_id_.sep_->destroy (flow_spec);
00492 }
00493 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
00494 for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
00495 {
00496 entry->int_id_.sep_->destroy (flow_spec);
00497 }
00498 }
00499 catch (const CORBA::Exception& ex)
00500 {
00501 ex._tao_print_exception ("TAO_StreamCtrl::destroy");
00502 return;
00503 }
00504
00505 int result = TAO_AV_Core::deactivate_servant (this);
00506 if (result < 0)
00507 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamCtrl::destroy failed\n"));
00508 }
|
|
||||||||||||
|
Definition at line 1157 of file AVStreams_i.cpp. References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::find(), mmdevice_a_map_, TAO_StreamCtrl::MMDevice_Map_Entry::sep_, and TAO_StreamCtrl::MMDevice_Map_Entry::vdev_.
01159 {
01160 MMDevice_Map_Hash_Key key (adev);
01161 MMDevice_Map_Entry entry;
01162 int result = -1;
01163 result = this->mmdevice_a_map_.find (key, entry);
01164 if (result < 0)
01165 {
01166 result = this->mmdevice_a_map_.find (key, entry);
01167 if (result < 0)
01168 return AVStreams::VDev::_nil ();
01169 }
01170 sep = AVStreams::StreamEndPoint::_duplicate (entry.sep_.in ());
01171 return AVStreams::VDev::_duplicate (entry.vdev_.in ());
01172 }
|
|
||||||||||||
|
Changes the QoS associated with the stream Empty the_spec means apply operation to all flows Reimplemented from TAO_Basic_StreamCtrl. Definition at line 1176 of file AVStreams_i.cpp. References ACE_DEBUG, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), TAO_FlowSpec_Entry::direction(), TAO_Forward_FlowSpec_Entry::entry_to_string(), AVStreams::flowSpec, LM_DEBUG, mcastconfigif_, MMDevice_Map_Iterator, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), TAO_Forward_FlowSpec_Entry::parse(), AVStreams::streamQoS, CORBA::string_dup(), and TAO_debug_level.
01178 {
01179 if (TAO_debug_level > 0)
01180 ACE_DEBUG ((LM_DEBUG,
01181 "TAO_StreamCtrl::modify_QoS\n"));
01182
01183
01184 if (this->mcastconfigif_ != 0)
01185 {
01186 // call modify_Qos on the root VDev which is the mcast configif.
01187 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Cannot Modify the Qos for multipoint streams\n"));
01188 }
01189 else
01190 {
01191 try
01192 {
01193 AVStreams::flowSpec in_flowspec;
01194 AVStreams::flowSpec out_flowspec;
01195
01196 in_flowspec.length (0);
01197 out_flowspec.length (0);
01198
01199 int in_index = 0;
01200 int out_index = 0;
01201
01202 AVStreams::flowSpec flowspec;
01203 if (the_spec.length () == 0)
01204 {
01205 // Apply modify_qos to all the flows
01206 flowspec = this->flows_;
01207 MMDevice_Map_Iterator iterator (this->mmdevice_a_map_);
01208 MMDevice_Map::ENTRY *entry = 0;
01209 for (;iterator.next (entry) != 0;iterator.advance ())
01210 {
01211 flowspec = entry->int_id_.flowspec_;
01212 }
01213 }
01214 else
01215 {
01216 flowspec = the_spec;
01217 }
01218
01219 if (TAO_debug_level > 0)
01220 ACE_DEBUG ((LM_DEBUG,
01221 "TAO_StreamCtrl::modify_QoS\n"));
01222
01223
01224 for (u_int i=0;i < flowspec.length ();i++)
01225 {
01226 TAO_Forward_FlowSpec_Entry entry;
01227 entry.parse (flowspec [i]);
01228 int direction = entry.direction ();
01229 if (direction == 0)
01230 {
01231 in_flowspec.length (in_index + 1);
01232 in_flowspec [in_index++] = CORBA::string_dup (entry.entry_to_string ());
01233 }
01234 else
01235 {
01236 out_flowspec.length (out_index + 1);
01237 out_flowspec [out_index++] = CORBA::string_dup (entry.entry_to_string ());
01238 }
01239 }
01240
01241 if (in_flowspec.length () != 0)
01242 {
01243 this->vdev_a_->modify_QoS (new_qos, in_flowspec);
01244 }
01245
01246 if (out_flowspec.length () != 0)
01247 {
01248 this->vdev_b_->modify_QoS (new_qos, out_flowspec);
01249 }
01250 }
01251 catch (const CORBA::Exception& ex)
01252 {
01253 ex._tao_print_exception ("TAO_StreamCtrl::modify_QoS");
01254 return 0;
01255 }
01256
01257 }
01258 return 1;
01259 }
|
|
|
Start the transfer of data in the stream. Empty the_spec means apply operation to all flows Reimplemented from TAO_Basic_StreamCtrl. Definition at line 448 of file AVStreams_i.cpp. References ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), AVStreams::flowSpec, MMDevice_Map_Iterator, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), and TAO_Basic_StreamCtrl::start().
00449 {
00450 try
00451 {
00452 TAO_Basic_StreamCtrl::start (flow_spec);
00453 if (this->flow_connection_map_.current_size () > 0)
00454 return;
00455
00456 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
00457 MMDevice_Map::ENTRY *entry = 0;
00458 for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
00459 {
00460 entry->int_id_.sep_->start (flow_spec);
00461 }
00462 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
00463 for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
00464 {
00465 entry->int_id_.sep_->start (flow_spec);
00466 }
00467 }
00468 catch (const CORBA::Exception& ex)
00469 {
00470 ex._tao_print_exception ("TAO_StreamCtrl::start");
00471 return;
00472 }
00473 }
|
|
|
Stop the transfer of data of the stream Empty the_spec means apply operation to all flows Reimplemented from TAO_Basic_StreamCtrl. Definition at line 419 of file AVStreams_i.cpp. References ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), AVStreams::flowSpec, MMDevice_Map_Iterator, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next(), and TAO_Basic_StreamCtrl::stop().
00420 {
00421 try
00422 {
00423 TAO_Basic_StreamCtrl::stop (flow_spec);
00424 if (this->flow_connection_map_.current_size () > 0)
00425 return;
00426 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
00427 MMDevice_Map::ENTRY *entry = 0;
00428 for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
00429 {
00430 entry->int_id_.sep_->stop (flow_spec);
00431 }
00432 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
00433 for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
00434 {
00435 entry->int_id_.sep_->stop (flow_spec);
00436 }
00437 }
00438 catch (const CORBA::Exception& ex)
00439 {
00440 ex._tao_print_exception ("TAO_Basic_StreamCtrl::stop");
00441 return;
00442 }
00443 }
|
|
|
unbind the stream. Same effect as Basic_StreamCtrl::destroy ()
Definition at line 1115 of file AVStreams_i.cpp. References ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance(), AVStreams::flowSpec, MMDevice_Map_Iterator, and ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next().
01116 {
01117 try
01118 {
01119 if (this->flow_connection_map_.current_size () > 0)
01120 return;
01121
01122 AVStreams::flowSpec flow_spec;
01123 flow_spec.length(0);
01124
01125 MMDevice_Map_Iterator a_iterator (this->mmdevice_a_map_);
01126 MMDevice_Map::ENTRY *entry = 0;
01127 for (;a_iterator.next (entry)!= 0;a_iterator.advance ())
01128 {
01129 entry->int_id_.sep_->destroy (flow_spec);
01130 }
01131 MMDevice_Map_Iterator b_iterator (this->mmdevice_b_map_);
01132 for (;b_iterator.next (entry)!= 0;b_iterator.advance ())
01133 {
01134 entry->int_id_.sep_->destroy (flow_spec);
01135 }
01136 }
01137 catch (const CORBA::Exception& ex)
01138 {
01139 ex._tao_print_exception ("TAO_StreamCtrl::unbind");
01140 return;
01141 }
01142 }
|
|
||||||||||||
|
Definition at line 1151 of file AVStreams_i.cpp. References AVStreams::flowSpec.
01153 {
01154 }
|
|
||||||||||||
|
Unbind the_ep from the stream. Empty the_spec means apply to all flows.
Definition at line 1145 of file AVStreams_i.cpp. References AVStreams::flowSpec.
01147 {
01148 }
|
|
|
Definition at line 277 of file AVStreams_i.h. Referenced by bind_devs(), modify_QoS(), and ~TAO_StreamCtrl(). |
|
|
Definition at line 278 of file AVStreams_i.h. Referenced by bind_devs(). |
|
|
Definition at line 275 of file AVStreams_i.h. Referenced by bind_devs(), and get_related_vdev(). |
|
|
Definition at line 276 of file AVStreams_i.h. Referenced by bind_devs(). |
|
|
Definition at line 280 of file AVStreams_i.h. Referenced by TAO_StreamCtrl(). |
|
|
Definition at line 279 of file AVStreams_i.h. Referenced by bind_devs(), and TAO_StreamCtrl(). |
1.3.6