Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: talk/app/webrtc/java/jni/androidmediaencoder_jni.cc

Issue 1406903002: Expose codec implementation names in stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove conflict marker Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; 102 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override;
103 103
104 // rtc::MessageHandler implementation. 104 // rtc::MessageHandler implementation.
105 void OnMessage(rtc::Message* msg) override; 105 void OnMessage(rtc::Message* msg) override;
106 106
107 void OnDroppedFrame() override; 107 void OnDroppedFrame() override;
108 108
109 int GetTargetFramerate() override; 109 int GetTargetFramerate() override;
110 110
111 bool SupportsNativeHandle() const override { return true; } 111 bool SupportsNativeHandle() const override { return true; }
112 const char* ImplementationName() const override;
113
114 private:
115 // CHECK-fail if not running on |codec_thread_|.
116 void CheckOnCodecThread();
112 117
113 private: 118 private:
114 // ResetCodecOnCodecThread() calls ReleaseOnCodecThread() and 119 // ResetCodecOnCodecThread() calls ReleaseOnCodecThread() and
115 // InitEncodeOnCodecThread() in an attempt to restore the codec to an 120 // InitEncodeOnCodecThread() in an attempt to restore the codec to an
116 // operable state. Necessary after all manner of OMX-layer errors. 121 // operable state. Necessary after all manner of OMX-layer errors.
117 bool ResetCodecOnCodecThread(); 122 bool ResetCodecOnCodecThread();
118 123
119 // Implementation of webrtc::VideoEncoder methods above, all running on the 124 // Implementation of webrtc::VideoEncoder methods above, all running on the
120 // codec thread exclusively. 125 // codec thread exclusively.
121 // 126 //
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1067
1063 void MediaCodecVideoEncoder::OnDroppedFrame() { 1068 void MediaCodecVideoEncoder::OnDroppedFrame() {
1064 if (scale_) 1069 if (scale_)
1065 quality_scaler_.ReportDroppedFrame(); 1070 quality_scaler_.ReportDroppedFrame();
1066 } 1071 }
1067 1072
1068 int MediaCodecVideoEncoder::GetTargetFramerate() { 1073 int MediaCodecVideoEncoder::GetTargetFramerate() {
1069 return scale_ ? quality_scaler_.GetTargetFramerate() : -1; 1074 return scale_ ? quality_scaler_.GetTargetFramerate() : -1;
1070 } 1075 }
1071 1076
1077 const char* MediaCodecVideoEncoder::ImplementationName() const {
1078 return "MediaCodec";
1079 }
1080
1072 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() 1081 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory()
1073 : egl_context_ (nullptr) { 1082 : egl_context_(nullptr) {
1074 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 1083 JNIEnv* jni = AttachCurrentThreadIfNeeded();
1075 ScopedLocalRefFrame local_ref_frame(jni); 1084 ScopedLocalRefFrame local_ref_frame(jni);
1076 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder"); 1085 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder");
1077 supported_codecs_.clear(); 1086 supported_codecs_.clear();
1078 1087
1079 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod( 1088 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod(
1080 j_encoder_class, 1089 j_encoder_class,
1081 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z")); 1090 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z"));
1082 CHECK_EXCEPTION(jni); 1091 CHECK_EXCEPTION(jni);
1083 if (is_vp8_hw_supported) { 1092 if (is_vp8_hw_supported) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 } 1170 }
1162 1171
1163 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1172 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1164 webrtc::VideoEncoder* encoder) { 1173 webrtc::VideoEncoder* encoder) {
1165 ALOGD << "Destroy video encoder."; 1174 ALOGD << "Destroy video encoder.";
1166 delete encoder; 1175 delete encoder;
1167 } 1176 }
1168 1177
1169 } // namespace webrtc_jni 1178 } // namespace webrtc_jni
1170 1179
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698