Răsfoiți Sursa

change remotectrl.proto for change frame rate.

yuchuli 2 luni în urmă
părinte
comite
8b4878f29f
2 a modificat fișierele cu 12 adăugiri și 3 ștergeri
  1. 6 3
      src/driver/driver_h264_enc/main.cpp
  2. 6 0
      src/include/proto/remotectrl.proto

+ 6 - 3
src/driver/driver_h264_enc/main.cpp

@@ -127,7 +127,7 @@ void ThreadEnc()
     char * strbufnv12 = new char[30000000];
     int ret;
 
-RESTART:
+
 #ifndef USE_QSV
     av_register_all();
 
@@ -144,7 +144,7 @@ RESTART:
 #endif
 
 
-
+RESTART:
 
 //      AVCodecContext *decoder_ctx = NULL;
 //        AVBufferRef *device_ref = NULL;
@@ -272,8 +272,11 @@ RESTART:
             static int ntest = 0;  //test  change framerate.
  //           ntest++;
             int64_t new_bitrate = 4000000;
-            if(ntest == 300)
+            if(ntest > 300)
             {
+                av_frame_free(&frame);
+                avcodec_free_context(&c);
+                av_packet_free(&pkt);
                 // 关闭原编码器
                 avcodec_close(c);
                 gnframerate = new_bitrate;

+ 6 - 0
src/include/proto/remotectrl.proto

@@ -20,4 +20,10 @@ enum CtrlType //枚举消息类型
  optional double brake = 3;
  optional double wheel = 4;
  optional int32 shift = 5; //Shift >0 Drive 0 Null <0  Rear
+ optional int32 frame_percent = 6; //default 100 100%
+ optional bool frame_percent_Separate = 7;  //分别控制, 默认false
+ optional int32 frame_percent_front = 8; 
+ optional int32 frame_percent_rear = 9; 
+ optional int32 frame_percent_left = 10; 
+ optional int32 frame_percent_right = 11; 
 };