Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: media/cast/audio_receiver/audio_decoder.h

Issue 74133002: Cast: Removed unnecessary ref counters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/cast/audio_receiver/audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/audio_receiver/audio_decoder.h
diff --git a/media/cast/audio_receiver/audio_decoder.h b/media/cast/audio_receiver/audio_decoder.h
index d7c6a792c13ee8765dcfa68f42f5243c7caf8163..c177f0355e53341292bea906a7b9f5c1d9655f57 100644
--- a/media/cast/audio_receiver/audio_decoder.h
+++ b/media/cast/audio_receiver/audio_decoder.h
@@ -5,8 +5,8 @@
#ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
#define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
+#include "base/atomicops.h"
#include "base/callback.h"
-#include "base/memory/ref_counted.h"
#include "media/cast/cast_config.h"
#include "media/cast/rtp_common/rtp_defines.h"
@@ -18,9 +18,10 @@ namespace media {
namespace cast {
// Thread safe class.
-class AudioDecoder : public base::RefCountedThreadSafe<AudioDecoder> {
+class AudioDecoder {
public:
explicit AudioDecoder(const AudioReceiverConfig& audio_config);
+ virtual ~AudioDecoder();
// Extract a raw audio frame from the decoder.
// Set the number of desired 10ms blocks and frequency.
@@ -37,14 +38,12 @@ class AudioDecoder : public base::RefCountedThreadSafe<AudioDecoder> {
size_t payload_size,
const RtpCastHeader& rtp_header);
- protected:
- virtual ~AudioDecoder();
-
private:
- friend class base::RefCountedThreadSafe<AudioDecoder>;
-
+ // The webrtc AudioCodingModule is threadsafe.
scoped_ptr<webrtc::AudioCodingModule> audio_decoder_;
- bool have_received_packets_;
+ // TODO(pwestin): Refactor to avoid this. Call IncomingParsedRtpPacket from
+ // audio decoder thread that way this class does not have to be thread safe.
+ base::subtle::Atomic32 have_received_packets_;
Alpha Left Google 2013/11/18 22:01:14 Is there a difference in terms of performance usin
pwestin 2013/11/22 19:16:29 I doubt there is a measurable difference for this
DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
};
« no previous file with comments | « no previous file | media/cast/audio_receiver/audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698