Bug 1341162 - Fix -Wunreachable-code-return warning in webrtc/signaling. r?bwc draft
authorChris Peterson <cpeterson@mozilla.com>
Mon, 20 Feb 2017 14:45:30 -0800
changeset 487148 418f57e516aad4d5261fc74e4ed4fe4be30106a8
parent 487087 d0462b0948e0b1147dcce615bddcc46379bdadb2
child 546398 a97eb0951122e184af3185813b7ebd2ada9cb804
push id46153
push usercpeterson@mozilla.com
push dateTue, 21 Feb 2017 02:33:03 +0000
reviewersbwc
bugs1341162
milestone54.0a1
Bug 1341162 - Fix -Wunreachable-code-return warning in webrtc/signaling. r?bwc The WebrtcVideoConduit::GetRTCPSenderReport() member function has an unnecessary scope block and unreachable `return false`. media/webrtc/signaling/src/media-conduit/VideoConduit.cpp:847:10 [-Wunreachable-code-return] 'return' will never be executed MozReview-Commit-ID: 1GFcupqcA9k
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -818,36 +818,34 @@ bool WebrtcVideoConduit::GetRTCPReceiver
   return true;
 }
 
 bool
 WebrtcVideoConduit::GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
                                         unsigned int* packetsSent,
                                         uint64_t* bytesSent)
 {
-  {
-    CSFLogVerbose(logTag, "%s for VideoConduit:%p", __FUNCTION__, this);
-    MutexAutoLock lock(mCodecMutex);
-    if (!mSendStream) {
-      return false;
-    }
+  CSFLogVerbose(logTag, "%s for VideoConduit:%p", __FUNCTION__, this);
+  MutexAutoLock lock(mCodecMutex);
+  if (!mSendStream) {
+    return false;
+  }
 
-    const webrtc::VideoSendStream::Stats& stats = mSendStream->GetStats();
-    *packetsSent = 0;
-    for (auto entry: stats.substreams){
-      *packetsSent += entry.second.rtp_stats.transmitted.packets;
-      // NG -- per https://www.w3.org/TR/webrtc-stats/ this is only payload bytes
-      *bytesSent += entry.second.rtp_stats.MediaPayloadBytes();
-    }
-    // Note: timestamp is not correct per the spec... should be time the rtcp
-    // was received (remote) or sent (local)
-    *timestamp = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
-    return true;
+  const webrtc::VideoSendStream::Stats& stats = mSendStream->GetStats();
+  *packetsSent = 0;
+  for (auto entry: stats.substreams){
+    *packetsSent += entry.second.rtp_stats.transmitted.packets;
+    // NG -- per https://www.w3.org/TR/webrtc-stats/ this is only payload bytes
+    *bytesSent += entry.second.rtp_stats.MediaPayloadBytes();
   }
-  return false;
+
+  // Note: timestamp is not correct per the spec... should be time the rtcp
+  // was received (remote) or sent (local)
+  *timestamp = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
+  return true;
 }
 
 MediaConduitErrorCode
 WebrtcVideoConduit::InitMain()
 {
 #if defined(MOZILLA_INTERNAL_API)
   // already know we must be on MainThread barring unit test weirdness
   MOZ_ASSERT(NS_IsMainThread());