Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cdm/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 | 654 |
| 655 void CdmAdapter::DecryptAndDecodeVideo( | 655 void CdmAdapter::DecryptAndDecodeVideo( |
| 656 const scoped_refptr<DecoderBuffer>& encrypted, | 656 const scoped_refptr<DecoderBuffer>& encrypted, |
| 657 const VideoDecodeCB& video_decode_cb) { | 657 const VideoDecodeCB& video_decode_cb) { |
| 658 DCHECK(task_runner_->BelongsToCurrentThread()); | 658 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 659 | 659 |
| 660 cdm::InputBuffer input_buffer; | 660 cdm::InputBuffer input_buffer; |
| 661 std::vector<cdm::SubsampleEntry> subsamples; | 661 std::vector<cdm::SubsampleEntry> subsamples; |
| 662 scoped_ptr<VideoFrameImpl> video_frame(new VideoFrameImpl()); | 662 scoped_ptr<VideoFrameImpl> video_frame(new VideoFrameImpl()); |
| 663 | 663 |
| 664 DVLOG(3) << __FUNCTION__ | |
| 665 << " encrypted: " << encrypted->AsHumanReadableString(); | |
|
xhwang
2015/12/18 23:07:43
I like AsHumanReadableString(). But I don't feel w
jrummell
2015/12/22 01:30:43
Changed to DVLOG(5), so you only see it if you ena
| |
| 664 ToCdmInputBuffer(encrypted, &subsamples, &input_buffer); | 666 ToCdmInputBuffer(encrypted, &subsamples, &input_buffer); |
| 665 cdm::Status status = | 667 cdm::Status status = |
| 666 cdm_->DecryptAndDecodeFrame(input_buffer, video_frame.get()); | 668 cdm_->DecryptAndDecodeFrame(input_buffer, video_frame.get()); |
| 667 | 669 |
| 668 if (status != cdm::kSuccess) { | 670 if (status != cdm::kSuccess) { |
| 669 DVLOG(1) << __FUNCTION__ << " failed with cdm::Error " << status; | 671 DVLOG(1) << __FUNCTION__ << " failed with cdm::Error " << status; |
| 670 video_decode_cb.Run(ToMediaDecryptorStatus(status), nullptr); | 672 video_decode_cb.Run(ToMediaDecryptorStatus(status), nullptr); |
| 671 return; | 673 return; |
| 672 } | 674 } |
| 673 | 675 |
| 674 uint8_t* frame_data = video_frame->FrameBuffer()->Data(); | 676 uint8_t* frame_data = video_frame->FrameBuffer()->Data(); |
| 675 gfx::Size frame_size(video_frame->Size().width, video_frame->Size().height); | 677 gfx::Size frame_size(video_frame->Size().width, video_frame->Size().height); |
| 676 scoped_refptr<VideoFrame> decoded_frame = VideoFrame::WrapExternalYuvData( | 678 scoped_refptr<VideoFrame> decoded_frame = VideoFrame::WrapExternalYuvData( |
| 677 PIXEL_FORMAT_YV12, frame_size, gfx::Rect(frame_size), natural_size_, | 679 PIXEL_FORMAT_YV12, frame_size, gfx::Rect(frame_size), natural_size_, |
| 678 video_frame->Stride(VideoFrameImpl::kYPlane), | 680 video_frame->Stride(VideoFrameImpl::kYPlane), |
| 679 video_frame->Stride(VideoFrameImpl::kUPlane), | 681 video_frame->Stride(VideoFrameImpl::kUPlane), |
| 680 video_frame->Stride(VideoFrameImpl::kVPlane), | 682 video_frame->Stride(VideoFrameImpl::kVPlane), |
| 681 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kYPlane), | 683 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kYPlane), |
| 682 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kUPlane), | 684 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kUPlane), |
| 683 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kVPlane), | 685 frame_data + video_frame->PlaneOffset(VideoFrameImpl::kVPlane), |
| 684 base::TimeDelta::FromMicroseconds(video_frame->Timestamp())); | 686 base::TimeDelta::FromMicroseconds(video_frame->Timestamp())); |
| 687 DVLOG(3) << __FUNCTION__ | |
| 688 << " decoded_frame: " << decoded_frame->AsHumanReadableString(); | |
|
xhwang
2015/12/18 23:07:44
ditto
| |
| 685 video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); | 689 video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); |
| 686 } | 690 } |
| 687 | 691 |
| 688 void CdmAdapter::ResetDecoder(StreamType stream_type) { | 692 void CdmAdapter::ResetDecoder(StreamType stream_type) { |
| 689 DCHECK(task_runner_->BelongsToCurrentThread()); | 693 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 690 cdm_->ResetDecoder(ToCdmStreamType(stream_type)); | 694 cdm_->ResetDecoder(ToCdmStreamType(stream_type)); |
| 691 } | 695 } |
| 692 | 696 |
| 693 void CdmAdapter::DeinitializeDecoder(StreamType stream_type) { | 697 void CdmAdapter::DeinitializeDecoder(StreamType stream_type) { |
| 694 DCHECK(task_runner_->BelongsToCurrentThread()); | 698 DCHECK(task_runner_->BelongsToCurrentThread()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 result_frames->push_back(frame); | 951 result_frames->push_back(frame); |
| 948 | 952 |
| 949 data += frame_size; | 953 data += frame_size; |
| 950 bytes_left -= frame_size; | 954 bytes_left -= frame_size; |
| 951 } while (bytes_left > 0); | 955 } while (bytes_left > 0); |
| 952 | 956 |
| 953 return true; | 957 return true; |
| 954 } | 958 } |
| 955 | 959 |
| 956 } // namespace media | 960 } // namespace media |
| OLD | NEW |