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

Side by Side Diff: content/renderer/media/android/media_source_delegate.cc

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 years, 5 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 | « no previous file | media/audio/win/audio_low_latency_output_win_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/android/media_source_delegate.h" 5 #include "content/renderer/media/android/media_source_delegate.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "content/renderer/media/android/webmediaplayer_proxy_android.h" 9 #include "content/renderer/media/android/webmediaplayer_proxy_android.h"
10 #include "content/renderer/media/webmediaplayer_util.h" 10 #include "content/renderer/media/webmediaplayer_util.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 gfx::Size size = video_stream_->video_decoder_config().coded_size(); 299 gfx::Size size = video_stream_->video_decoder_config().coded_size();
300 DVLOG(1) << "Video config is changed: " << size.width() << "x" 300 DVLOG(1) << "Video config is changed: " << size.width() << "x"
301 << size.height(); 301 << size.height();
302 } 302 }
303 params->access_units[index].status = status; 303 params->access_units[index].status = status;
304 params->access_units.resize(index + 1); 304 params->access_units.resize(index + 1);
305 break; 305 break;
306 306
307 case DemuxerStream::kOk: 307 case DemuxerStream::kOk:
308 params->access_units[index].status = status; 308 params->access_units[index].status = status;
309 if (buffer->IsEndOfStream()) { 309 if (buffer->end_of_stream()) {
310 params->access_units[index].end_of_stream = true; 310 params->access_units[index].end_of_stream = true;
311 params->access_units.resize(index + 1); 311 params->access_units.resize(index + 1);
312 break; 312 break;
313 } 313 }
314 // TODO(ycheo): We assume that the inputed stream will be decoded 314 // TODO(ycheo): We assume that the inputed stream will be decoded
315 // right away. 315 // right away.
316 // Need to implement this properly using MediaPlayer.OnInfoListener. 316 // Need to implement this properly using MediaPlayer.OnInfoListener.
317 if (is_audio) { 317 if (is_audio) {
318 statistics_.audio_bytes_decoded += buffer->GetDataSize(); 318 statistics_.audio_bytes_decoded += buffer->data_size();
319 } else { 319 } else {
320 statistics_.video_bytes_decoded += buffer->GetDataSize(); 320 statistics_.video_bytes_decoded += buffer->data_size();
321 statistics_.video_frames_decoded++; 321 statistics_.video_frames_decoded++;
322 } 322 }
323 params->access_units[index].timestamp = buffer->GetTimestamp(); 323 params->access_units[index].timestamp = buffer->timestamp();
324 params->access_units[index].data = std::vector<uint8>( 324 params->access_units[index].data = std::vector<uint8>(
325 buffer->GetData(), 325 buffer->data(),
326 buffer->GetData() + buffer->GetDataSize()); 326 buffer->data() + buffer->data_size());
327 #if !defined(GOOGLE_TV) 327 #if !defined(GOOGLE_TV)
328 // Vorbis needs 4 extra bytes padding on Android. Check 328 // Vorbis needs 4 extra bytes padding on Android. Check
329 // NuMediaExtractor.cpp in Android source code. 329 // NuMediaExtractor.cpp in Android source code.
330 if (is_audio && media::kCodecVorbis == 330 if (is_audio && media::kCodecVorbis ==
331 audio_stream_->audio_decoder_config().codec()) { 331 audio_stream_->audio_decoder_config().codec()) {
332 params->access_units[index].data.insert( 332 params->access_units[index].data.insert(
333 params->access_units[index].data.end(), kVorbisPadding, 333 params->access_units[index].data.end(), kVorbisPadding,
334 kVorbisPadding + 4); 334 kVorbisPadding + 4);
335 } 335 }
336 #endif 336 #endif
337 if (buffer->GetDecryptConfig()) { 337 if (buffer->decrypt_config()) {
338 params->access_units[index].key_id = std::vector<char>( 338 params->access_units[index].key_id = std::vector<char>(
339 buffer->GetDecryptConfig()->key_id().begin(), 339 buffer->decrypt_config()->key_id().begin(),
340 buffer->GetDecryptConfig()->key_id().end()); 340 buffer->decrypt_config()->key_id().end());
341 params->access_units[index].iv = std::vector<char>( 341 params->access_units[index].iv = std::vector<char>(
342 buffer->GetDecryptConfig()->iv().begin(), 342 buffer->decrypt_config()->iv().begin(),
343 buffer->GetDecryptConfig()->iv().end()); 343 buffer->decrypt_config()->iv().end());
344 params->access_units[index].subsamples = 344 params->access_units[index].subsamples =
345 buffer->GetDecryptConfig()->subsamples(); 345 buffer->decrypt_config()->subsamples();
346 } 346 }
347 if (++index < params->access_units.size()) { 347 if (++index < params->access_units.size()) {
348 ReadFromDemuxerStream(type, params, index); 348 ReadFromDemuxerStream(type, params, index);
349 return; 349 return;
350 } 350 }
351 break; 351 break;
352 352
353 default: 353 default:
354 NOTREACHED(); 354 NOTREACHED();
355 } 355 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 621 }
622 622
623 bool MediaSourceDelegate::HasEncryptedStream() { 623 bool MediaSourceDelegate::HasEncryptedStream() {
624 return (audio_stream_ && 624 return (audio_stream_ &&
625 audio_stream_->audio_decoder_config().is_encrypted()) || 625 audio_stream_->audio_decoder_config().is_encrypted()) ||
626 (video_stream_ && 626 (video_stream_ &&
627 video_stream_->video_decoder_config().is_encrypted()); 627 video_stream_->video_decoder_config().is_encrypted());
628 } 628 }
629 629
630 } // namespace content 630 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/win/audio_low_latency_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698