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

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 2732063005: Revert of Remove a scoped_refptr<>::swap overload (Closed)
Patch Set: Created 3 years, 9 months 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 | « base/memory/ref_counted.h ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_audio_decoder.cc
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 06233eaa7d141c033ac0c80a7574defee61d04ba..e3560ff1b8bcf9d359f2a7c0ab06147b8e6b4e3f 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -45,8 +45,8 @@
// Called by FFmpeg's allocation routine to free a buffer. |opaque| is the
// AudioBuffer allocated, so unref it.
static void ReleaseAudioBufferImpl(void* opaque, uint8_t* data) {
- if (opaque)
- static_cast<AudioBuffer*>(opaque)->Release();
+ scoped_refptr<AudioBuffer> buffer;
+ buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque));
}
// Called by FFmpeg's allocation routine to allocate a buffer. Uses
@@ -124,8 +124,8 @@
// Now create an AVBufferRef for the data just allocated. It will own the
// reference to the AudioBuffer object.
- AudioBuffer* opaque = buffer.get();
- opaque->AddRef();
+ void* opaque = NULL;
+ buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque));
frame->buf[0] = av_buffer_create(
frame->data[0], buffer_size_in_bytes, ReleaseAudioBufferImpl, opaque, 0);
return 0;
« no previous file with comments | « base/memory/ref_counted.h ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698