diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc index 7c4164c8ce..1b59be3536 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc @@ -262,6 +262,10 @@ int SimulcastEncoderAdapter::Encode( int src_width = input_image.width(); int src_height = input_image.height(); for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { + // Don't encode frames in resolutions that we don't intend to send. + if (!streaminfos_[stream_idx].send_stream) + continue; + std::vector stream_frame_types; if (send_key_frame) { stream_frame_types.push_back(kKeyFrame); @@ -390,23 +394,8 @@ int32_t SimulcastEncoderAdapter::Encoded( CodecSpecificInfoVP8* vp8Info = &(stream_codec_specific.codecSpecific.VP8); vp8Info->simulcastIdx = stream_idx; - if (streaminfos_[stream_idx].send_stream) { - return encoded_complete_callback_->Encoded(encodedImage, - &stream_codec_specific, - fragmentation); - } else { - EncodedImage dummy_image; - // Required in case padding is applied to dropped frames. - dummy_image._timeStamp = encodedImage._timeStamp; - dummy_image.capture_time_ms_ = encodedImage.capture_time_ms_; - dummy_image._encodedWidth = encodedImage._encodedWidth; - dummy_image._encodedHeight = encodedImage._encodedHeight; - dummy_image._length = 0; - dummy_image._frameType = kSkipFrame; - vp8Info->keyIdx = kNoKeyIdx; - return encoded_complete_callback_->Encoded(dummy_image, - &stream_codec_specific, NULL); - } + return encoded_complete_callback_->Encoded( + encodedImage, &stream_codec_specific, fragmentation); } uint32_t SimulcastEncoderAdapter::GetStreamBitrate( diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc index fdca8781bc..7dc75ed9e3 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc @@ -351,6 +351,9 @@ TEST_F(TestSimulcastEncoderAdapterFake, SetChannelParameters) { TEST_F(TestSimulcastEncoderAdapterFake, EncodedCallbackForDifferentEncoders) { SetupCodec(); + // Set bitrates so that we send all layers. + adapter_->SetRates(1200, 30); + // At this point, the simulcast encoder adapter should have 3 streams: HD, // quarter HD, and quarter quarter HD. We're going to mostly ignore the exact // resolutions, to test that the adapter forwards on the correct resolution diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h index 8e365a9ee6..f1a069d831 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h @@ -367,13 +367,6 @@ class TestVp8Simulcast : public ::testing::Test { .Times(1) .WillRepeatedly(Return(0)); } - if (expected_video_streams < kNumberOfSimulcastStreams) { - EXPECT_CALL(encoder_callback_, Encoded( - AllOf(Field(&EncodedImage::_frameType, kSkipFrame), - Field(&EncodedImage::_length, 0)), _, _)) - .Times(kNumberOfSimulcastStreams - expected_video_streams) - .WillRepeatedly(Return(0)); - } } void VerifyTemporalIdxAndSyncForAllSpatialLayers( diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc index 5714a07f2e..e7a5b326ea 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -1018,17 +1018,6 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image, } else if (codec_.mode == kScreensharing) { result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT; } - } else { - // Required in case padding is applied to dropped frames. - encoded_images_[encoder_idx]._length = 0; - encoded_images_[encoder_idx]._frameType = kSkipFrame; - codec_specific.codecType = kVideoCodecVP8; - CodecSpecificInfoVP8* vp8Info = &(codec_specific.codecSpecific.VP8); - vp8Info->pictureId = picture_id_[stream_idx]; - vp8Info->simulcastIdx = stream_idx; - vp8Info->keyIdx = kNoKeyIdx; - encoded_complete_callback_->Encoded(encoded_images_[encoder_idx], - &codec_specific, NULL); } } if (encoders_.size() == 1 && send_stream_[0]) { diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.cc b/webrtc/modules/video_coding/main/source/encoded_frame.cc index 0fa44250d7..646dae32ed 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.cc +++ b/webrtc/modules/video_coding/main/source/encoded_frame.cc @@ -233,11 +233,9 @@ webrtc::FrameType VCMEncodedFrame::ConvertFrameType(VideoFrameType frameType) return kVideoFrameKey; case kDeltaFrame: return kVideoFrameDelta; - case kSkipFrame: - return kFrameEmpty; - default: - return kVideoFrameDelta; } + // Bogus default return value. + return kVideoFrameDelta; } VideoFrameType VCMEncodedFrame::ConvertFrameType(webrtc::FrameType frame_type) { diff --git a/webrtc/test/fake_encoder.cc b/webrtc/test/fake_encoder.cc index a840ddb68a..f85fb9abc1 100644 --- a/webrtc/test/fake_encoder.cc +++ b/webrtc/test/fake_encoder.cc @@ -100,10 +100,8 @@ int32_t FakeEncoder::Encode(const VideoFrame& input_image, encoded._encodedWidth = config_.simulcastStream[i].width; encoded._encodedHeight = config_.simulcastStream[i].height; // Always encode something on the first frame. - if (min_stream_bits > bits_available && i > 0) { - encoded._length = 0; - encoded._frameType = kSkipFrame; - } + if (min_stream_bits > bits_available && i > 0) + continue; assert(callback_ != NULL); if (callback_->Encoded(encoded, &specifics, NULL) != 0) return -1; diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 7316ee8362..2aea976ae7 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -168,8 +168,7 @@ void SendStatisticsProxy::OnSendEncodedImage( stats->height = encoded_image._encodedHeight; update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); - if (encoded_image._frameType != kSkipFrame) - key_frame_counter_.Add(encoded_image._frameType == kKeyFrame); + key_frame_counter_.Add(encoded_image._frameType == kKeyFrame); // TODO(asapersson): This is incorrect if simulcast layers are encoded on // different threads and there is no guarantee that one frame of all layers diff --git a/webrtc/video_frame.h b/webrtc/video_frame.h index b71e0aaae9..626c01356c 100644 --- a/webrtc/video_frame.h +++ b/webrtc/video_frame.h @@ -169,9 +169,6 @@ class VideoFrame { enum VideoFrameType { kKeyFrame = 0, kDeltaFrame = 1, - kGoldenFrame = 2, - kAltRefFrame = 3, - kSkipFrame = 4 }; // TODO(pbos): Rename EncodedFrame and reformat this class' members.