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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + compile Created 5 years, 2 months 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 2013 Google Inc. 3 * Copyright 2013 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 jni, *j_observer_class_, "onBufferedAmountChange", "(J)V")), 595 jni, *j_observer_class_, "onBufferedAmountChange", "(J)V")),
596 j_on_state_change_mid_( 596 j_on_state_change_mid_(
597 GetMethodID(jni, *j_observer_class_, "onStateChange", "()V")), 597 GetMethodID(jni, *j_observer_class_, "onStateChange", "()V")),
598 j_on_message_mid_(GetMethodID(jni, *j_observer_class_, "onMessage", 598 j_on_message_mid_(GetMethodID(jni, *j_observer_class_, "onMessage",
599 "(Lorg/webrtc/DataChannel$Buffer;)V")), 599 "(Lorg/webrtc/DataChannel$Buffer;)V")),
600 j_buffer_ctor_(GetMethodID(jni, *j_buffer_class_, "<init>", 600 j_buffer_ctor_(GetMethodID(jni, *j_buffer_class_, "<init>",
601 "(Ljava/nio/ByteBuffer;Z)V")) {} 601 "(Ljava/nio/ByteBuffer;Z)V")) {}
602 602
603 virtual ~DataChannelObserverWrapper() {} 603 virtual ~DataChannelObserverWrapper() {}
604 604
605 void OnBufferedAmountChange(uint64 previous_amount) override { 605 void OnBufferedAmountChange(uint64_t previous_amount) override {
606 ScopedLocalRefFrame local_ref_frame(jni()); 606 ScopedLocalRefFrame local_ref_frame(jni());
607 jni()->CallVoidMethod(*j_observer_global_, j_on_buffered_amount_change_mid_, 607 jni()->CallVoidMethod(*j_observer_global_, j_on_buffered_amount_change_mid_,
608 previous_amount); 608 previous_amount);
609 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; 609 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
610 } 610 }
611 611
612 void OnStateChange() override { 612 void OnStateChange() override {
613 ScopedLocalRefFrame local_ref_frame(jni()); 613 ScopedLocalRefFrame local_ref_frame(jni());
614 jni()->CallVoidMethod(*j_observer_global_, j_on_state_change_mid_); 614 jni()->CallVoidMethod(*j_observer_global_, j_on_state_change_mid_);
615 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; 615 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 // Return a VideoRenderer.I420Frame referring to the data in |frame|. 796 // Return a VideoRenderer.I420Frame referring to the data in |frame|.
797 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { 797 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) {
798 jintArray strides = jni()->NewIntArray(3); 798 jintArray strides = jni()->NewIntArray(3);
799 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); 799 jint* strides_array = jni()->GetIntArrayElements(strides, NULL);
800 strides_array[0] = frame->GetYPitch(); 800 strides_array[0] = frame->GetYPitch();
801 strides_array[1] = frame->GetUPitch(); 801 strides_array[1] = frame->GetUPitch();
802 strides_array[2] = frame->GetVPitch(); 802 strides_array[2] = frame->GetVPitch();
803 jni()->ReleaseIntArrayElements(strides, strides_array, 0); 803 jni()->ReleaseIntArrayElements(strides, strides_array, 0);
804 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL); 804 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL);
805 jobject y_buffer = jni()->NewDirectByteBuffer( 805 jobject y_buffer =
806 const_cast<uint8*>(frame->GetYPlane()), 806 jni()->NewDirectByteBuffer(const_cast<uint8_t*>(frame->GetYPlane()),
807 frame->GetYPitch() * frame->GetHeight()); 807 frame->GetYPitch() * frame->GetHeight());
808 jobject u_buffer = jni()->NewDirectByteBuffer( 808 jobject u_buffer = jni()->NewDirectByteBuffer(
809 const_cast<uint8*>(frame->GetUPlane()), frame->GetChromaSize()); 809 const_cast<uint8_t*>(frame->GetUPlane()), frame->GetChromaSize());
810 jobject v_buffer = jni()->NewDirectByteBuffer( 810 jobject v_buffer = jni()->NewDirectByteBuffer(
811 const_cast<uint8*>(frame->GetVPlane()), frame->GetChromaSize()); 811 const_cast<uint8_t*>(frame->GetVPlane()), frame->GetChromaSize());
812 jni()->SetObjectArrayElement(planes, 0, y_buffer); 812 jni()->SetObjectArrayElement(planes, 0, y_buffer);
813 jni()->SetObjectArrayElement(planes, 1, u_buffer); 813 jni()->SetObjectArrayElement(planes, 1, u_buffer);
814 jni()->SetObjectArrayElement(planes, 2, v_buffer); 814 jni()->SetObjectArrayElement(planes, 2, v_buffer);
815 return jni()->NewObject( 815 return jni()->NewObject(
816 *j_frame_class_, j_i420_frame_ctor_id_, 816 *j_frame_class_, j_i420_frame_ctor_id_,
817 frame->GetWidth(), frame->GetHeight(), 817 frame->GetWidth(), frame->GetHeight(),
818 static_cast<int>(frame->GetVideoRotation()), 818 static_cast<int>(frame->GetVideoRotation()),
819 strides, planes, javaShallowCopy(frame)); 819 strides, planes, javaShallowCopy(frame));
820 } 820 }
821 821
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 JOW(jstring, DataChannel_label)(JNIEnv* jni, jobject j_dc) { 869 JOW(jstring, DataChannel_label)(JNIEnv* jni, jobject j_dc) {
870 return JavaStringFromStdString(jni, ExtractNativeDC(jni, j_dc)->label()); 870 return JavaStringFromStdString(jni, ExtractNativeDC(jni, j_dc)->label());
871 } 871 }
872 872
873 JOW(jobject, DataChannel_state)(JNIEnv* jni, jobject j_dc) { 873 JOW(jobject, DataChannel_state)(JNIEnv* jni, jobject j_dc) {
874 return JavaEnumFromIndex( 874 return JavaEnumFromIndex(
875 jni, "DataChannel$State", ExtractNativeDC(jni, j_dc)->state()); 875 jni, "DataChannel$State", ExtractNativeDC(jni, j_dc)->state());
876 } 876 }
877 877
878 JOW(jlong, DataChannel_bufferedAmount)(JNIEnv* jni, jobject j_dc) { 878 JOW(jlong, DataChannel_bufferedAmount)(JNIEnv* jni, jobject j_dc) {
879 uint64 buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount(); 879 uint64_t buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount();
880 RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64>::max()) 880 RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64_t>::max())
881 << "buffered_amount overflowed jlong!"; 881 << "buffered_amount overflowed jlong!";
882 return static_cast<jlong>(buffered_amount); 882 return static_cast<jlong>(buffered_amount);
883 } 883 }
884 884
885 JOW(void, DataChannel_close)(JNIEnv* jni, jobject j_dc) { 885 JOW(void, DataChannel_close)(JNIEnv* jni, jobject j_dc) {
886 ExtractNativeDC(jni, j_dc)->Close(); 886 ExtractNativeDC(jni, j_dc)->Close();
887 } 887 }
888 888
889 JOW(jboolean, DataChannel_sendNative)(JNIEnv* jni, jobject j_dc, 889 JOW(jboolean, DataChannel_sendNative)(JNIEnv* jni, jobject j_dc,
890 jbyteArray data, jboolean binary) { 890 jbyteArray data, jboolean binary) {
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); 1861 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size)));
1862 stream->ReadAll(buffer.get(), log_size, &read, nullptr); 1862 stream->ReadAll(buffer.get(), log_size, &read, nullptr);
1863 1863
1864 jbyteArray result = jni->NewByteArray(read); 1864 jbyteArray result = jni->NewByteArray(read);
1865 jni->SetByteArrayRegion(result, 0, read, buffer.get()); 1865 jni->SetByteArrayRegion(result, 0, read, buffer.get());
1866 1866
1867 return result; 1867 return result;
1868 } 1868 }
1869 1869
1870 } // namespace webrtc_jni 1870 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698