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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Called by FFmpeg's allocation routine to free a buffer. |opaque| is the 55 // Called by FFmpeg's allocation routine to free a buffer. |opaque| is the
56 // AudioBuffer allocated, so unref it. 56 // AudioBuffer allocated, so unref it.
57 static void ReleaseAudioBufferImpl(void* opaque, uint8_t* data) { 57 static void ReleaseAudioBufferImpl(void* opaque, uint8_t* data) {
58 if (opaque) 58 if (opaque)
59 static_cast<AudioBuffer*>(opaque)->Release(); 59 static_cast<AudioBuffer*>(opaque)->Release();
60 } 60 }
61 61
62 FFmpegAudioDecoder::FFmpegAudioDecoder( 62 FFmpegAudioDecoder::FFmpegAudioDecoder(
63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
64 const scoped_refptr<MediaLog>& media_log) 64 MediaLog* media_log)
65 : task_runner_(task_runner), 65 : task_runner_(task_runner),
66 state_(kUninitialized), 66 state_(kUninitialized),
67 av_sample_format_(0), 67 av_sample_format_(0),
68 media_log_(media_log), 68 media_log_(media_log),
69 pool_(new AudioBufferMemoryPool()) {} 69 pool_(new AudioBufferMemoryPool()) {}
70 70
71 FFmpegAudioDecoder::~FFmpegAudioDecoder() { 71 FFmpegAudioDecoder::~FFmpegAudioDecoder() {
72 DCHECK(task_runner_->BelongsToCurrentThread()); 72 DCHECK(task_runner_->BelongsToCurrentThread());
73 73
74 if (state_ != kUninitialized) 74 if (state_ != kUninitialized)
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // Now create an AVBufferRef for the data just allocated. It will own the 450 // Now create an AVBufferRef for the data just allocated. It will own the
451 // reference to the AudioBuffer object. 451 // reference to the AudioBuffer object.
452 AudioBuffer* opaque = buffer.get(); 452 AudioBuffer* opaque = buffer.get();
453 opaque->AddRef(); 453 opaque->AddRef();
454 frame->buf[0] = av_buffer_create(frame->data[0], buffer_size_in_bytes, 454 frame->buf[0] = av_buffer_create(frame->data[0], buffer_size_in_bytes,
455 ReleaseAudioBufferImpl, opaque, 0); 455 ReleaseAudioBufferImpl, opaque, 0);
456 return 0; 456 return 0;
457 } 457 }
458 458
459 } // namespace media 459 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698