| OLD | NEW |
| 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/decrypting_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "media/base/bind_to_current_loop.h" | 12 #include "media/base/bind_to_current_loop.h" |
| 13 #include "media/base/decoder_buffer.h" | 13 #include "media/base/decoder_buffer.h" |
| 14 #include "media/base/encryption_scheme.h" |
| 14 #include "media/base/media_log.h" | 15 #include "media/base/media_log.h" |
| 15 #include "media/base/pipeline.h" | 16 #include "media/base/pipeline.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 | 19 |
| 19 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { | 20 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { |
| 20 return ((stream->type() == DemuxerStream::AUDIO && | 21 return ((stream->type() == DemuxerStream::AUDIO && |
| 21 stream->audio_decoder_config().IsValidConfig() && | 22 stream->audio_decoder_config().IsValidConfig() && |
| 22 stream->audio_decoder_config().is_encrypted()) || | 23 stream->audio_decoder_config().is_encrypted()) || |
| 23 (stream->type() == DemuxerStream::VIDEO && | 24 (stream->type() == DemuxerStream::VIDEO && |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 372 |
| 372 void DecryptingDemuxerStream::InitializeDecoderConfig() { | 373 void DecryptingDemuxerStream::InitializeDecoderConfig() { |
| 373 // The decoder selector or upstream demuxer make sure the stream is valid and | 374 // The decoder selector or upstream demuxer make sure the stream is valid and |
| 374 // potentially encrypted. | 375 // potentially encrypted. |
| 375 DCHECK(IsStreamValidAndEncrypted(demuxer_stream_)); | 376 DCHECK(IsStreamValidAndEncrypted(demuxer_stream_)); |
| 376 | 377 |
| 377 switch (demuxer_stream_->type()) { | 378 switch (demuxer_stream_->type()) { |
| 378 case AUDIO: { | 379 case AUDIO: { |
| 379 AudioDecoderConfig input_audio_config = | 380 AudioDecoderConfig input_audio_config = |
| 380 demuxer_stream_->audio_decoder_config(); | 381 demuxer_stream_->audio_decoder_config(); |
| 381 audio_config_.Initialize(input_audio_config.codec(), | 382 audio_config_.Initialize( |
| 382 input_audio_config.sample_format(), | 383 input_audio_config.codec(), input_audio_config.sample_format(), |
| 383 input_audio_config.channel_layout(), | 384 input_audio_config.channel_layout(), |
| 384 input_audio_config.samples_per_second(), | 385 input_audio_config.samples_per_second(), |
| 385 input_audio_config.extra_data(), | 386 input_audio_config.extra_data(), EncryptionScheme(false), |
| 386 false, // Output audio is not encrypted. | 387 input_audio_config.seek_preroll(), input_audio_config.codec_delay()); |
| 387 input_audio_config.seek_preroll(), | |
| 388 input_audio_config.codec_delay()); | |
| 389 break; | 388 break; |
| 390 } | 389 } |
| 391 | 390 |
| 392 case VIDEO: { | 391 case VIDEO: { |
| 393 VideoDecoderConfig input_video_config = | 392 VideoDecoderConfig input_video_config = |
| 394 demuxer_stream_->video_decoder_config(); | 393 demuxer_stream_->video_decoder_config(); |
| 395 video_config_.Initialize( | 394 video_config_.Initialize( |
| 396 input_video_config.codec(), input_video_config.profile(), | 395 input_video_config.codec(), input_video_config.profile(), |
| 397 input_video_config.format(), input_video_config.color_space(), | 396 input_video_config.format(), input_video_config.color_space(), |
| 398 input_video_config.coded_size(), input_video_config.visible_rect(), | 397 input_video_config.coded_size(), input_video_config.visible_rect(), |
| 399 input_video_config.natural_size(), input_video_config.extra_data(), | 398 input_video_config.natural_size(), input_video_config.extra_data(), |
| 400 false); // Output video is not encrypted. | 399 EncryptionScheme(false)); |
| 401 break; | 400 break; |
| 402 } | 401 } |
| 403 | 402 |
| 404 default: | 403 default: |
| 405 NOTREACHED(); | 404 NOTREACHED(); |
| 406 return; | 405 return; |
| 407 } | 406 } |
| 408 } | 407 } |
| 409 | 408 |
| 410 } // namespace media | 409 } // namespace media |
| OLD | NEW |