Updates to VCMDecodedFrameCallback, VideoReceiver and a few related classes/tests.
* The _receiveCallback member of VCMDecodedFrameCallback does actually not require locking now that the threading model is slightly clearer. Documentation and checks have been added.
* UserReceiveCallback() never returns null and must always be called on the decoder thread. Checks have been added and the two test suites that were failing to set this callback, have been fixed and a new mock class added. (looks like sakal@ may have hit some issues with flaky tests there).
* Changed VcmPayloadSink to use move semantics which I suspect was the intention at the time the code was written (when we didn't have move semantics).
* Added thread checker to a couple of classes and started adding thread checks for known behavior. There's more to be done there.
* Remove the |_decoder| member variable in VideoReceiver. It is not needed and as it could be used, left us open to a race.
* TODOs added for places where we can reduce locking. I suspect that we can get away with not needing a lock around _codecDataBase in VideoReceiver once we've got a clear picture of the threading model and ensured that all adhere to it.
BUG=webrtc:7328
Review-Url: https://codereview.webrtc.org/2744013002
Cr-Commit-Position: refs/heads/master@{#17226}
diff --git a/webrtc/modules/video_coding/video_receiver_unittest.cc b/webrtc/modules/video_coding/video_receiver_unittest.cc
index 9cac45b..3e4d324 100644
--- a/webrtc/modules/video_coding/video_receiver_unittest.cc
+++ b/webrtc/modules/video_coding/video_receiver_unittest.cc
@@ -21,6 +21,7 @@
#include "webrtc/test/gtest.h"
using ::testing::_;
+using ::testing::AnyNumber;
using ::testing::NiceMock;
namespace webrtc {
@@ -45,6 +46,13 @@
VideoCodingModule::Codec(kVideoCodecVP8, &settings_);
settings_.plType = kUnusedPayloadType; // Use the mocked encoder.
EXPECT_EQ(0, receiver_->RegisterReceiveCodec(&settings_, 1, true));
+
+ // Since we call Decode, we need to provide a valid receive callback.
+ // However, for the purposes of these tests, we ignore the callbacks.
+ EXPECT_CALL(receive_callback_, OnIncomingPayloadType(_)).Times(AnyNumber());
+ EXPECT_CALL(receive_callback_, OnDecoderImplementationName(_))
+ .Times(AnyNumber());
+ receiver_->RegisterReceiveCallback(&receive_callback_);
}
void InsertAndVerifyPaddingFrame(const uint8_t* payload,
@@ -79,6 +87,7 @@
NiceMock<MockPacketRequestCallback> packet_request_callback_;
std::unique_ptr<VCMTiming> timing_;
+ MockVCMReceiveCallback receive_callback_;
std::unique_ptr<VideoReceiver> receiver_;
};