- MutexLock lock(&queued_data_mutex);
- assert(suitable_for_stream_start == SUITABLE_FOR_STREAM_START ||
- suitable_for_stream_start == NOT_SUITABLE_FOR_STREAM_START);
+ // For regular output, we don't want to send the client twice
+ // (it's already sent out together with the HTTP header).
+ // However, for Metacube output, we need to send it so that
+ // the Cubemap instance in the other end has a chance to update it.
+ // It may come twice in its stream, but Cubemap doesn't care.
+ if (encoding == Stream::STREAM_ENCODING_RAW &&
+ (metacube_flags & METACUBE_FLAGS_HEADER) != 0) {
+ return;
+ }
+
+ lock_guard<mutex> lock(queued_data_mutex);