sign: Refactor AbstractPort::setStreamSatsTracking

Move start/stop stream stats tracking inside setStreamStatsTracking. In
future, maybe convert setStreamStatsTracking to virtual function?
This commit is contained in:
Srivats P 2016-12-06 18:30:26 +05:30
parent 387e6700cd
commit 028843c55a

View File

@ -105,22 +105,12 @@ bool AbstractPort::modify(const OstProto::Port &port)
data_.set_transmit_mode(port.transmit_mode()); data_.set_transmit_mode(port.transmit_mode());
if (port.has_track_stream_stats()) if (port.has_track_stream_stats())
setTrackStreamStats(port.track_stream_stats()); ret |= setTrackStreamStats(port.track_stream_stats());
if (port.has_user_name()) { if (port.has_user_name()) {
data_.set_user_name(port.user_name()); data_.set_user_name(port.user_name());
} }
if (port.has_track_stream_stats()) {
bool val = port.track_stream_stats() ?
startStreamStatsTracking() : stopStreamStatsTracking();
if (val)
data_.set_track_stream_stats(port.track_stream_stats());
ret |= val;
}
return ret; return ret;
} }
@ -192,7 +182,12 @@ void AbstractPort::addNote(QString note)
bool AbstractPort::setTrackStreamStats(bool enable) bool AbstractPort::setTrackStreamStats(bool enable)
{ {
data_.set_track_stream_stats(enable); bool val = enable ? startStreamStatsTracking() : stopStreamStatsTracking();
if (val)
data_.set_track_stream_stats(enable);
return val;
} }
AbstractPort::Accuracy AbstractPort::rateAccuracy() AbstractPort::Accuracy AbstractPort::rateAccuracy()