diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index 4286ef71fe..e8b2a6c974 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -22,18 +22,6 @@ group("android") { } } -config("libjingle_peerconnection_jni_warnings_config") { - # The warnings below are enabled by default. Since GN orders compiler flags - # for a target before flags from configs, the only way to disable such - # warnings is by having them in a separate config, loaded from the target. - if (!is_win) { - cflags = [ - "-Wno-sign-compare", - "-Wno-unused-variable", - ] - } -} - generate_jni("generated_base_jni") { sources = [ "api/org/webrtc/NetworkMonitor.java", @@ -347,8 +335,6 @@ rtc_static_library("video_jni") { "src/jni/yuvhelper.cc", ] - configs += [ ":libjingle_peerconnection_jni_warnings_config" ] - # TODO(jschuh): Bug 1348: fix this warning. configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] @@ -569,8 +555,6 @@ rtc_static_library("peerconnection_jni") { "src/jni/pc/turncustomizer.h", ] - configs += [ ":libjingle_peerconnection_jni_warnings_config" ] - if (is_clang) { # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). suppressed_configs += [ @@ -645,8 +629,6 @@ rtc_static_library("libjingle_peerconnection_metrics_default_jni") { "src/jni/androidmetrics.cc", ] - configs += [ ":libjingle_peerconnection_jni_warnings_config" ] - deps = [ ":base_jni", ":generated_metrics_jni", diff --git a/sdk/android/src/jni/androidmediadecoder.cc b/sdk/android/src/jni/androidmediadecoder.cc index 3654db9e77..dac45fa37b 100644 --- a/sdk/android/src/jni/androidmediadecoder.cc +++ b/sdk/android/src/jni/androidmediadecoder.cc @@ -24,6 +24,7 @@ #include "rtc_base/bind.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" +#include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/scoped_ref_ptr.h" #include "rtc_base/thread.h" #include "rtc_base/timeutils.h" @@ -120,7 +121,7 @@ class MediaCodecVideoDecoder : public VideoDecoder, public rtc::MessageHandler { int current_bytes_; // Encoded bytes in the current statistics interval. int current_decoding_time_ms_; // Overall decoding time in the current second int current_delay_time_ms_; // Overall delay time in the current second. - uint32_t max_pending_frames_; // Maximum number of pending input frames. + int32_t max_pending_frames_; // Maximum number of pending input frames. H264BitstreamParser h264_bitstream_parser_; std::deque> pending_frame_qps_; @@ -482,7 +483,8 @@ int32_t MediaCodecVideoDecoder::DecodeOnCodecThread( uint8_t* buffer = reinterpret_cast(jni->GetDirectBufferAddress(j_input_buffer)); RTC_CHECK(buffer) << "Indirect buffer??"; - int64_t buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer); + size_t buffer_capacity = rtc::dchecked_cast( + jni->GetDirectBufferCapacity(j_input_buffer)); if (CheckException(jni) || buffer_capacity < inputImage._length) { ALOGE << "Input frame size "<< inputImage._length << " is bigger than buffer size " << buffer_capacity; diff --git a/sdk/android/src/jni/androidmediaencoder.cc b/sdk/android/src/jni/androidmediaencoder.cc index 9468a01af3..5492c32674 100644 --- a/sdk/android/src/jni/androidmediaencoder.cc +++ b/sdk/android/src/jni/androidmediaencoder.cc @@ -79,7 +79,7 @@ __android_log_print(ANDROID_LOG_VERBOSE, TAG_ENCODER, __VA_ARGS__) namespace { // Maximum time limit between incoming frames before requesting a key frame. - const size_t kFrameDiffThresholdMs = 350; + const int64_t kFrameDiffThresholdMs = 350; const int kMinKeyFrameInterval = 6; const char kCustomQPThresholdsFieldTrial[] = "WebRTC-CustomQPThresholds"; } // namespace @@ -213,8 +213,8 @@ class MediaCodecVideoEncoder : public VideoEncoder { bool inited_; bool use_surface_; enum libyuv::FourCC encoder_fourcc_; // Encoder color space format. - int last_set_bitrate_kbps_; // Last-requested bitrate in kbps. - int last_set_fps_; // Last-requested frame rate. + uint32_t last_set_bitrate_kbps_; // Last-requested bitrate in kbps. + uint32_t last_set_fps_; // Last-requested frame rate. int64_t current_timestamp_us_; // Current frame timestamps in us. int frames_received_; // Number of frames received by encoder. int frames_encoded_; // Number of frames encoded by encoder. @@ -923,7 +923,9 @@ int32_t MediaCodecVideoEncoder::SetRateAllocation( last_set_fps_ = frame_rate; } bool ret = Java_MediaCodecVideoEncoder_setRates( - jni, j_media_codec_video_encoder_, last_set_bitrate_kbps_, last_set_fps_); + jni, j_media_codec_video_encoder_, + rtc::dchecked_cast(last_set_bitrate_kbps_), + rtc::dchecked_cast(last_set_fps_)); if (CheckException(jni) || !ret) { ProcessHWError(true /* reset_if_fallback_unavailable */); return sw_fallback_required_ ? WEBRTC_VIDEO_CODEC_OK diff --git a/sdk/android/src/jni/videodecoderwrapper.cc b/sdk/android/src/jni/videodecoderwrapper.cc index 65795ce593..a7aee0423f 100644 --- a/sdk/android/src/jni/videodecoderwrapper.cc +++ b/sdk/android/src/jni/videodecoderwrapper.cc @@ -159,7 +159,7 @@ void VideoDecoderWrapper::OnDecodedFrame( const JavaRef& j_decode_time_ms, const JavaRef& j_qp) { RTC_DCHECK_RUNS_SERIALIZED(&callback_race_checker_); - const uint64_t timestamp_ns = GetJavaVideoFrameTimestampNs(env, j_frame); + const int64_t timestamp_ns = GetJavaVideoFrameTimestampNs(env, j_frame); FrameExtraInfo frame_extra_info; { diff --git a/sdk/android/src/jni/videoencoderwrapper.h b/sdk/android/src/jni/videoencoderwrapper.h index c58a0afbca..71f3d7b5da 100644 --- a/sdk/android/src/jni/videoencoderwrapper.h +++ b/sdk/android/src/jni/videoencoderwrapper.h @@ -70,7 +70,7 @@ class VideoEncoderWrapper : public VideoEncoder { private: struct FrameExtraInfo { - uint64_t capture_time_ns; // Used as an identifier of the frame. + int64_t capture_time_ns; // Used as an identifier of the frame. uint32_t timestamp_rtp; }; diff --git a/sdk/android/src/jni/videoframe.cc b/sdk/android/src/jni/videoframe.cc index d85df4a1fb..b29e5cc4cb 100644 --- a/sdk/android/src/jni/videoframe.cc +++ b/sdk/android/src/jni/videoframe.cc @@ -200,9 +200,6 @@ void Matrix::Crop(float xFraction, Multiply(crop_matrix, old.elem_, this->elem_); } -// Aligning pointer to 64 bytes for improved performance, e.g. use SIMD. -static const int kBufferAlignment = 64; - NativeHandleImpl::NativeHandleImpl(int id, const Matrix& matrix) : oes_texture_id(id), sampling_matrix(matrix) {}