Fix locking in RTPFile class
This code used to have a reader-writer lock, and call std::queue::pop() with only a reader lock, which appears unsafe. Code changed to use a plain webrtc::Mutex. Bug: webrtc:12102 Change-Id: Icbea17a824c91975dfebd4d05bbd0c21e1abeadc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190700 Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32511}
This commit is contained in:
@ -16,7 +16,8 @@
|
||||
#include <queue>
|
||||
|
||||
#include "api/rtp_headers.h"
|
||||
#include "rtc_base/synchronization/rw_lock_wrapper.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -70,9 +71,9 @@ class RTPPacket {
|
||||
|
||||
class RTPBuffer : public RTPStream {
|
||||
public:
|
||||
RTPBuffer();
|
||||
RTPBuffer() = default;
|
||||
|
||||
~RTPBuffer();
|
||||
~RTPBuffer() = default;
|
||||
|
||||
void Write(const uint8_t payloadType,
|
||||
const uint32_t timeStamp,
|
||||
@ -89,8 +90,8 @@ class RTPBuffer : public RTPStream {
|
||||
bool EndOfFile() const override;
|
||||
|
||||
private:
|
||||
RWLockWrapper* _queueRWLock;
|
||||
std::queue<RTPPacket*> _rtpQueue;
|
||||
mutable Mutex mutex_;
|
||||
std::queue<RTPPacket*> _rtpQueue RTC_GUARDED_BY(&mutex_);
|
||||
};
|
||||
|
||||
class RTPFile : public RTPStream {
|
||||
|
||||
Reference in New Issue
Block a user