13
0

Avoid dynamic-cast, prefer virtual inheritance for performance reasons

This commit is contained in:
Robin Gareus 2019-02-21 16:10:45 +01:00
parent 522f28b3c5
commit 8006057279
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 2 additions and 2 deletions

View File

@ -148,6 +148,7 @@ public:
int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler); int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
virtual bool declick_in_progress () const { return false; }
virtual bool can_record() { return false; } virtual bool can_record() { return false; }
void non_realtime_transport_stop (samplepos_t now, bool flush); void non_realtime_transport_stop (samplepos_t now, bool flush);

View File

@ -583,8 +583,7 @@ Session::declick_in_progress () const
{ {
boost::shared_ptr<RouteList> rl = routes.reader(); boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i); if ((*i)->declick_in_progress ()) {
if (tr && tr->declick_in_progress ()) {
return true; return true;
} }
} }