- shared_ptr<Frame> frame;
- if (id.interpolated) {
- // Interpolated frames are never decoded by us,
- // put directly into the cache from VideoStream.
- unique_lock<mutex> lock(cache_mu);
- auto it = cache.find(id);
- if (it != cache.end()) {
- it->second.last_used = event_counter++;
- frame = it->second.frame;
- } else {
- // This can only really happen if it disappeared out of the
- // LRU really, really fast. Which shouldn't happen.
- fprintf(stderr, "WARNING: Interpolated JPEG was supposed to be in the cache, but was not\n");
- }
- found_in_cache = true; // Don't count it as a decode.
- } else {
- frame = decode_jpeg_with_cache(id, cache_miss_behavior, &found_in_cache);
- }
+ shared_ptr<Frame> frame = decode_jpeg_with_cache(frame_spec, cache_miss_behavior, &found_in_cache);