diff --git a/sdk/android/src/jni/androidmediadecoder_jni.cc b/sdk/android/src/jni/androidmediadecoder_jni.cc index 613bb54cd0..fb8b0993d9 100644 --- a/sdk/android/src/jni/androidmediadecoder_jni.cc +++ b/sdk/android/src/jni/androidmediadecoder_jni.cc @@ -651,14 +651,14 @@ int32_t MediaCodecVideoDecoder::DecodeOnCodecThread( if (codecType_ == kVideoCodecVP8) { int qp_int; if (vp8::GetQp(inputImage._buffer, inputImage._length, &qp_int)) { - qp = rtc::Optional(qp_int); + qp = qp_int; } } else if (codecType_ == kVideoCodecH264) { h264_bitstream_parser_.ParseBitstream(inputImage._buffer, inputImage._length); int qp_int; if (h264_bitstream_parser_.GetLastSliceQp(&qp_int)) { - qp = rtc::Optional(qp_int); + qp = qp_int; } } pending_frame_qps_.push_back(qp); @@ -898,8 +898,7 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs( rtc::Optional qp = pending_frame_qps_.front(); pending_frame_qps_.pop_front(); - callback_->Decoded(decoded_frame, rtc::Optional(decode_time_ms), - qp); + callback_->Decoded(decoded_frame, decode_time_ms, qp); } return true; } diff --git a/sdk/android/src/jni/videodecoderwrapper.cc b/sdk/android/src/jni/videodecoderwrapper.cc index afa1f2eed1..164cb6693a 100644 --- a/sdk/android/src/jni/videodecoderwrapper.cc +++ b/sdk/android/src/jni/videodecoderwrapper.cc @@ -133,7 +133,7 @@ int32_t VideoDecoderWrapper::Decode( input_image.capture_time_ms_ * rtc::kNumNanosecsPerMillisec; frame_extra_info.timestamp_rtp = input_image._timeStamp; frame_extra_info.qp = - qp_parsing_enabled_ ? ParseQP(input_image) : rtc::Optional(); + qp_parsing_enabled_ ? ParseQP(input_image) : rtc::nullopt; frame_extra_infos_.push_back(frame_extra_info); jobject jinput_image = @@ -191,13 +191,12 @@ void VideoDecoderWrapper::OnDecodedFrame(JNIEnv* jni, rtc::Optional decoding_time_ms; if (jdecode_time_ms != nullptr) { - decoding_time_ms = rtc::Optional( - jni->CallIntMethod(jdecode_time_ms, int_value_method_)); + decoding_time_ms = jni->CallIntMethod(jdecode_time_ms, int_value_method_); } rtc::Optional qp; if (jqp != nullptr) { - qp = rtc::Optional(jni->CallIntMethod(jqp, int_value_method_)); + qp = jni->CallIntMethod(jqp, int_value_method_); // The decoder provides QP values itself, no need to parse the bitstream. qp_parsing_enabled_ = false; } else { @@ -261,7 +260,7 @@ int32_t VideoDecoderWrapper::HandleReturnCode(JNIEnv* jni, jobject code) { rtc::Optional VideoDecoderWrapper::ParseQP( const EncodedImage& input_image) { if (input_image.qp_ != -1) { - return rtc::Optional(input_image.qp_); + return input_image.qp_; } rtc::Optional qp; @@ -269,14 +268,14 @@ rtc::Optional VideoDecoderWrapper::ParseQP( case kVideoCodecVP8: { int qp_int; if (vp8::GetQp(input_image._buffer, input_image._length, &qp_int)) { - qp = rtc::Optional(qp_int); + qp = qp_int; } break; } case kVideoCodecVP9: { int qp_int; if (vp9::GetQp(input_image._buffer, input_image._length, &qp_int)) { - qp = rtc::Optional(qp_int); + qp = qp_int; } break; } @@ -285,7 +284,7 @@ rtc::Optional VideoDecoderWrapper::ParseQP( input_image._length); int qp_int; if (h264_bitstream_parser_.GetLastSliceQp(&qp_int)) { - qp = rtc::Optional(qp_int); + qp = qp_int; } break; }