MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / modify_current_stream

Function modify_current_stream

ffserver.c:1152–1188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1150}
1151
1152static int modify_current_stream(HTTPContext *c, char *rates)
1153{
1154 int i;
1155 FFStream *req = c->stream;
1156 int action_required = 0;
1157
1158 /* Not much we can do for a feed */
1159 if (!req->feed)
1160 return 0;
1161
1162 for (i = 0; i < req->nb_streams; i++) {
1163 AVCodecContext *codec = req->streams[i]->codec;
1164
1165 switch(rates[i]) {
1166 case 0:
1167 c->switch_feed_streams[i] = req->feed_streams[i];
1168 break;
1169 case 1:
1170 c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);
1171 break;
1172 case 2:
1173 /* Wants off or slow */
1174 c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);
1175#ifdef WANTS_OFF
1176 /* This doesn't work well when it turns off the only stream! */
1177 c->switch_feed_streams[i] = -2;
1178 c->feed_streams[i] = -2;
1179#endif
1180 break;
1181 }
1182
1183 if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i])
1184 action_required = 1;
1185 }
1186
1187 return action_required;
1188}
1189
1190
1191static void do_switch_stream(HTTPContext *c, int i)

Callers 1

http_parse_requestFunction · 0.85

Calls 1

find_stream_in_feedFunction · 0.85

Tested by

no test coverage detected