diff options
author | pbos <pbos@webrtc.org> | 2015-10-19 02:39:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-19 09:39:15 +0000 |
commit | 22993e1a0c114122fc1b9de0fc74d4096ec868bd (patch) | |
tree | 7512c1e0449b2abd4e8d9ef0051b9f8a6a6728a7 /webrtc | |
parent | 4306fc70d778887d8a2ea71b6f4bc6a12d1d9447 (diff) | |
download | webrtc-22993e1a0c114122fc1b9de0fc74d4096ec868bd.tar.gz |
Unify FrameType and VideoFrameType.
Prevents some heap allocation and frame-type conversion since interfaces
mismatch. Also it's less confusing to have one type for this.
BUG=webrtc:5042
R=magjed@webrtc.org, mflodman@webrtc.org, henrik.lundin@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org
Review URL: https://codereview.webrtc.org/1371043003
Cr-Commit-Position: refs/heads/master@{#10320}
Diffstat (limited to 'webrtc')
61 files changed, 171 insertions, 227 deletions
diff --git a/webrtc/common_types.h b/webrtc/common_types.h index c11c4d7a73..6b624bfce9 100644 --- a/webrtc/common_types.h +++ b/webrtc/common_types.h @@ -156,14 +156,21 @@ enum ProcessingTypes kRecordingPreprocessing }; -enum FrameType -{ - kFrameEmpty = 0, - kAudioFrameSpeech = 1, - kAudioFrameCN = 2, - kVideoFrameKey = 3, // independent frame - kVideoFrameDelta = 4, // depends on the previus frame -}; +enum FrameType { + kEmptyFrame = 0, + kAudioFrameSpeech = 1, + kAudioFrameCN = 2, + kVideoFrameKey = 3, + kVideoFrameDelta = 4, + // TODO(pbos): Remove below aliases (non-kVideo prefixed) as soon as no + // VideoEncoder implementation in Chromium uses them. + kKeyFrame = kVideoFrameKey, + kDeltaFrame = kVideoFrameDelta, +}; + +// TODO(pbos): Remove VideoFrameType when VideoEncoder implementations no longer +// depend on it. +using VideoFrameType = FrameType; // Statistics for an RTCP channel struct RtcpStatistics { diff --git a/webrtc/frame_callback.h b/webrtc/frame_callback.h index 3098ba7b93..b7f2210334 100644 --- a/webrtc/frame_callback.h +++ b/webrtc/frame_callback.h @@ -21,7 +21,7 @@ class VideoFrame; struct EncodedFrame { public: - EncodedFrame() : data_(NULL), length_(0), frame_type_(kFrameEmpty) {} + EncodedFrame() : data_(NULL), length_(0), frame_type_(kEmptyFrame) {} EncodedFrame(const uint8_t* data, size_t length, FrameType frame_type) : data_(data), length_(length), frame_type_(frame_type) {} diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest.cc index 9b5c17b847..c6cd6dedb4 100644 --- a/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest.cc +++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest.cc @@ -46,7 +46,7 @@ class AcmReceiverTest : public AudioPacketizationCallback, : timestamp_(0), packet_sent_(false), last_packet_send_timestamp_(timestamp_), - last_frame_type_(kFrameEmpty) { + last_frame_type_(kEmptyFrame) { AudioCoding::Config config; config.transport = this; acm_.reset(new AudioCodingImpl(config)); @@ -121,7 +121,7 @@ class AcmReceiverTest : public AudioPacketizationCallback, const uint8_t* payload_data, size_t payload_len_bytes, const RTPFragmentationHeader* fragmentation) override { - if (frame_type == kFrameEmpty) + if (frame_type == kEmptyFrame) return 0; rtp_header_.header.payloadType = payload_type; diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc index 0142275846..12ea300fe5 100644 --- a/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc @@ -46,7 +46,7 @@ class AcmReceiverTestOldApi : public AudioPacketizationCallback, : timestamp_(0), packet_sent_(false), last_packet_send_timestamp_(timestamp_), - last_frame_type_(kFrameEmpty) { + last_frame_type_(kEmptyFrame) { AudioCodingModule::Config config; acm_.reset(new AudioCodingModuleImpl(config)); receiver_.reset(new AcmReceiver(config)); @@ -120,7 +120,7 @@ class AcmReceiverTestOldApi : public AudioPacketizationCallback, const uint8_t* payload_data, size_t payload_len_bytes, const RTPFragmentationHeader* fragmentation) override { - if (frame_type == kFrameEmpty) + if (frame_type == kEmptyFrame) return 0; rtp_header_.header.payloadType = payload_type; diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc index a652278661..879af49bd2 100644 --- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc +++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc @@ -171,7 +171,7 @@ int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) { ConvertEncodedInfoToFragmentationHeader(encoded_info, &my_fragmentation); FrameType frame_type; if (encode_buffer_.size() == 0 && encoded_info.send_even_if_empty) { - frame_type = kFrameEmpty; + frame_type = kEmptyFrame; encoded_info.payload_type = previous_pltype; } else { RTC_DCHECK_GT(encode_buffer_.size(), 0u); diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc index 01c8bb8e78..e36d4e6d90 100644 --- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc @@ -92,7 +92,7 @@ class PacketizationCallbackStubOldApi : public AudioPacketizationCallback { public: PacketizationCallbackStubOldApi() : num_calls_(0), - last_frame_type_(kFrameEmpty), + last_frame_type_(kEmptyFrame), last_payload_type_(-1), last_timestamp_(0), crit_sect_(CriticalSectionWrapper::CreateCriticalSection()) {} @@ -416,18 +416,18 @@ class AudioCodingModuleTestWithComfortNoiseOldApi int ix; FrameType type; } expectation[] = {{2, kAudioFrameCN}, - {5, kFrameEmpty}, - {8, kFrameEmpty}, + {5, kEmptyFrame}, + {8, kEmptyFrame}, {11, kAudioFrameCN}, - {14, kFrameEmpty}, - {17, kFrameEmpty}, + {14, kEmptyFrame}, + {17, kEmptyFrame}, {20, kAudioFrameCN}, - {23, kFrameEmpty}, - {26, kFrameEmpty}, - {29, kFrameEmpty}, + {23, kEmptyFrame}, + {26, kEmptyFrame}, + {29, kEmptyFrame}, {32, kAudioFrameCN}, - {35, kFrameEmpty}, - {38, kFrameEmpty}}; + {35, kEmptyFrame}, + {38, kEmptyFrame}}; for (int i = 0; i < kLoops; ++i) { int num_calls_before = packet_cb_.num_calls(); EXPECT_EQ(i / blocks_per_packet, num_calls_before); @@ -447,7 +447,7 @@ class AudioCodingModuleTestWithComfortNoiseOldApi // Checks that the transport callback is invoked once per frame period of the // underlying speech encoder, even when comfort noise is produced. -// Also checks that the frame type is kAudioFrameCN or kFrameEmpty. +// Also checks that the frame type is kAudioFrameCN or kEmptyFrame. // This test and the next check the same thing, but differ in the order of // speech codec and CNG registration. TEST_F(AudioCodingModuleTestWithComfortNoiseOldApi, diff --git a/webrtc/modules/audio_coding/main/test/Channel.cc b/webrtc/modules/audio_coding/main/test/Channel.cc index 779718dd50..1b0a610b17 100644 --- a/webrtc/modules/audio_coding/main/test/Channel.cc +++ b/webrtc/modules/audio_coding/main/test/Channel.cc @@ -42,7 +42,7 @@ int32_t Channel::SendData(FrameType frameType, } else { rtpInfo.type.Audio.isCNG = false; } - if (frameType == kFrameEmpty) { + if (frameType == kEmptyFrame) { // When frame is empty, we should not transmit it. The frame size of the // next non-empty frame will be based on the previous frame size. _useLastFrameSize = _lastFrameSizeSample > 0; diff --git a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc index 21d97f1abf..85c2579fc2 100644 --- a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc +++ b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc @@ -74,7 +74,7 @@ int32_t TestPack::SendData(FrameType frame_type, uint8_t payload_type, } else { rtp_info.type.Audio.isCNG = false; } - if (frame_type == kFrameEmpty) { + if (frame_type == kEmptyFrame) { // Skip this frame. return 0; } diff --git a/webrtc/modules/audio_coding/main/test/TestStereo.cc b/webrtc/modules/audio_coding/main/test/TestStereo.cc index 32ecadface..b0786be608 100644 --- a/webrtc/modules/audio_coding/main/test/TestStereo.cc +++ b/webrtc/modules/audio_coding/main/test/TestStereo.cc @@ -58,7 +58,7 @@ int32_t TestPackStereo::SendData(const FrameType frame_type, rtp_info.header.sequenceNumber = seq_no_++; rtp_info.header.payloadType = payload_type; rtp_info.header.timestamp = timestamp; - if (frame_type == kFrameEmpty) { + if (frame_type == kEmptyFrame) { // Skip this frame return 0; } diff --git a/webrtc/modules/audio_coding/main/test/TestVADDTX.cc b/webrtc/modules/audio_coding/main/test/TestVADDTX.cc index 0e42b9f8ae..bd0335a5f3 100644 --- a/webrtc/modules/audio_coding/main/test/TestVADDTX.cc +++ b/webrtc/modules/audio_coding/main/test/TestVADDTX.cc @@ -44,7 +44,7 @@ int32_t ActivityMonitor::InFrameType(FrameType frame_type) { void ActivityMonitor::PrintStatistics() { printf("\n"); - printf("kFrameEmpty %u\n", counter_[kFrameEmpty]); + printf("kEmptyFrame %u\n", counter_[kEmptyFrame]); printf("kAudioFrameSpeech %u\n", counter_[kAudioFrameSpeech]); printf("kAudioFrameCN %u\n", counter_[kAudioFrameCN]); printf("kVideoFrameKey %u\n", counter_[kVideoFrameKey]); @@ -248,7 +248,7 @@ void TestOpusDtx::Perform() { 32000, 1, out_filename, false, expects); EXPECT_EQ(0, acm_send_->EnableOpusDtx()); - expects[kFrameEmpty] = 1; + expects[kEmptyFrame] = 1; Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1, out_filename, true, expects); @@ -256,13 +256,13 @@ void TestOpusDtx::Perform() { out_filename = webrtc::test::OutputPath() + "testOpusDtx_outFile_stereo.pcm"; RegisterCodec(kOpusStereo); EXPECT_EQ(0, acm_send_->DisableOpusDtx()); - expects[kFrameEmpty] = 0; + expects[kEmptyFrame] = 0; Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), 32000, 2, out_filename, false, expects); EXPECT_EQ(0, acm_send_->EnableOpusDtx()); - expects[kFrameEmpty] = 1; + expects[kEmptyFrame] = 1; Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), 32000, 2, out_filename, true, expects); #endif diff --git a/webrtc/modules/audio_coding/main/test/TestVADDTX.h b/webrtc/modules/audio_coding/main/test/TestVADDTX.h index 8ef4228bd7..d34b99f865 100644 --- a/webrtc/modules/audio_coding/main/test/TestVADDTX.h +++ b/webrtc/modules/audio_coding/main/test/TestVADDTX.h @@ -29,7 +29,7 @@ class ActivityMonitor : public ACMVADCallback { void ResetStatistics(); void GetStatistics(uint32_t* stats); private: - // 0 - kFrameEmpty + // 0 - kEmptyFrame // 1 - kAudioFrameSpeech // 2 - kAudioFrameCN // 3 - kVideoFrameKey (not used by audio) @@ -60,7 +60,7 @@ class TestVadDtx : public ACMTest { // 0 : there have been no packets of type |x|, // 1 : there have been packets of type |x|, // with |x| indicates the following packet types - // 0 - kFrameEmpty + // 0 - kEmptyFrame // 1 - kAudioFrameSpeech // 2 - kAudioFrameCN // 3 - kVideoFrameKey (not used by audio) diff --git a/webrtc/modules/audio_coding/main/test/utility.cc b/webrtc/modules/audio_coding/main/test/utility.cc index 949ca617b2..86e49f175d 100644 --- a/webrtc/modules/audio_coding/main/test/utility.cc +++ b/webrtc/modules/audio_coding/main/test/utility.cc @@ -288,7 +288,7 @@ VADCallback::VADCallback() { } void VADCallback::PrintFrameTypes() { - printf("kFrameEmpty......... %d\n", _numFrameTypes[kFrameEmpty]); + printf("kEmptyFrame......... %d\n", _numFrameTypes[kEmptyFrame]); printf("kAudioFrameSpeech... %d\n", _numFrameTypes[kAudioFrameSpeech]); printf("kAudioFrameCN....... %d\n", _numFrameTypes[kAudioFrameCN]); printf("kVideoFrameKey...... %d\n", _numFrameTypes[kVideoFrameKey]); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc index 3ad5686fe9..1a14b5554a 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc @@ -83,7 +83,7 @@ void TestFua(size_t frame_size, fragmentation.fragmentationOffset[0] = 0; fragmentation.fragmentationLength[0] = frame_size; rtc::scoped_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create( - kRtpVideoH264, max_payload_size, NULL, kFrameEmpty)); + kRtpVideoH264, max_payload_size, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame.get(), frame_size, &fragmentation); rtc::scoped_ptr<uint8_t[]> packet(new uint8_t[max_payload_size]); @@ -157,7 +157,7 @@ TEST(RtpPacketizerH264Test, TestSingleNalu) { fragmentation.fragmentationOffset[0] = 0; fragmentation.fragmentationLength[0] = sizeof(frame); rtc::scoped_ptr<RtpPacketizer> packetizer( - RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kFrameEmpty)); + RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame, sizeof(frame), &fragmentation); uint8_t packet[kMaxPayloadSize] = {0}; size_t length = 0; @@ -186,7 +186,7 @@ TEST(RtpPacketizerH264Test, TestSingleNaluTwoPackets) { frame[fragmentation.fragmentationOffset[1]] = 0x01; rtc::scoped_ptr<RtpPacketizer> packetizer( - RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kFrameEmpty)); + RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame, kFrameSize, &fragmentation); uint8_t packet[kMaxPayloadSize] = {0}; @@ -223,7 +223,7 @@ TEST(RtpPacketizerH264Test, TestStapA) { fragmentation.fragmentationLength[2] = kNalHeaderSize + kFrameSize - kPayloadOffset; rtc::scoped_ptr<RtpPacketizer> packetizer( - RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kFrameEmpty)); + RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame, kFrameSize, &fragmentation); uint8_t packet[kMaxPayloadSize] = {0}; @@ -258,7 +258,7 @@ TEST(RtpPacketizerH264Test, TestTooSmallForStapAHeaders) { fragmentation.fragmentationLength[2] = kNalHeaderSize + kFrameSize - kPayloadOffset; rtc::scoped_ptr<RtpPacketizer> packetizer( - RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kFrameEmpty)); + RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame, kFrameSize, &fragmentation); uint8_t packet[kMaxPayloadSize] = {0}; @@ -306,7 +306,7 @@ TEST(RtpPacketizerH264Test, TestMixedStapA_FUA) { } } rtc::scoped_ptr<RtpPacketizer> packetizer( - RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kFrameEmpty)); + RtpPacketizer::Create(kRtpVideoH264, kMaxPayloadSize, NULL, kEmptyFrame)); packetizer->SetPayloadData(frame, kFrameSize, &fragmentation); // First expecting two FU-A packets. diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc index 0a26f9e08e..1a56c632b3 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -35,7 +35,8 @@ const size_t kRtpHeaderLength = 12; const char* FrameTypeToString(FrameType frame_type) { switch (frame_type) { - case kFrameEmpty: return "empty"; + case kEmptyFrame: + return "empty"; case kAudioFrameSpeech: return "audio_speech"; case kAudioFrameCN: return "audio_cn"; case kVideoFrameKey: return "video_key"; @@ -509,7 +510,7 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type, TRACE_EVENT_ASYNC_STEP1("webrtc", "Audio", capture_timestamp, "Send", "type", FrameTypeToString(frame_type)); assert(frame_type == kAudioFrameSpeech || frame_type == kAudioFrameCN || - frame_type == kFrameEmpty); + frame_type == kEmptyFrame); ret_val = audio_->SendAudio(frame_type, payload_type, capture_timestamp, payload_data, payload_size, fragmentation); @@ -518,7 +519,7 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type, "Send", "type", FrameTypeToString(frame_type)); assert(frame_type != kAudioFrameSpeech && frame_type != kAudioFrameCN); - if (frame_type == kFrameEmpty) + if (frame_type == kEmptyFrame) return 0; ret_val = diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc index 3f55db4038..30842bb773 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc @@ -208,8 +208,8 @@ int32_t RTPSenderAudio::SendAudio( // A source MAY send events and coded audio packets for the same time // but we don't support it if (_dtmfEventIsOn) { - if (frameType == kFrameEmpty) { - // kFrameEmpty is used to drive the DTMF when in CN mode + if (frameType == kEmptyFrame) { + // kEmptyFrame is used to drive the DTMF when in CN mode // it can be triggered more frequently than we want to send the // DTMF packets. if (packet_size_samples > (captureTimeStamp - _dtmfTimestampLastSent)) { @@ -259,7 +259,7 @@ int32_t RTPSenderAudio::SendAudio( return 0; } if (payloadSize == 0 || payloadData == NULL) { - if (frameType == kFrameEmpty) { + if (frameType == kEmptyFrame) { // we don't send empty audio RTP packets // no error since we use it to drive DTMF when we use VAD return 0; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 6d30263fe7..e4ace67a48 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -1266,7 +1266,7 @@ TEST_F(RtpSenderAudioTest, SendAudioWithAudioLevelExtension) { // audio channel. // This test checks the marker bit for the first packet and the consequent // packets of the same telephone event. Since it is specifically for DTMF -// events, ignoring audio packets and sending kFrameEmpty instead of those. +// events, ignoring audio packets and sending kEmptyFrame instead of those. TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) { char payload_name[RTP_PAYLOAD_NAME_SIZE] = "telephone-event"; uint8_t payload_type = 126; @@ -1284,13 +1284,13 @@ TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) { // During start, it takes the starting timestamp as last sent timestamp. // The duration is calculated as the difference of current and last sent // timestamp. So for first call it will skip since the duration is zero. - ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, + ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kEmptyFrame, payload_type, capture_time_ms, 0, nullptr, 0, nullptr)); // DTMF Sample Length is (Frequency/1000) * Duration. // So in this case, it is (8000/1000) * 500 = 4000. // Sending it as two packets. - ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, + ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kEmptyFrame, payload_type, capture_time_ms + 2000, 0, nullptr, 0, nullptr)); rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser( @@ -1303,7 +1303,7 @@ TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) { // Marker Bit should be set to 1 for first packet. EXPECT_TRUE(rtp_header.markerBit); - ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, + ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kEmptyFrame, payload_type, capture_time_ms + 4000, 0, nullptr, 0, nullptr)); ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc index 69e52a5b27..22ace500ff 100644 --- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc +++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc @@ -242,7 +242,7 @@ int H264VideoToolboxEncoder::InitEncode(const VideoCodec* codec_settings, int H264VideoToolboxEncoder::Encode( const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { if (input_image.IsZeroSize()) { // It's possible to get zero sizes as a signal to produce keyframes (this // happens for internal sources). But this shouldn't happen in diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h index 28cd63ed29..f4fb86fa04 100644 --- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h +++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h @@ -38,7 +38,7 @@ class H264VideoToolboxEncoder : public H264Encoder { int Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; diff --git a/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h b/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h index 35f7b3e1b9..e54e78db57 100644 --- a/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h +++ b/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h @@ -50,7 +50,7 @@ class I420Encoder : public VideoEncoder { // <0 - Error int Encode(const VideoFrame& inputImage, const CodecSpecificInfo* /*codecSpecificInfo*/, - const std::vector<VideoFrameType>* /*frame_types*/) override; + const std::vector<FrameType>* /*frame_types*/) override; // Register an encode complete callback object. // diff --git a/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc b/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc index 5ac785a24a..065a2d76cc 100644 --- a/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc +++ b/webrtc/modules/video_coding/codecs/i420/main/source/i420.cc @@ -74,7 +74,7 @@ int I420Encoder::InitEncode(const VideoCodec* codecSettings, int I420Encoder::Encode(const VideoFrame& inputImage, const CodecSpecificInfo* /*codecSpecificInfo*/, - const std::vector<VideoFrameType>* /*frame_types*/) { + const std::vector<FrameType>* /*frame_types*/) { if (!_inited) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } diff --git a/webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h b/webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h index 5710446f16..5243d9afb8 100644 --- a/webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h +++ b/webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h @@ -35,7 +35,7 @@ class MockVideoEncoder : public VideoEncoder { MOCK_METHOD3(Encode, int32_t(const VideoFrame& inputImage, const CodecSpecificInfo* codecSpecificInfo, - const std::vector<VideoFrameType>* frame_types)); + const std::vector<FrameType>* frame_types)); MOCK_METHOD1(RegisterEncodeCompleteCallback, int32_t(EncodedImageCallback* callback)); MOCK_METHOD0(Release, int32_t()); diff --git a/webrtc/modules/video_coding/codecs/test/stats.h b/webrtc/modules/video_coding/codecs/test/stats.h index 8dc8f159fe..83ba108bb7 100644 --- a/webrtc/modules/video_coding/codecs/test/stats.h +++ b/webrtc/modules/video_coding/codecs/test/stats.h @@ -39,7 +39,7 @@ struct FrameStatistic { // Copied from EncodedImage size_t encoded_frame_length_in_bytes; - webrtc::VideoFrameType frame_type; + webrtc::FrameType frame_type; }; // Handles statistics from a single video processing run. diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc index 888adb8939..3bb6b7a749 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc @@ -162,7 +162,7 @@ size_t VideoProcessorImpl::EncodedFrameSize() { return encoded_frame_size_; } -VideoFrameType VideoProcessorImpl::EncodedFrameType() { +FrameType VideoProcessorImpl::EncodedFrameType() { return encoded_frame_type_; } @@ -199,7 +199,7 @@ bool VideoProcessorImpl::ProcessFrame(int frame_number) { source_frame_.set_timestamp(frame_number); // Decide if we're going to force a keyframe: - std::vector<VideoFrameType> frame_types(1, kDeltaFrame); + std::vector<FrameType> frame_types(1, kDeltaFrame); if (config_.keyframe_interval > 0 && frame_number % config_.keyframe_interval == 0) { frame_types[0] = kKeyFrame; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.h b/webrtc/modules/video_coding/codecs/test/videoprocessor.h index 8c9cb1211a..4b6aed1d5b 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.h +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.h @@ -147,7 +147,7 @@ class VideoProcessor { virtual size_t EncodedFrameSize() = 0; // Return the encoded frame type (key or delta). - virtual VideoFrameType EncodedFrameType() = 0; + virtual FrameType EncodedFrameType() = 0; // Return the number of dropped frames. virtual int NumberDroppedFrames() = 0; @@ -183,7 +183,7 @@ class VideoProcessorImpl : public VideoProcessor { // Return the size of the encoded frame in bytes. size_t EncodedFrameSize() override; // Return the encoded frame type (key or delta). - VideoFrameType EncodedFrameType() override; + FrameType EncodedFrameType() override; // Return the number of dropped frames. int NumberDroppedFrames() override; // Return the number of spatial resizes. @@ -212,7 +212,7 @@ class VideoProcessorImpl : public VideoProcessor { // If Init() has executed successfully. bool initialized_; size_t encoded_frame_size_; - VideoFrameType encoded_frame_type_; + FrameType encoded_frame_type_; int prev_time_stamp_; int num_dropped_frames_; int num_spatial_resizes_; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc index 9f8ff49bee..ec9d7567ce 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc @@ -268,7 +268,7 @@ class VideoProcessorIntegrationTest: public testing::Test { } // For every encoded frame, update the rate control metrics. - void UpdateRateControlMetrics(int frame_num, VideoFrameType frame_type) { + void UpdateRateControlMetrics(int frame_num, FrameType frame_type) { float encoded_size_kbits = processor_->EncodedFrameSize() * 8.0f / 1000.0f; // Update layer data. // Update rate mismatch relative to per-frame bandwidth for delta frames. @@ -450,7 +450,7 @@ class VideoProcessorIntegrationTest: public testing::Test { ResetRateControlMetrics( rate_profile.frame_index_rate_update[update_index + 1]); int frame_number = 0; - VideoFrameType frame_type = kDeltaFrame; + FrameType frame_type = kDeltaFrame; while (processor_->ProcessFrame(frame_number) && frame_number < num_frames) { // Get the layer index for the frame |frame_number|. 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 9ac2efabe6..4439267cd2 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc @@ -233,7 +233,7 @@ int SimulcastEncoderAdapter::InitEncode(const VideoCodec* inst, int SimulcastEncoderAdapter::Encode( const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { if (!Initialized()) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } @@ -267,7 +267,7 @@ int SimulcastEncoderAdapter::Encode( if (!streaminfos_[stream_idx].send_stream) continue; - std::vector<VideoFrameType> stream_frame_types; + std::vector<FrameType> stream_frame_types; if (send_key_frame) { stream_frame_types.push_back(kKeyFrame); streaminfos_[stream_idx].key_frame_request = false; diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h index c00d8fb80a..afec024abc 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h @@ -42,7 +42,7 @@ class SimulcastEncoderAdapter : public VP8Encoder { size_t max_payload_size) override; int Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; int SetRates(uint32_t new_bitrate_kbit, uint32_t new_framerate) override; 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 ed6541c3a8..218b5e2d1a 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 @@ -117,7 +117,7 @@ class MockVideoEncoder : public VideoEncoder { int32_t Encode(const VideoFrame& inputImage, const CodecSpecificInfo* codecSpecificInfo, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { return 0; } diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h index 672fa3aa89..a3d9e5a061 100644 --- a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h +++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h @@ -338,7 +338,7 @@ class TestVp8Simulcast : public ::testing::Test { decoder_->Release(); } - void ExpectStreams(VideoFrameType frame_type, int expected_video_streams) { + void ExpectStreams(FrameType frame_type, int expected_video_streams) { ASSERT_GE(expected_video_streams, 0); ASSERT_LE(expected_video_streams, kNumberOfSimulcastStreams); if (expected_video_streams >= 1) { @@ -389,8 +389,7 @@ class TestVp8Simulcast : public ::testing::Test { // a key frame was only requested for some of them. void TestKeyFrameRequestsOnAllStreams() { encoder_->SetRates(kMaxBitrates[2], 30); // To get all three streams. - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, kNumberOfSimulcastStreams); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -424,8 +423,7 @@ class TestVp8Simulcast : public ::testing::Test { void TestPaddingAllStreams() { // We should always encode the base layer. encoder_->SetRates(kMinBitrates[0] - 1, 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 1); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -437,8 +435,7 @@ class TestVp8Simulcast : public ::testing::Test { void TestPaddingTwoStreams() { // We have just enough to get only the first stream and padding for two. encoder_->SetRates(kMinBitrates[0], 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 1); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -451,8 +448,7 @@ class TestVp8Simulcast : public ::testing::Test { // We are just below limit of sending second stream, so we should get // the first stream maxed out (at |maxBitrate|), and padding for two. encoder_->SetRates(kTargetBitrates[0] + kMinBitrates[1] - 1, 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 1); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -464,8 +460,7 @@ class TestVp8Simulcast : public ::testing::Test { void TestPaddingOneStream() { // We have just enough to send two streams, so padding for one stream. encoder_->SetRates(kTargetBitrates[0] + kMinBitrates[1], 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 2); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -479,8 +474,7 @@ class TestVp8Simulcast : public ::testing::Test { // first stream's rate maxed out at |targetBitrate|, second at |maxBitrate|. encoder_->SetRates(kTargetBitrates[0] + kTargetBitrates[1] + kMinBitrates[2] - 1, 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 2); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -493,8 +487,7 @@ class TestVp8Simulcast : public ::testing::Test { // We have just enough to send all streams. encoder_->SetRates(kTargetBitrates[0] + kTargetBitrates[1] + kMinBitrates[2], 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 3); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -507,8 +500,7 @@ class TestVp8Simulcast : public ::testing::Test { // We should get three media streams. encoder_->SetRates(kMaxBitrates[0] + kMaxBitrates[1] + kMaxBitrates[2], 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); ExpectStreams(kKeyFrame, 3); EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); @@ -589,8 +581,7 @@ class TestVp8Simulcast : public ::testing::Test { // Encode one frame and verify. encoder_->SetRates(kMaxBitrates[0] + kMaxBitrates[1], 30); - std::vector<VideoFrameType> frame_types(kNumberOfSimulcastStreams, - kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfSimulcastStreams, kDeltaFrame); EXPECT_CALL(encoder_callback_, Encoded( AllOf(Field(&EncodedImage::_frameType, kKeyFrame), Field(&EncodedImage::_encodedWidth, width), diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc index 2885bb88f6..d6f36f2d27 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -706,7 +706,7 @@ uint32_t VP8EncoderImpl::MaxIntraTarget(uint32_t optimalBuffersize) { int VP8EncoderImpl::Encode(const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { TRACE_EVENT1("webrtc", "VP8::Encode", "timestamp", frame.timestamp()); if (!inited_) diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h index 5ff1485ed5..ba14ed5841 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h @@ -48,7 +48,7 @@ class VP8EncoderImpl : public VP8Encoder { virtual int Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types); + const std::vector<FrameType>* frame_types); virtual int RegisterEncodeCompleteCallback(EncodedImageCallback* callback); diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc index deb3bca5e4..1a2137139b 100644 --- a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -422,7 +422,7 @@ uint32_t VP9EncoderImpl::MaxIntraTarget(uint32_t optimal_buffer_size) { int VP9EncoderImpl::Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { if (!inited_) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } @@ -432,7 +432,7 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image, if (encoded_complete_callback_ == NULL) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } - VideoFrameType frame_type = kDeltaFrame; + FrameType frame_type = kDeltaFrame; // We only support one stream at the moment. if (frame_types && frame_types->size() > 0) { frame_type = (*frame_types)[0]; diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h index c164a63980..f9c123079e 100644 --- a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h +++ b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h @@ -35,7 +35,7 @@ class VP9EncoderImpl : public VP9Encoder { int Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; diff --git a/webrtc/modules/video_coding/main/source/decoding_state_unittest.cc b/webrtc/modules/video_coding/main/source/decoding_state_unittest.cc index 10f1d6e4dd..feae701a65 100644 --- a/webrtc/modules/video_coding/main/source/decoding_state_unittest.cc +++ b/webrtc/modules/video_coding/main/source/decoding_state_unittest.cc @@ -181,7 +181,7 @@ TEST(TestDecodingState, UpdateOldPacket) { // Now insert empty packet belonging to the same frame. packet.timestamp = 1; packet.seqNum = 2; - packet.frameType = kFrameEmpty; + packet.frameType = kEmptyFrame; packet.sizeBytes = 0; dec_state.UpdateOldPacket(&packet); EXPECT_EQ(dec_state.sequence_num(), 2); @@ -196,7 +196,7 @@ TEST(TestDecodingState, UpdateOldPacket) { // sequence number. packet.timestamp = 0; packet.seqNum = 4; - packet.frameType = kFrameEmpty; + packet.frameType = kEmptyFrame; packet.sizeBytes = 0; dec_state.UpdateOldPacket(&packet); EXPECT_EQ(dec_state.sequence_num(), 3); diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.cc b/webrtc/modules/video_coding/main/source/encoded_frame.cc index 646dae32ed..92d2cd003d 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.cc +++ b/webrtc/modules/video_coding/main/source/encoded_frame.cc @@ -226,38 +226,4 @@ void VCMEncodedFrame::VerifyAndAllocate(size_t minimumSize) } } -webrtc::FrameType VCMEncodedFrame::ConvertFrameType(VideoFrameType frameType) -{ - switch(frameType) { - case kKeyFrame: - return kVideoFrameKey; - case kDeltaFrame: - return kVideoFrameDelta; - } - // Bogus default return value. - return kVideoFrameDelta; -} - -VideoFrameType VCMEncodedFrame::ConvertFrameType(webrtc::FrameType frame_type) { - switch (frame_type) { - case kVideoFrameKey: - return kKeyFrame; - case kVideoFrameDelta: - return kDeltaFrame; - default: - assert(false); - return kDeltaFrame; - } -} - -void VCMEncodedFrame::ConvertFrameTypes( - const std::vector<webrtc::FrameType>& frame_types, - std::vector<VideoFrameType>* video_frame_types) { - assert(video_frame_types); - video_frame_types->reserve(frame_types.size()); - for (size_t i = 0; i < frame_types.size(); ++i) { - (*video_frame_types)[i] = ConvertFrameType(frame_types[i]); - } -} - -} +} // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.h b/webrtc/modules/video_coding/main/source/encoded_frame.h index 6caaf42ff6..608578c35d 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.h +++ b/webrtc/modules/video_coding/main/source/encoded_frame.h @@ -68,7 +68,7 @@ public: /** * Get frame type */ - webrtc::FrameType FrameType() const {return ConvertFrameType(_frameType);} + webrtc::FrameType FrameType() const { return _frameType; } /** * Get frame rotation */ @@ -95,12 +95,6 @@ public: const RTPFragmentationHeader* FragmentationHeader() const; - static webrtc::FrameType ConvertFrameType(VideoFrameType frameType); - static VideoFrameType ConvertFrameType(webrtc::FrameType frameType); - static void ConvertFrameTypes( - const std::vector<webrtc::FrameType>& frame_types, - std::vector<VideoFrameType>* video_frame_types); - protected: /** * Verifies that current allocated buffer size is larger than or equal to the input size. diff --git a/webrtc/modules/video_coding/main/source/frame_buffer.cc b/webrtc/modules/video_coding/main/source/frame_buffer.cc index 82a755ab4f..192febe2a6 100644 --- a/webrtc/modules/video_coding/main/source/frame_buffer.cc +++ b/webrtc/modules/video_coding/main/source/frame_buffer.cc @@ -98,7 +98,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, // We only take the ntp timestamp of the first packet of a frame. ntp_time_ms_ = packet.ntp_time_ms_; _codec = packet.codec; - if (packet.frameType != kFrameEmpty) { + if (packet.frameType != kEmptyFrame) { // first media packet SetState(kStateIncomplete); } @@ -280,7 +280,7 @@ VCMFrameBuffer::PrepareForDecode(bool continuous) { #endif // Transfer frame information to EncodedFrame and create any codec // specific information. - _frameType = ConvertFrameType(_sessionInfo.FrameType()); + _frameType = _sessionInfo.FrameType(); _completeFrame = _sessionInfo.complete(); _missingFrame = !continuous; } diff --git a/webrtc/modules/video_coding/main/source/generic_encoder.cc b/webrtc/modules/video_coding/main/source/generic_encoder.cc index 31c3f1715f..fe3d5cb991 100644 --- a/webrtc/modules/video_coding/main/source/generic_encoder.cc +++ b/webrtc/modules/video_coding/main/source/generic_encoder.cc @@ -140,9 +140,8 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings, int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame, const CodecSpecificInfo* codecSpecificInfo, const std::vector<FrameType>& frameTypes) { - std::vector<VideoFrameType> video_frame_types(frameTypes.size(), - kDeltaFrame); - VCMEncodedFrame::ConvertFrameTypes(frameTypes, &video_frame_types); + for (FrameType frame_type : frameTypes) + RTC_DCHECK(frame_type == kVideoFrameKey || frame_type == kVideoFrameDelta); rotation_ = inputFrame.rotation(); @@ -153,12 +152,11 @@ int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame, vcm_encoded_frame_callback_->SetRotation(rotation_); } - int32_t result = - encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types); + int32_t result = encoder_->Encode(inputFrame, codecSpecificInfo, &frameTypes); if (is_screenshare_ && result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) { // Target bitrate exceeded, encoder state has been reset - try again. - return encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types); + return encoder_->Encode(inputFrame, codecSpecificInfo, &frameTypes); } return result; @@ -223,10 +221,7 @@ VCMGenericEncoder::SetPeriodicKeyFrames(bool enable) int32_t VCMGenericEncoder::RequestFrame( const std::vector<FrameType>& frame_types) { VideoFrame image; - std::vector<VideoFrameType> video_frame_types(frame_types.size(), - kDeltaFrame); - VCMEncodedFrame::ConvertFrameTypes(frame_types, &video_frame_types); - return encoder_->Encode(image, NULL, &video_frame_types); + return encoder_->Encode(image, NULL, &frame_types); } int32_t @@ -294,6 +289,8 @@ int32_t VCMEncodedFrameCallback::Encoded( const EncodedImage& encodedImage, const CodecSpecificInfo* codecSpecificInfo, const RTPFragmentationHeader* fragmentationHeader) { + RTC_DCHECK(encodedImage._frameType == kVideoFrameKey || + encodedImage._frameType == kVideoFrameDelta); post_encode_callback_->Encoded(encodedImage, NULL, NULL); if (_sendCallback == NULL) { diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.cc b/webrtc/modules/video_coding/main/source/jitter_buffer.cc index 49c2325d80..92ffbc9120 100644 --- a/webrtc/modules/video_coding/main/source/jitter_buffer.cc +++ b/webrtc/modules/video_coding/main/source/jitter_buffer.cc @@ -643,7 +643,7 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet, // Empty packets may bias the jitter estimate (lacking size component), // therefore don't let empty packet trigger the following updates: - if (packet.frameType != kFrameEmpty) { + if (packet.frameType != kEmptyFrame) { if (waiting_for_completion_.timestamp == packet.timestamp) { // This can get bad if we have a lot of duplicate packets, // we will then count some packet multiple times. diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc index 7ba4d68b5c..ab4d8cd4d9 100644 --- a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc +++ b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc @@ -168,10 +168,9 @@ class TestRunningJitterBuffer : public ::testing::Test { } VCMFrameBufferEnum InsertFrame(FrameType frame_type) { - stream_generator_->GenerateFrame(frame_type, - (frame_type != kFrameEmpty) ? 1 : 0, - (frame_type == kFrameEmpty) ? 1 : 0, - clock_->TimeInMilliseconds()); + stream_generator_->GenerateFrame( + frame_type, (frame_type != kEmptyFrame) ? 1 : 0, + (frame_type == kEmptyFrame) ? 1 : 0, clock_->TimeInMilliseconds()); VCMFrameBufferEnum ret = InsertPacketAndPop(0); clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs); return ret; @@ -1050,7 +1049,7 @@ TEST_F(TestBasicJitterBuffer, PacketLoss) { packet_->markerBit = false; packet_->seqNum = seq_num_; packet_->completeNALU = kNaluEnd; - packet_->frameType = kFrameEmpty; + packet_->frameType = kEmptyFrame; EXPECT_EQ(jitter_buffer_->InsertPacket(*packet_, &retransmitted), kDecodableSession); @@ -1524,7 +1523,7 @@ TEST_F(TestBasicJitterBuffer, EmptyLastFrame) { packet_->markerBit = false; packet_->seqNum = seq_num_; packet_->timestamp = timestamp_; - packet_->frameType = kFrameEmpty; + packet_->frameType = kEmptyFrame; EXPECT_EQ(kNoError, jitter_buffer_->InsertPacket(*packet_, &retransmitted)); @@ -1895,7 +1894,7 @@ TEST_F(TestRunningJitterBuffer, TwoPacketsNonContinuous) { TEST_F(TestJitterBufferNack, EmptyPackets) { // Make sure empty packets doesn't clog the jitter buffer. jitter_buffer_->SetNackMode(kNack, media_optimization::kLowRttNackMs, -1); - EXPECT_GE(InsertFrames(kMaxNumberOfFrames, kFrameEmpty), kNoError); + EXPECT_GE(InsertFrames(kMaxNumberOfFrames, kEmptyFrame), kNoError); InsertFrame(kVideoFrameKey); EXPECT_TRUE(DecodeCompleteFrame()); } diff --git a/webrtc/modules/video_coding/main/source/packet.cc b/webrtc/modules/video_coding/main/source/packet.cc index 88838f35f8..fd5a6abb8c 100644 --- a/webrtc/modules/video_coding/main/source/packet.cc +++ b/webrtc/modules/video_coding/main/source/packet.cc @@ -16,23 +16,21 @@ namespace webrtc { VCMPacket::VCMPacket() - : - payloadType(0), - timestamp(0), - ntp_time_ms_(0), - seqNum(0), - dataPtr(NULL), - sizeBytes(0), - markerBit(false), - frameType(kFrameEmpty), - codec(kVideoCodecUnknown), - isFirstPacket(false), - completeNALU(kNaluUnset), - insertStartCode(false), - width(0), - height(0), - codecSpecificHeader() { -} + : payloadType(0), + timestamp(0), + ntp_time_ms_(0), + seqNum(0), + dataPtr(NULL), + sizeBytes(0), + markerBit(false), + frameType(kEmptyFrame), + codec(kVideoCodecUnknown), + isFirstPacket(false), + completeNALU(kNaluUnset), + insertStartCode(false), + width(0), + height(0), + codecSpecificHeader() {} VCMPacket::VCMPacket(const uint8_t* ptr, const size_t size, @@ -88,7 +86,7 @@ void VCMPacket::Reset() { dataPtr = NULL; sizeBytes = 0; markerBit = false; - frameType = kFrameEmpty; + frameType = kEmptyFrame; codec = kVideoCodecUnknown; isFirstPacket = false; completeNALU = kNaluUnset; diff --git a/webrtc/modules/video_coding/main/source/receiver_unittest.cc b/webrtc/modules/video_coding/main/source/receiver_unittest.cc index eb5e4718ce..707e1f1d79 100644 --- a/webrtc/modules/video_coding/main/source/receiver_unittest.cc +++ b/webrtc/modules/video_coding/main/source/receiver_unittest.cc @@ -63,10 +63,8 @@ class TestVCMReceiver : public ::testing::Test { int32_t InsertFrame(FrameType frame_type, bool complete) { int num_of_packets = complete ? 1 : 2; stream_generator_->GenerateFrame( - frame_type, - (frame_type != kFrameEmpty) ? num_of_packets : 0, - (frame_type == kFrameEmpty) ? 1 : 0, - clock_->TimeInMilliseconds()); + frame_type, (frame_type != kEmptyFrame) ? num_of_packets : 0, + (frame_type == kEmptyFrame) ? 1 : 0, clock_->TimeInMilliseconds()); int32_t ret = InsertPacketAndPop(0); if (!complete) { // Drop the second packet. diff --git a/webrtc/modules/video_coding/main/source/session_info.cc b/webrtc/modules/video_coding/main/source/session_info.cc index bf6bcb3c00..7a32504b00 100644 --- a/webrtc/modules/video_coding/main/source/session_info.cc +++ b/webrtc/modules/video_coding/main/source/session_info.cc @@ -464,7 +464,7 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet, uint8_t* frame_buffer, VCMDecodeErrorMode decode_error_mode, const FrameData& frame_data) { - if (packet.frameType == kFrameEmpty) { + if (packet.frameType == kEmptyFrame) { // Update sequence number of an empty packet. // Only media packets are inserted into the packet list. InformOfEmptyPacket(packet.seqNum); @@ -516,7 +516,7 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet, LOG(LS_WARNING) << "Received packet with a sequence number which is out " "of frame boundaries"; return -3; - } else if (frame_type_ == kFrameEmpty && packet.frameType != kFrameEmpty) { + } else if (frame_type_ == kEmptyFrame && packet.frameType != kEmptyFrame) { // Update the frame type with the type of the first media packet. // TODO(mikhal): Can this trigger? frame_type_ = packet.frameType; diff --git a/webrtc/modules/video_coding/main/source/session_info_unittest.cc b/webrtc/modules/video_coding/main/source/session_info_unittest.cc index fae55f4252..58c352d3fc 100644 --- a/webrtc/modules/video_coding/main/source/session_info_unittest.cc +++ b/webrtc/modules/video_coding/main/source/session_info_unittest.cc @@ -175,7 +175,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) { packet_.markerBit = true; packet_.seqNum = 2; packet_.sizeBytes = 0; - packet_.frameType = kFrameEmpty; + packet_.frameType = kEmptyFrame; EXPECT_EQ(0, session_.InsertPacket(packet_, frame_buffer_, @@ -888,7 +888,7 @@ TEST_F(TestVP8Partitions, AggregationOverTwoPackets) { TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) { packet_.isFirstPacket = false; packet_.completeNALU = kNaluComplete; - packet_.frameType = kFrameEmpty; + packet_.frameType = kEmptyFrame; packet_.sizeBytes = 0; packet_.seqNum = 0; packet_.markerBit = false; diff --git a/webrtc/modules/video_coding/main/source/test/stream_generator.cc b/webrtc/modules/video_coding/main/source/test/stream_generator.cc index dcf9b68602..664764a36a 100644 --- a/webrtc/modules/video_coding/main/source/test/stream_generator.cc +++ b/webrtc/modules/video_coding/main/source/test/stream_generator.cc @@ -46,8 +46,8 @@ void StreamGenerator::GenerateFrame(FrameType type, ++sequence_number_; } for (int i = 0; i < num_empty_packets; ++i) { - packets_.push_back(GeneratePacket( - sequence_number_, timestamp, 0, false, false, kFrameEmpty)); + packets_.push_back(GeneratePacket(sequence_number_, timestamp, 0, false, + false, kEmptyFrame)); ++sequence_number_; } } diff --git a/webrtc/modules/video_coding/main/source/video_receiver_unittest.cc b/webrtc/modules/video_coding/main/source/video_receiver_unittest.cc index 1f1996ecdd..16eaed344d 100644 --- a/webrtc/modules/video_coding/main/source/video_receiver_unittest.cc +++ b/webrtc/modules/video_coding/main/source/video_receiver_unittest.cc @@ -88,7 +88,7 @@ TEST_F(TestVideoReceiver, PaddingOnlyFrames) { const uint8_t payload[kPaddingSize] = {0}; WebRtcRTPHeader header; memset(&header, 0, sizeof(header)); - header.frameType = kFrameEmpty; + header.frameType = kEmptyFrame; header.header.markerBit = false; header.header.paddingLength = kPaddingSize; header.header.payloadType = kUnusedPayloadType; @@ -112,7 +112,7 @@ TEST_F(TestVideoReceiver, PaddingOnlyFramesWithLosses) { const uint8_t payload[kFrameSize] = {0}; WebRtcRTPHeader header; memset(&header, 0, sizeof(header)); - header.frameType = kFrameEmpty; + header.frameType = kEmptyFrame; header.header.markerBit = false; header.header.paddingLength = kPaddingSize; header.header.payloadType = kUnusedPayloadType; @@ -127,7 +127,7 @@ TEST_F(TestVideoReceiver, PaddingOnlyFramesWithLosses) { clock_.AdvanceTimeMilliseconds(33); header.header.timestamp += 3000; - header.frameType = kFrameEmpty; + header.frameType = kEmptyFrame; header.type.Video.isFirstPacket = false; header.header.markerBit = false; // Insert padding frames. @@ -163,7 +163,7 @@ TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { const uint8_t payload[kFrameSize] = {0}; WebRtcRTPHeader header; memset(&header, 0, sizeof(header)); - header.frameType = kFrameEmpty; + header.frameType = kEmptyFrame; header.type.Video.isFirstPacket = false; header.header.markerBit = false; header.header.paddingLength = kPaddingSize; @@ -188,7 +188,7 @@ TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { } // Insert 2 padding only frames. - header.frameType = kFrameEmpty; + header.frameType = kEmptyFrame; header.type.Video.isFirstPacket = false; header.header.markerBit = false; for (int j = 0; j < 2; ++j) { diff --git a/webrtc/modules/video_coding/main/source/video_sender.cc b/webrtc/modules/video_coding/main/source/video_sender.cc index a5ef22a46e..8401cb2ac0 100644 --- a/webrtc/modules/video_coding/main/source/video_sender.cc +++ b/webrtc/modules/video_coding/main/source/video_sender.cc @@ -313,7 +313,7 @@ int32_t VideoSender::AddVideoFrame(const VideoFrame& videoFrame, } // TODO(holmer): Add support for dropping frames per stream. Currently we // only have one frame dropper for all streams. - if (_nextFrameTypes[0] == kFrameEmpty) { + if (_nextFrameTypes[0] == kEmptyFrame) { return VCM_OK; } if (_mediaOpt.DropFrame()) { diff --git a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc index 31c7173c6a..13e6b99735 100644 --- a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc +++ b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc @@ -244,7 +244,7 @@ class TestVideoSenderWithMockEncoder : public TestVideoSender { } assert(stream >= 0); assert(stream < kNumberOfStreams); - std::vector<VideoFrameType> frame_types(kNumberOfStreams, kDeltaFrame); + std::vector<FrameType> frame_types(kNumberOfStreams, kDeltaFrame); frame_types[stream] = kKeyFrame; EXPECT_CALL( encoder_, diff --git a/webrtc/test/configurable_frame_size_encoder.cc b/webrtc/test/configurable_frame_size_encoder.cc index ea42e9640c..2dbda38b3d 100644 --- a/webrtc/test/configurable_frame_size_encoder.cc +++ b/webrtc/test/configurable_frame_size_encoder.cc @@ -41,7 +41,7 @@ int32_t ConfigurableFrameSizeEncoder::InitEncode( int32_t ConfigurableFrameSizeEncoder::Encode( const VideoFrame& inputImage, const CodecSpecificInfo* codecSpecificInfo, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { EncodedImage encodedImage( buffer_.get(), current_frame_size_, max_frame_size_); encodedImage._completeFrame = true; diff --git a/webrtc/test/configurable_frame_size_encoder.h b/webrtc/test/configurable_frame_size_encoder.h index ffc095bb33..79514ef6ae 100644 --- a/webrtc/test/configurable_frame_size_encoder.h +++ b/webrtc/test/configurable_frame_size_encoder.h @@ -30,7 +30,7 @@ class ConfigurableFrameSizeEncoder : public VideoEncoder { int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int32_t RegisterEncodeCompleteCallback( EncodedImageCallback* callback) override; diff --git a/webrtc/test/fake_encoder.cc b/webrtc/test/fake_encoder.cc index f85fb9abc1..db7a587596 100644 --- a/webrtc/test/fake_encoder.cc +++ b/webrtc/test/fake_encoder.cc @@ -47,7 +47,7 @@ int32_t FakeEncoder::InitEncode(const VideoCodec* config, int32_t FakeEncoder::Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { assert(config_.maxFramerate > 0); int64_t time_since_last_encode_ms = 1000 / config_.maxFramerate; int64_t time_now_ms = clock_->TimeInMilliseconds(); @@ -189,7 +189,7 @@ DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) int32_t DelayedEncoder::Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { SleepMs(delay_ms_); return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); } diff --git a/webrtc/test/fake_encoder.h b/webrtc/test/fake_encoder.h index 3dce336da6..dc3a1aef50 100644 --- a/webrtc/test/fake_encoder.h +++ b/webrtc/test/fake_encoder.h @@ -33,7 +33,7 @@ class FakeEncoder : public VideoEncoder { size_t max_payload_size) override; int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int32_t RegisterEncodeCompleteCallback( EncodedImageCallback* callback) override; int32_t Release() override; @@ -74,7 +74,7 @@ class DelayedEncoder : public test::FakeEncoder { int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; private: const int delay_ms_; diff --git a/webrtc/video/encoded_frame_callback_adapter.cc b/webrtc/video/encoded_frame_callback_adapter.cc index 6726a37810..407801fd0c 100644 --- a/webrtc/video/encoded_frame_callback_adapter.cc +++ b/webrtc/video/encoded_frame_callback_adapter.cc @@ -27,11 +27,8 @@ int32_t EncodedFrameCallbackAdapter::Encoded( const CodecSpecificInfo* codecSpecificInfo, const RTPFragmentationHeader* fragmentation) { RTC_DCHECK(observer_ != nullptr); - FrameType frame_type = - VCMEncodedFrame::ConvertFrameType(encodedImage._frameType); - const EncodedFrame frame(encodedImage._buffer, - encodedImage._length, - frame_type); + const EncodedFrame frame(encodedImage._buffer, encodedImage._length, + encodedImage._frameType); observer_->EncodedFrameCallback(frame); return 0; } diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc index 01f132ff27..d889290da8 100644 --- a/webrtc/video/end_to_end_tests.cc +++ b/webrtc/video/end_to_end_tests.cc @@ -1589,7 +1589,7 @@ TEST_F(EndToEndTest, ObserversEncodedFrames) { public: EncodedFrameTestObserver() : length_(0), - frame_type_(kFrameEmpty), + frame_type_(kEmptyFrame), called_(EventWrapper::Create()) {} virtual ~EncodedFrameTestObserver() {} @@ -2957,7 +2957,7 @@ TEST_F(EndToEndTest, RespectsNetworkState) { int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { { rtc::CritScope lock(&test_crit_); if (sender_state_ == kNetworkDown) { @@ -3080,7 +3080,7 @@ TEST_F(EndToEndTest, NewSendStreamsRespectNetworkDown) { UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { ADD_FAILURE() << "Unexpected frame encode."; return test::FakeEncoder::Encode( input_image, codec_specific_info, frame_types); diff --git a/webrtc/video/video_encoder.cc b/webrtc/video/video_encoder.cc index 305406b6c0..3e6ce634f8 100644 --- a/webrtc/video/video_encoder.cc +++ b/webrtc/video/video_encoder.cc @@ -99,7 +99,7 @@ int32_t VideoEncoderSoftwareFallbackWrapper::Release() { int32_t VideoEncoderSoftwareFallbackWrapper::Encode( const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) { + const std::vector<FrameType>* frame_types) { if (fallback_encoder_) return fallback_encoder_->Encode(frame, codec_specific_info, frame_types); return encoder_->Encode(frame, codec_specific_info, frame_types); diff --git a/webrtc/video/video_encoder_unittest.cc b/webrtc/video/video_encoder_unittest.cc index be0170cdbe..5f2c37a016 100644 --- a/webrtc/video/video_encoder_unittest.cc +++ b/webrtc/video/video_encoder_unittest.cc @@ -32,7 +32,7 @@ class VideoEncoderSoftwareFallbackWrapperTest : public ::testing::Test { } int32_t Encode(const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { ++encode_count_; return WEBRTC_VIDEO_CODEC_OK; } @@ -120,7 +120,7 @@ void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { memset(frame_.buffer(webrtc::kVPlane), 128, frame_.allocated_size(webrtc::kVPlane)); - std::vector<VideoFrameType> types(1, kKeyFrame); + std::vector<FrameType> types(1, kKeyFrame); EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Encode(frame_, nullptr, &types)); EXPECT_EQ(0, fake_encoder_.encode_count_); @@ -163,7 +163,7 @@ TEST_F(VideoEncoderSoftwareFallbackWrapperTest, EXPECT_EQ(&callback2, fake_encoder_.encode_complete_callback_); // Encoding a frame using the fallback should arrive at the new callback. - std::vector<VideoFrameType> types(1, kKeyFrame); + std::vector<FrameType> types(1, kKeyFrame); frame_.set_timestamp(frame_.timestamp() + 1000); EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Encode(frame_, nullptr, &types)); diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc index e16b670052..e30c903a51 100644 --- a/webrtc/video/video_send_stream_tests.cc +++ b/webrtc/video/video_send_stream_tests.cc @@ -1252,7 +1252,7 @@ TEST_F(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) { int32_t Encode(const VideoFrame& inputImage, const CodecSpecificInfo* codecSpecificInfo, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { EXPECT_TRUE(IsReadyForEncode()); observation_complete_->Set(); @@ -1451,7 +1451,7 @@ class VideoCodecConfigObserver : public test::SendTest, int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { // Silently skip the encode, FakeEncoder::Encode doesn't produce VP8. return 0; } @@ -1742,7 +1742,7 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) { private: int32_t Encode(const VideoFrame& input_image, const CodecSpecificInfo* codecSpecificInfo, - const std::vector<VideoFrameType>* frame_types) override { + const std::vector<FrameType>* frame_types) override { CodecSpecificInfo specifics; memset(&specifics, 0, sizeof(specifics)); specifics.codecType = kVideoCodecGeneric; diff --git a/webrtc/video_encoder.h b/webrtc/video_encoder.h index a512c98917..0858a71b09 100644 --- a/webrtc/video_encoder.h +++ b/webrtc/video_encoder.h @@ -98,7 +98,7 @@ class VideoEncoder { // WEBRTC_VIDEO_CODEC_TIMEOUT virtual int32_t Encode(const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) = 0; + const std::vector<FrameType>* frame_types) = 0; // Inform the encoder of the new packet loss rate and the round-trip time of // the network. @@ -147,7 +147,7 @@ class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { int32_t Release() override; int32_t Encode(const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info, - const std::vector<VideoFrameType>* frame_types) override; + const std::vector<FrameType>* frame_types) override; int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 488923d7e9..cd0646b979 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -251,10 +251,10 @@ class ViEChannel : public VCMFrameTypeCallback, int min_playout_delay_ms, int render_delay_ms); - // Implements VideoFrameTypeCallback. + // Implements FrameTypeCallback. virtual int32_t RequestKeyFrame(); - // Implements VideoFrameTypeCallback. + // Implements FrameTypeCallback. virtual int32_t SliceLossIndicationRequest( const uint64_t picture_id); diff --git a/webrtc/video_engine/vie_encoder.cc b/webrtc/video_engine/vie_encoder.cc index 45e9612358..4d41e0e1ae 100644 --- a/webrtc/video_engine/vie_encoder.cc +++ b/webrtc/video_engine/vie_encoder.cc @@ -558,10 +558,11 @@ int32_t ViEEncoder::SendData( stats_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr); return send_payload_router_->RoutePayload( - VCMEncodedFrame::ConvertFrameType(encoded_image._frameType), payload_type, - encoded_image._timeStamp, encoded_image.capture_time_ms_, - encoded_image._buffer, encoded_image._length, &fragmentation_header, - rtp_video_hdr) ? 0 : -1; + encoded_image._frameType, payload_type, encoded_image._timeStamp, + encoded_image.capture_time_ms_, encoded_image._buffer, + encoded_image._length, &fragmentation_header, rtp_video_hdr) + ? 0 + : -1; } int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, diff --git a/webrtc/video_frame.h b/webrtc/video_frame.h index 3c0ad0c99b..1968a69b0b 100644 --- a/webrtc/video_frame.h +++ b/webrtc/video_frame.h @@ -12,6 +12,7 @@ #define WEBRTC_VIDEO_FRAME_H_ #include "webrtc/base/scoped_ref_ptr.h" +#include "webrtc/common_types.h" #include "webrtc/common_video/interface/video_frame_buffer.h" #include "webrtc/common_video/rotation.h" #include "webrtc/typedefs.h" @@ -166,11 +167,6 @@ class VideoFrame { VideoRotation rotation_; }; -enum VideoFrameType { - kKeyFrame = 0, - kDeltaFrame = 1, -}; - // TODO(pbos): Rename EncodedFrame and reformat this class' members. class EncodedImage { public: @@ -192,8 +188,7 @@ class EncodedImage { // NTP time of the capture time in local timebase in milliseconds. int64_t ntp_time_ms_ = 0; int64_t capture_time_ms_ = 0; - // TODO(pbos): Use webrtc::FrameType directly (and remove VideoFrameType). - VideoFrameType _frameType = kDeltaFrame; + FrameType _frameType = kDeltaFrame; uint8_t* _buffer; size_t _length; size_t _size; |