in src/main/java/com/amazonaws/kinesisvideo/internal/service/BlockingAckConsumer.java [42:77]
public void accept(final @Nonnull InputStream inputStream) {
checkNotNull(inputStream);
// Await for the header
try {
final ResponseStatus responseStatus = ChunkDecoder.readStatusLine(inputStream);
final int responseCode = responseStatus.getStatusCode();
switch (responseCode) {
case HTTP_OK:
log.info(String.format("PutMedia call for stream %s return OK with request id %s",
kinesisVideoProducerStream.getStreamName(), ChunkDecoder.decodeHeaders(inputStream)));
break;
case HTTP_BAD_REQUEST:
throw new AmazonServiceException("PutMedia call returned bad request: "
+ responseStatus.getReason());
case HTTP_NOT_FOUND:
throw new ResourceNotFoundException("Resource not found: " + responseStatus.getReason());
case HTTP_ACCESS_DENIED:
throw new AccessDeniedException("Access is denied: " + responseStatus.getReason());
default:
throw new AmazonServiceException("PutMedia call returned status code " + responseCode +
" with reason: " + responseStatus.getReason());
}
} catch (final Exception e) {
// Store the exception
storedException = e;
}
finally {
responseLatch.countDown();
}
// Forward to the origin if no exceptions have been thrown
if (storedException == null) {
inputStreamConsumer.accept(inputStream);
}
}