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

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

Issue 1899363002: Finish plumbing MojoVideoDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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_service.h" 5 #include "media/mojo/services/mojo_audio_decoder_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/cdm_context.h" 10 #include "media/base/cdm_context.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 if (success) { 97 if (success) {
98 cdm_ = cdm; 98 cdm_ = cdm;
99 callback.Run(success, decoder_->NeedsBitstreamConversion()); 99 callback.Run(success, decoder_->NeedsBitstreamConversion());
100 } else { 100 } else {
101 // Do not call decoder_->NeedsBitstreamConversion() if init failed. 101 // Do not call decoder_->NeedsBitstreamConversion() if init failed.
102 callback.Run(false, false); 102 callback.Run(false, false);
103 } 103 }
104 } 104 }
105 105
106 static interfaces::AudioDecoder::DecodeStatus ConvertDecodeStatus(
107 media::DecodeStatus status) {
108 switch (status) {
109 case media::DecodeStatus::OK:
110 return interfaces::AudioDecoder::DecodeStatus::OK;
111 case media::DecodeStatus::ABORTED:
112 return interfaces::AudioDecoder::DecodeStatus::ABORTED;
113 case media::DecodeStatus::DECODE_ERROR:
114 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR;
115 }
116 NOTREACHED();
117 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR;
118 }
119
120 void MojoAudioDecoderService::OnDecodeStatus(const DecodeCallback& callback, 106 void MojoAudioDecoderService::OnDecodeStatus(const DecodeCallback& callback,
121 media::DecodeStatus status) { 107 media::DecodeStatus status) {
122 DVLOG(3) << __FUNCTION__ << " status:" << status; 108 DVLOG(3) << __FUNCTION__ << " status:" << status;
123 callback.Run(ConvertDecodeStatus(status)); 109 callback.Run(static_cast<interfaces::DecodeStatus>(status));
124 } 110 }
125 111
126 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) { 112 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) {
127 DVLOG(1) << __FUNCTION__; 113 DVLOG(1) << __FUNCTION__;
128 callback.Run(); 114 callback.Run();
129 } 115 }
130 116
131 void MojoAudioDecoderService::OnAudioBufferReady( 117 void MojoAudioDecoderService::OnAudioBufferReady(
132 const scoped_refptr<AudioBuffer>& audio_buffer) { 118 const scoped_refptr<AudioBuffer>& audio_buffer) {
133 DVLOG(1) << __FUNCTION__; 119 DVLOG(1) << __FUNCTION__;
(...skipping 24 matching lines...) Expand all
158 uint32_t bytes_read = bytes_to_read; 144 uint32_t bytes_read = bytes_to_read;
159 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), 145 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(),
160 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE), 146 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE),
161 MOJO_RESULT_OK); 147 MOJO_RESULT_OK);
162 CHECK_EQ(bytes_to_read, bytes_read); 148 CHECK_EQ(bytes_to_read, bytes_read);
163 149
164 return media_buffer; 150 return media_buffer;
165 } 151 }
166 152
167 } // namespace media 153 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698