| 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/media_log.h" | 14 #include "media/base/media_log.h" |
| 15 #include "media/base/media_util.h" | |
| 16 | 15 |
| 17 namespace media { | 16 namespace media { |
| 18 | 17 |
| 19 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { | 18 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { |
| 20 return ((stream->type() == DemuxerStream::AUDIO && | 19 return ((stream->type() == DemuxerStream::AUDIO && |
| 21 stream->audio_decoder_config().IsValidConfig() && | 20 stream->audio_decoder_config().IsValidConfig() && |
| 22 stream->audio_decoder_config().is_encrypted()) || | 21 stream->audio_decoder_config().is_encrypted()) || |
| 23 (stream->type() == DemuxerStream::VIDEO && | 22 (stream->type() == DemuxerStream::VIDEO && |
| 24 stream->video_decoder_config().IsValidConfig() && | 23 stream->video_decoder_config().IsValidConfig() && |
| 25 stream->video_decoder_config().is_encrypted())); | 24 stream->video_decoder_config().is_encrypted())); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 340 |
| 342 void DecryptingDemuxerStream::InitializeDecoderConfig() { | 341 void DecryptingDemuxerStream::InitializeDecoderConfig() { |
| 343 // The decoder selector or upstream demuxer make sure the stream is valid and | 342 // The decoder selector or upstream demuxer make sure the stream is valid and |
| 344 // potentially encrypted. | 343 // potentially encrypted. |
| 345 DCHECK(IsStreamValidAndEncrypted(demuxer_stream_)); | 344 DCHECK(IsStreamValidAndEncrypted(demuxer_stream_)); |
| 346 | 345 |
| 347 switch (demuxer_stream_->type()) { | 346 switch (demuxer_stream_->type()) { |
| 348 case AUDIO: { | 347 case AUDIO: { |
| 349 AudioDecoderConfig input_audio_config = | 348 AudioDecoderConfig input_audio_config = |
| 350 demuxer_stream_->audio_decoder_config(); | 349 demuxer_stream_->audio_decoder_config(); |
| 351 audio_config_.Initialize( | 350 audio_config_.Initialize(input_audio_config.codec(), |
| 352 input_audio_config.codec(), input_audio_config.sample_format(), | 351 input_audio_config.sample_format(), |
| 353 input_audio_config.channel_layout(), | 352 input_audio_config.channel_layout(), |
| 354 input_audio_config.samples_per_second(), | 353 input_audio_config.samples_per_second(), |
| 355 input_audio_config.extra_data(), Unencrypted(), | 354 input_audio_config.extra_data(), |
| 356 input_audio_config.seek_preroll(), input_audio_config.codec_delay()); | 355 false, // Output audio is not encrypted. |
| 356 input_audio_config.seek_preroll(), |
| 357 input_audio_config.codec_delay()); |
| 357 break; | 358 break; |
| 358 } | 359 } |
| 359 | 360 |
| 360 case VIDEO: { | 361 case VIDEO: { |
| 361 VideoDecoderConfig input_video_config = | 362 VideoDecoderConfig input_video_config = |
| 362 demuxer_stream_->video_decoder_config(); | 363 demuxer_stream_->video_decoder_config(); |
| 363 video_config_.Initialize( | 364 video_config_.Initialize( |
| 364 input_video_config.codec(), input_video_config.profile(), | 365 input_video_config.codec(), input_video_config.profile(), |
| 365 input_video_config.format(), input_video_config.color_space(), | 366 input_video_config.format(), input_video_config.color_space(), |
| 366 input_video_config.coded_size(), input_video_config.visible_rect(), | 367 input_video_config.coded_size(), input_video_config.visible_rect(), |
| 367 input_video_config.natural_size(), input_video_config.extra_data(), | 368 input_video_config.natural_size(), input_video_config.extra_data(), |
| 368 Unencrypted()); | 369 false); // Output video is not encrypted. |
| 369 break; | 370 break; |
| 370 } | 371 } |
| 371 | 372 |
| 372 default: | 373 default: |
| 373 NOTREACHED(); | 374 NOTREACHED(); |
| 374 return; | 375 return; |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace media | 379 } // namespace media |
| OLD | NEW |