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

Side by Side Diff: media/mojo/services/mojo_audio_decoder.cc

Issue 1797393007: Connect MojoAudioDecoder to the service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « media/mojo/services/mojo_audio_decoder.h ('k') | media/mojo/services/mojo_decoder_factory.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mojo/services/mojo_audio_decoder.h" 5 #include "media/mojo/services/mojo_audio_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 MojoAudioDecoder::MojoAudioDecoder() { 15 MojoAudioDecoder::MojoAudioDecoder(
16 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
17 interfaces::AudioDecoderPtr remote_decoder)
18 : task_runner_(task_runner), remote_decoder_(std::move(remote_decoder)) {
16 DVLOG(1) << __FUNCTION__; 19 DVLOG(1) << __FUNCTION__;
17 } 20 }
18 21
19 MojoAudioDecoder::~MojoAudioDecoder() { 22 MojoAudioDecoder::~MojoAudioDecoder() {
20 DVLOG(1) << __FUNCTION__; 23 DVLOG(1) << __FUNCTION__;
21 } 24 }
22 25
23 std::string MojoAudioDecoder::GetDisplayName() const { 26 std::string MojoAudioDecoder::GetDisplayName() const {
24 return "MojoAudioDecoder"; 27 return "MojoAudioDecoder";
25 } 28 }
26 29
27 void MojoAudioDecoder::Initialize(const AudioDecoderConfig& config, 30 void MojoAudioDecoder::Initialize(const AudioDecoderConfig& config,
28 CdmContext* cdm_context, 31 CdmContext* cdm_context,
29 const InitCB& init_cb, 32 const InitCB& init_cb,
30 const OutputCB& output_cb) { 33 const OutputCB& output_cb) {
31 DVLOG(1) << __FUNCTION__; 34 DVLOG(1) << __FUNCTION__;
32 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 35 task_runner_ = base::ThreadTaskRunnerHandle::Get();
sandersd (OOO until July 31) 2016/03/17 20:24:07 The task_runner_ is discarded here. If this works
xhwang 2016/03/17 20:26:25 Good catch. This seems a bug. We should probably a
xhwang 2016/03/17 20:27:26 Also, this class should be single threaded. We sho
Tima Vaisburd 2016/03/17 20:31:24 This is a bug, thank you. I meant to use the task_
Tima Vaisburd 2016/03/17 20:39:57 Done.
Tima Vaisburd 2016/03/17 20:39:58 Done.
xhwang 2016/03/17 20:48:11 Yes, that's the media task runner we have. All our
33 36
34 NOTIMPLEMENTED(); 37 NOTIMPLEMENTED();
35 38
36 // Pretend to be able to decode anything. 39 // Pretend to be able to decode anything.
37 task_runner_->PostTask(FROM_HERE, base::Bind(init_cb, true)); 40 task_runner_->PostTask(FROM_HERE, base::Bind(init_cb, true));
38 } 41 }
39 42
40 void MojoAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, 43 void MojoAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
41 const DecodeCB& decode_cb) { 44 const DecodeCB& decode_cb) {
42 DVLOG(3) << __FUNCTION__; 45 DVLOG(3) << __FUNCTION__;
43 NOTIMPLEMENTED(); 46 NOTIMPLEMENTED();
44 47
45 // Actually we can't decode anything. 48 // Actually we can't decode anything.
46 task_runner_->PostTask(FROM_HERE, base::Bind(decode_cb, kDecodeError)); 49 task_runner_->PostTask(FROM_HERE, base::Bind(decode_cb, kDecodeError));
47 } 50 }
48 51
49 void MojoAudioDecoder::Reset(const base::Closure& closure) { 52 void MojoAudioDecoder::Reset(const base::Closure& closure) {
50 DVLOG(2) << __FUNCTION__; 53 DVLOG(2) << __FUNCTION__;
51 NOTIMPLEMENTED(); 54 NOTIMPLEMENTED();
52 } 55 }
53 56
54 bool MojoAudioDecoder::NeedsBitstreamConversion() const { 57 bool MojoAudioDecoder::NeedsBitstreamConversion() const {
55 DVLOG(1) << __FUNCTION__; 58 DVLOG(1) << __FUNCTION__;
56 NOTIMPLEMENTED(); 59 NOTIMPLEMENTED();
57 return false; 60 return false;
58 } 61 }
59 62
60 } // namespace media 63 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_audio_decoder.h ('k') | media/mojo/services/mojo_decoder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698