comparison vamp-server/simple-server.cpp @ 186:52322dde68ea

Fix erroneous logic for handling step and block size in prior commit The earlier change had a logical misconception. If PluginStub is receiving the correct step and block size back from the configure call, the plugin on the server side must have already been successfully initialised, as the step and block size are only returned in a successful configure response. This means the test for a failed initialise and redo with the correct parameters must be done on the server side (in LoaderRequests) not the client. The client has a more complicated job, which is to notice that a *successful* configure had returned different framing parameters from those passed to the initialise call, and to pretend that it had actually failed until the host called again with the correct parameters. We definitely need tests for this!
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 06 Feb 2017 16:44:33 +0000
parents 3eb00e5c76c4
children e0e3d9efa774
comparison
equal deleted inserted replaced
185:3eb00e5c76c4 186:52322dde68ea
493 493
494 if (!response.configurationResponse.outputs.empty()) { 494 if (!response.configurationResponse.outputs.empty()) {
495 mapper.markConfigured 495 mapper.markConfigured
496 (h, 496 (h,
497 creq.configuration.channelCount, 497 creq.configuration.channelCount,
498 creq.configuration.framing.blockSize); 498 response.configurationResponse.framing.blockSize);
499 response.success = true; 499 response.success = true;
500 } 500 }
501 break; 501 break;
502 } 502 }
503 503
519 } 519 }
520 520
521 const float **fbuffers = new const float *[channels]; 521 const float **fbuffers = new const float *[channels];
522 for (int i = 0; i < channels; ++i) { 522 for (int i = 0; i < channels; ++i) {
523 if (int(preq.inputBuffers[i].size()) != mapper.getBlockSize(h)) { 523 if (int(preq.inputBuffers[i].size()) != mapper.getBlockSize(h)) {
524 ostringstream os;
525 os << "wrong block size supplied to process ("
526 << preq.inputBuffers[i].size()
527 << ", expecting " << mapper.getBlockSize(h) << ")" << ends;
524 delete[] fbuffers; 528 delete[] fbuffers;
525 throw runtime_error("wrong block size supplied to process"); 529 throw runtime_error(os.str());
526 } 530 }
527 fbuffers[i] = preq.inputBuffers[i].data(); 531 fbuffers[i] = preq.inputBuffers[i].data();
528 } 532 }
529 533
530 response.processResponse.plugin = preq.plugin; 534 response.processResponse.plugin = preq.plugin;