winlin

support aac_adtstoasc filter to copy mode.

@@ -330,7 +330,8 @@ int SrsFFMPEG::start() @@ -330,7 +330,8 @@ int SrsFFMPEG::start()
330 } 330 }
331 331
332 // the codec params is disabled when copy 332 // the codec params is disabled when copy
333 - if (acodec != SRS_RTMP_ENCODER_COPY && acodec != SRS_RTMP_ENCODER_NO_AUDIO) { 333 + if (acodec != SRS_RTMP_ENCODER_NO_AUDIO) {
  334 + if (acodec != SRS_RTMP_ENCODER_COPY) {
334 params.push_back("-b:a"); 335 params.push_back("-b:a");
335 snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000); 336 snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000);
336 params.push_back(tmp); 337 params.push_back(tmp);
@@ -344,7 +345,6 @@ int SrsFFMPEG::start() @@ -344,7 +345,6 @@ int SrsFFMPEG::start()
344 params.push_back(tmp); 345 params.push_back(tmp);
345 346
346 // aparams 347 // aparams
347 - if (!aparams.empty()) {  
348 std::vector<std::string>::iterator it; 348 std::vector<std::string>::iterator it;
349 for (it = aparams.begin(); it != aparams.end(); ++it) { 349 for (it = aparams.begin(); it != aparams.end(); ++it) {
350 std::string p = *it; 350 std::string p = *it;
@@ -352,6 +352,20 @@ int SrsFFMPEG::start() @@ -352,6 +352,20 @@ int SrsFFMPEG::start()
352 params.push_back(p); 352 params.push_back(p);
353 } 353 }
354 } 354 }
  355 + } else {
  356 + // for audio copy.
  357 + for (int i = 0; i < (int)aparams.size();) {
  358 + std::string pn = aparams[i++];
  359 +
  360 + // aparams, the adts to asc filter "-bsf:a aac_adtstoasc"
  361 + if (pn == "-bsf:a" && i < (int)aparams.size()) {
  362 + std::string pv = aparams[i++];
  363 + if (pv == "aac_adtstoasc") {
  364 + params.push_back(pn);
  365 + params.push_back(pv);
  366 + }
  367 + }
  368 + }
355 } 369 }
356 } 370 }
357 371