Browse Source

Add type check on track to prevent PLI for non-video tracks.

Paul Gregoire 2 years ago
parent
commit
65174c068a
3 changed files with 9 additions and 6 deletions
  1. 1 1
      include/rtc/rtcpnackresponder.hpp
  2. 2 2
      src/rtcpreceivingsession.cpp
  3. 6 3
      src/track.cpp

+ 1 - 1
include/rtc/rtcpnackresponder.hpp

@@ -44,7 +44,7 @@ class RTC_CPP_EXPORT RtcpNackResponder final : public MediaHandlerElement {
 		/// Maximum storage size
 		const unsigned maximumSize;
 
-		/// Returnst current size
+		/// Returns current size
 		unsigned size();
 
 	public:

+ 2 - 2
src/rtcpreceivingsession.cpp

@@ -119,8 +119,8 @@ bool RtcpReceivingSession::send(message_ptr msg) {
 }
 
 bool RtcpReceivingSession::requestKeyframe() {
-	pushPLI();
-	return true; // TODO Make this false when it is impossible (i.e. Opus).
+	pushPLI(); 
+	return true;
 }
 
 void RtcpReceivingSession::pushPLI() {

+ 6 - 3
src/track.cpp

@@ -45,9 +45,12 @@ void Track::setMediaHandler(shared_ptr<MediaHandler> handler) {
 }
 
 bool Track::requestKeyframe() {
-	if (auto handler = impl()->getMediaHandler())
-		return handler->requestKeyframe();
-
+	// only push PLI for video
+	if (description().type() == "video") {
+		if (auto handler = impl()->getMediaHandler()) {
+			return handler->requestKeyframe();
+		}
+	}
 	return false;
 }