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

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

Issue 1834303005: Refactor audio and video decoder status into common file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 106 static interfaces::AudioDecoder::DecodeStatus ConvertDecodeStatus(
107 media::AudioDecoder::Status status) { 107 media::DecodeStatus status) {
108 switch (status) { 108 switch (status) {
109 case media::AudioDecoder::kOk: 109 case media::DecodeStatus::OK:
110 return interfaces::AudioDecoder::DecodeStatus::OK; 110 return interfaces::AudioDecoder::DecodeStatus::OK;
111 case media::AudioDecoder::kAborted: 111 case media::DecodeStatus::ABORTED:
112 return interfaces::AudioDecoder::DecodeStatus::ABORTED; 112 return interfaces::AudioDecoder::DecodeStatus::ABORTED;
113 case media::AudioDecoder::kDecodeError: 113 case media::DecodeStatus::DECODE_ERROR:
114 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; 114 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR;
115 } 115 }
116 NOTREACHED(); 116 NOTREACHED();
117 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; 117 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR;
118 } 118 }
119 119
120 void MojoAudioDecoderService::OnDecodeStatus( 120 void MojoAudioDecoderService::OnDecodeStatus(const DecodeCallback& callback,
121 const DecodeCallback& callback, 121 media::DecodeStatus status) {
122 media::AudioDecoder::Status status) {
123 DVLOG(3) << __FUNCTION__ << " status:" << status; 122 DVLOG(3) << __FUNCTION__ << " status:" << status;
124 callback.Run(ConvertDecodeStatus(status)); 123 callback.Run(ConvertDecodeStatus(status));
125 } 124 }
126 125
127 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) { 126 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) {
128 DVLOG(1) << __FUNCTION__; 127 DVLOG(1) << __FUNCTION__;
129 callback.Run(); 128 callback.Run();
130 } 129 }
131 130
132 void MojoAudioDecoderService::OnAudioBufferReady( 131 void MojoAudioDecoderService::OnAudioBufferReady(
(...skipping 26 matching lines...) Expand all
159 uint32_t bytes_read = bytes_to_read; 158 uint32_t bytes_read = bytes_to_read;
160 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), 159 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(),
161 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE), 160 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE),
162 MOJO_RESULT_OK); 161 MOJO_RESULT_OK);
163 CHECK_EQ(bytes_to_read, bytes_read); 162 CHECK_EQ(bytes_to_read, bytes_read);
164 163
165 return media_buffer; 164 return media_buffer;
166 } 165 }
167 166
168 } // namespace media 167 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_audio_decoder_service.h ('k') | media/mojo/services/mojo_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698