Migrate modules/video_coding to webrtc::Mutex.

Bug: webrtc:11567
Change-Id: I8023fbe7595f7ba8ae7c7db3583fc2e560ec3df2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178803
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31644}
This commit is contained in:
Markus Handell
2020-07-07 12:17:12 +02:00
committed by Commit Bot
parent fb6f975401
commit 6deec38ede
23 changed files with 190 additions and 191 deletions

View File

@ -21,7 +21,7 @@
#include "api/video_codecs/video_encoder_factory.h"
#include "modules/video_coding/codecs/multiplex/multiplex_encoded_image_packer.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/synchronization/mutex.h"
namespace webrtc {
@ -71,7 +71,7 @@ class MultiplexEncoderAdapter : public VideoEncoder {
EncodedImageCallback* encoded_complete_callback_;
std::map<uint32_t /* timestamp */, MultiplexImage> stashed_images_
RTC_GUARDED_BY(crit_);
RTC_GUARDED_BY(mutex_);
uint16_t picture_index_ = 0;
std::vector<uint8_t> multiplex_dummy_planes_;
@ -79,7 +79,7 @@ class MultiplexEncoderAdapter : public VideoEncoder {
int key_frame_interval_;
EncodedImage combined_image_;
rtc::CriticalSection crit_;
Mutex mutex_;
const bool supports_augmented_data_;
int augmenting_data_size_ = 0;

View File

@ -180,7 +180,7 @@ int MultiplexEncoderAdapter::Encode(
}
{
rtc::CritScope cs(&crit_);
MutexLock lock(&mutex_);
stashed_images_.emplace(
std::piecewise_construct,
std::forward_as_tuple(input_image.timestamp()),
@ -273,7 +273,7 @@ int MultiplexEncoderAdapter::Release() {
}
encoders_.clear();
adapter_callbacks_.clear();
rtc::CritScope cs(&crit_);
MutexLock lock(&mutex_);
stashed_images_.clear();
return WEBRTC_VIDEO_CODEC_OK;
@ -298,7 +298,7 @@ EncodedImageCallback::Result MultiplexEncoderAdapter::OnEncodedImage(
// If we don't already own the buffer, make a copy.
image_component.encoded_image.Retain();
rtc::CritScope cs(&crit_);
MutexLock lock(&mutex_);
const auto& stashed_image_itr =
stashed_images_.find(encodedImage.Timestamp());
const auto& stashed_image_next_itr = std::next(stashed_image_itr, 1);