From a907c3fb26fe596ed6335b6aa7e27eae8325a8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Cervi=C3=B1o?= Date: Fri, 7 Jun 2019 12:39:16 +0200 Subject: [PATCH 1/2] Fix the way we detect layers in VP9 parser --- erizo/src/erizo/rtp/LayerDetectorHandler.cpp | 12 +++++++++--- erizo/src/erizo/rtp/RtpVP9Parser.cpp | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp index 24ecd01fe8..b474198abb 100644 --- a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp +++ b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp @@ -137,6 +137,10 @@ void LayerDetectorHandler::parseLayerInfoFromVP9(std::shared_ptr pac RTPPayloadVP9* payload = vp9_parser_.parseVP9( start_buffer, packet->length - rtp_header->getHeaderLength()); + if (payload->hasPictureID) { + packet->picture_id = payload->pictureID; + } + int spatial_layer = payload->spatialID; packet->compatible_spatial_layers = {}; @@ -163,9 +167,11 @@ void LayerDetectorHandler::parseLayerInfoFromVP9(std::shared_ptr pac bool resolution_changed = false; if (payload->resolutions.size() > 0) { for (uint position = 0; position < payload->resolutions.size(); position++) { - resolution_changed = true; - video_frame_width_list_[position] = payload->resolutions[position].width; - video_frame_height_list_[position] = payload->resolutions[position].height; + if (video_frame_width_list_[position] != payload->resolutions[position].width) { + resolution_changed = true; + video_frame_width_list_[position] = payload->resolutions[position].width; + video_frame_height_list_[position] = payload->resolutions[position].height; + } } } if (resolution_changed) { diff --git a/erizo/src/erizo/rtp/RtpVP9Parser.cpp b/erizo/src/erizo/rtp/RtpVP9Parser.cpp index 3570de17b5..0af9f5a5ef 100644 --- a/erizo/src/erizo/rtp/RtpVP9Parser.cpp +++ b/erizo/src/erizo/rtp/RtpVP9Parser.cpp @@ -97,6 +97,8 @@ RTPPayloadVP9* RtpVP9Parser::parseVP9(unsigned char* data, int dataLength) { dataPtr++; len--; } + vp9->temporalID = 0; + vp9->spatialID = 0; if (vp9->hasLayerIndices) { vp9->temporalID = (*dataPtr & 0xE0) >> 5; // T bits From 7c453f22d9c8147118e579df121ebf725bec598d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Cervi=C3=B1o?= Date: Fri, 7 Jun 2019 12:54:54 +0200 Subject: [PATCH 2/2] Remove bad comparison --- erizo/src/erizo/rtp/LayerDetectorHandler.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp index b474198abb..537ebe0af5 100644 --- a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp +++ b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp @@ -167,11 +167,9 @@ void LayerDetectorHandler::parseLayerInfoFromVP9(std::shared_ptr pac bool resolution_changed = false; if (payload->resolutions.size() > 0) { for (uint position = 0; position < payload->resolutions.size(); position++) { - if (video_frame_width_list_[position] != payload->resolutions[position].width) { - resolution_changed = true; - video_frame_width_list_[position] = payload->resolutions[position].width; - video_frame_height_list_[position] = payload->resolutions[position].height; - } + resolution_changed = true; + video_frame_width_list_[position] = payload->resolutions[position].width; + video_frame_height_list_[position] = payload->resolutions[position].height; } } if (resolution_changed) {