Revert "VCMGenericDecoder threading updates for all but Android."

This reverts commit a4e71b9e7e59be21b98d63cf8cb676096d9c74b0.

Reason for revert: Breaking internal project

Original change's description:
> VCMGenericDecoder threading updates for all but Android.
> 
> * All methods now have thread checks.
> * Variable access associated with thread checkers.
> * Remove need for |rtc::CriticalSection lock_|
> 
> Since the android decoder is inherently asynchronous, and
> FrameBuffer2's decoder doesn't support posting tasks to it
> yet (for async decode completion), we need to tackle android
> separately. Once FrameBuffer2 gets changed to use a TaskQueue
> or ProcessThread, we can move Android over to delivering decoded
> frames on the right thread/queue and delete generic_decoder_android.*.
> 
> Note: This is a subset of code that was previously reviewed here:
>   - https://codereview.webrtc.org/2764573002/
> 
> Bug: webrtc:7361, webrtc:8907, chromium:695438
> Change-Id: I118609dfa5c0f0180287d8c2b6d62987b7473c5c
> Reviewed-on: https://webrtc-review.googlesource.com/55060
> Commit-Queue: Tommi <tommi@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22119}

TBR=sakal@webrtc.org,tommi@webrtc.org

Change-Id: I3afe4671f9d06bb4a2b17e4f14c21d79f773e067
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7361, webrtc:8907, chromium:695438
Reviewed-on: https://webrtc-review.googlesource.com/56282
Reviewed-by: Lu Liu <lliuu@webrtc.org>
Commit-Queue: Lu Liu <lliuu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22143}
This commit is contained in:
Lu Liu
2018-02-21 19:38:59 +00:00
committed by Commit Bot
parent 54daa3ac4d
commit 352314adb8
5 changed files with 52 additions and 463 deletions

View File

@ -18,11 +18,9 @@
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/timestamp_map.h"
#include "modules/video_coding/timing.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/thread_checker.h"
#if defined(WEBRTC_ANDROID)
#include "modules/video_coding/generic_decoder_android.h" // NOLINT
#else
namespace webrtc {
class VCMReceiveCallback;
@ -42,7 +40,6 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
public:
VCMDecodedFrameCallback(VCMTiming* timing, Clock* clock);
~VCMDecodedFrameCallback() override;
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
VCMReceiveCallback* UserReceiveCallback();
@ -62,7 +59,7 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
private:
rtc::ThreadChecker construction_thread_;
rtc::ThreadChecker decoder_thread_;
// Protect |_timestampMap|.
Clock* const _clock;
// This callback must be set before the decoder thread starts running
// and must only be unset when external threads (e.g decoder thread)
@ -70,9 +67,10 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
// while there are more than one threads involved, it must be set
// from the same thread, and therfore a lock is not required to access it.
VCMReceiveCallback* _receiveCallback = nullptr;
VCMTiming* _timing RTC_GUARDED_BY(decoder_thread_);
VCMTimestampMap _timestampMap RTC_GUARDED_BY(decoder_thread_);
uint64_t _lastReceivedPictureID RTC_GUARDED_BY(decoder_thread_);
VCMTiming* _timing;
rtc::CriticalSection lock_;
VCMTimestampMap _timestampMap RTC_GUARDED_BY(lock_);
uint64_t _lastReceivedPictureID;
int64_t ntp_offset_;
};
@ -99,24 +97,22 @@ class VCMGenericDecoder {
*/
int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback);
bool External() const;
bool PrefersLateDecoding() const;
bool IsSameDecoder(VideoDecoder* decoder) const {
return decoder_.get() == decoder;
}
private:
rtc::ThreadChecker decoder_thread_;
VCMDecodedFrameCallback* _callback RTC_GUARDED_BY(decoder_thread_);
VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength] RTC_GUARDED_BY(
decoder_thread_);
uint32_t _nextFrameInfoIdx RTC_GUARDED_BY(decoder_thread_);
VCMDecodedFrameCallback* _callback;
VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
uint32_t _nextFrameInfoIdx;
std::unique_ptr<VideoDecoder> decoder_;
VideoCodecType _codecType RTC_GUARDED_BY(decoder_thread_);
VideoCodecType _codecType;
const bool _isExternal;
VideoContentType _last_keyframe_content_type;
};
} // namespace webrtc
#endif // defined(WEBRTC_ANDROID)
#endif // MODULES_VIDEO_CODING_GENERIC_DECODER_H_