A method to be performed by a video encoder for encoding a current picture belonging to a temporal level identified by a temporal_id, the method comprises: - determining a Reference Picture Set, RPS, for the current picture indicating reference pictures that are kept in a decoded picture buffer, DPB, when decoding the current picture, and characterized by the step of: - ensuring that the RPS of the current picture includes no picture having a temporal_id greater than or equal to the temporal_id of the current picture when the current picture is a temporal layer switching point, wherein the current picture, being a temporal layer switching point, is a temporal sub-layer access, TSA, picture, wherein the TSA picture is defined such that the TSA picture and all coded pictures with temporal_id greater than or equal to the temporal_id of the TSA picture that follow the TSA picture in decoding order shall not include any picture in their reference picture set that precedes the TSA picture in decoding order and for which temporal_id is greater than or equal to the temporal_id of the TSA picture, and wherein the temporal layer switching point indicates that at this picture it is possible for a decoder to start decoding more temporal layers than what was decoded before the temporal layer switching point. - determining a Reference Picture Set, RPS, for the current picture indicating reference pictures that are kept in a decoded picture buffer, DPB, when decoding the current picture, and characterized by the step of: - ensuring that the RPS of the current picture includes no picture having a temporal_id greater than or equal to the temporal_id of the current picture when the current picture is a temporal layer switching point, wherein the current picture, being a temporal layer switching point, is a temporal sub-layer access, TSA, picture, wherein the TSA picture is defined such that the TSA picture and all coded pictures with temporal_id greater than or equal to the temporal_id of the TSA picture that follow the TSA picture in decoding order shall not include any picture in their reference picture set that precedes the TSA picture in decoding order and for which temporal_id is greater than or equal to the temporal_id of the TSA picture, and wherein the temporal layer switching point indicates that at this picture it is possible for a decoder to start decoding more temporal layers than what was decoded before the temporal layer switching point. - ensuring that the RPS of the current picture includes no picture having a temporal_id greater than or equal to the temporal_id of the current picture when the current picture is a temporal layer switching point, wherein the current picture, being a temporal layer switching point, is a temporal sub-layer access, TSA, picture, wherein the TSA picture is defined such that the TSA picture and all coded pictures with temporal_id greater than or equal to the temporal_id of the TSA picture that follow the TSA picture in decoding order shall not include any picture in their reference picture set that precedes the TSA picture in decoding order and for which temporal_id is greater than or equal to the temporal_id of the TSA picture, and wherein the temporal layer switching point indicates that at this picture it is possible for a decoder to start decoding more temporal layers than what was decoded before the temporal layer switching point.