winlin

disable gop cache when not h.264. fix some warning.

@@ -95,7 +95,7 @@ int main(int argc, char** argv) @@ -95,7 +95,7 @@ int main(int argc, char** argv)
95 // open file 95 // open file
96 int raw_fd = open(raw_file, O_RDONLY); 96 int raw_fd = open(raw_file, O_RDONLY);
97 if (raw_fd < 0) { 97 if (raw_fd < 0) {
98 - srs_human_trace("open audio raw file %s failed.", raw_fd); 98 + srs_human_trace("open audio raw file %s failed.", raw_file);
99 goto rtmp_destroy; 99 goto rtmp_destroy;
100 } 100 }
101 101
@@ -47,7 +47,7 @@ int read_audio_frame(char* audio_raw, int file_size, char** pp, char** pdata, in @@ -47,7 +47,7 @@ int read_audio_frame(char* audio_raw, int file_size, char** pp, char** pdata, in
47 47
48 if (file_size - (p - audio_raw) < 168) { 48 if (file_size - (p - audio_raw) < 168) {
49 srs_human_trace("audio must be 160+8 bytes. left %d bytes.", 49 srs_human_trace("audio must be 160+8 bytes. left %d bytes.",
50 - file_size - (p - audio_raw)); 50 + (int)(file_size - (p - audio_raw)));
51 return - 1; 51 return - 1;
52 } 52 }
53 53
@@ -88,7 +88,7 @@ int main(int argc, char** argv) @@ -88,7 +88,7 @@ int main(int argc, char** argv)
88 // open file 88 // open file
89 int raw_fd = open(raw_file, O_RDONLY); 89 int raw_fd = open(raw_file, O_RDONLY);
90 if (raw_fd < 0) { 90 if (raw_fd < 0) {
91 - srs_human_trace("open audio raw file %s failed.", raw_fd); 91 + srs_human_trace("open audio raw file %s failed.", raw_file);
92 goto rtmp_destroy; 92 goto rtmp_destroy;
93 } 93 }
94 94
@@ -132,6 +132,7 @@ rtmp_destroy: @@ -132,6 +132,7 @@ rtmp_destroy:
132 "\"srs_id\":%d, " 132 "\"srs_id\":%d, "
133 "\"duration\":%d, " 133 "\"duration\":%d, "
134 "\"play_duration\":%d, " 134 "\"play_duration\":%d, "
  135 + "\"publish_duration\":%d,"
135 "\"play_kbps\":%d, " 136 "\"play_kbps\":%d, "
136 "\"publish_kbps\":%d" 137 "\"publish_kbps\":%d"
137 "}", 138 "}",
@@ -141,7 +142,7 @@ rtmp_destroy: @@ -141,7 +142,7 @@ rtmp_destroy:
141 (int)(end_time - start_time), play_duration, publish_duration, 142 (int)(end_time - start_time), play_duration, publish_duration,
142 play_kbps, publish_kbps); 143 play_kbps, publish_kbps);
143 144
144 - srs_human_trace(""); 145 + srs_human_trace(" ");
145 srs_human_trace("completed"); 146 srs_human_trace("completed");
146 147
147 return ret; 148 return ret;
@@ -197,7 +197,7 @@ rtmp_destroy: @@ -197,7 +197,7 @@ rtmp_destroy:
197 "\"remark2\": \"if code is not 0, user must ignore all data\"" 197 "\"remark2\": \"if code is not 0, user must ignore all data\""
198 ); 198 );
199 199
200 - srs_human_trace(""); 200 + srs_human_trace(" ");
201 srs_human_trace("completed"); 201 srs_human_trace("completed");
202 202
203 return ret; 203 return ret;
@@ -100,7 +100,7 @@ int main(int argc, char** argv) @@ -100,7 +100,7 @@ int main(int argc, char** argv)
100 // open file 100 // open file
101 int raw_fd = open(raw_file, O_RDONLY); 101 int raw_fd = open(raw_file, O_RDONLY);
102 if (raw_fd < 0) { 102 if (raw_fd < 0) {
103 - srs_human_trace("open h264 raw file %s failed.", raw_fd); 103 + srs_human_trace("open h264 raw file %s failed.", raw_file);
104 goto rtmp_destroy; 104 goto rtmp_destroy;
105 } 105 }
106 106
@@ -392,6 +392,12 @@ int SrsGopCache::cache(SrsSharedPtrMessage* msg) @@ -392,6 +392,12 @@ int SrsGopCache::cache(SrsSharedPtrMessage* msg)
392 srs_verbose("gop cache is disabled."); 392 srs_verbose("gop cache is disabled.");
393 return ret; 393 return ret;
394 } 394 }
  395 +
  396 + // disable gop cache when not h.264
  397 + if (!SrsFlvCodec::video_is_h264(msg->payload, msg->size)) {
  398 + srs_info("gop donot cache video for none h.264");
  399 + return ret;
  400 + }
395 401
396 // got video, update the video count if acceptable 402 // got video, update the video count if acceptable
397 if (msg->header.is_video()) { 403 if (msg->header.is_video()) {
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject> 2 <!DOCTYPE QtCreatorProject>
3 -<!-- Written by QtCreator 3.1.1, 2014-11-30T15:48:20. --> 3 +<!-- Written by QtCreator 3.1.1, 2014-12-01T21:33:00. -->
4 <qtcreator> 4 <qtcreator>
5 <data> 5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable> 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>