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

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 1438063002: media: Support SetCdm() on VideoDecodeAccelerator interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 (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 "content/common/gpu/media/gpu_video_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 bool handled = true; 158 bool handled = true;
159 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) 159 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg)
160 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) 160 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode)
161 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_AssignPictureBuffers, 161 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
162 OnAssignPictureBuffers) 162 OnAssignPictureBuffers)
163 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_ReusePictureBuffer, 163 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
164 OnReusePictureBuffer) 164 OnReusePictureBuffer)
165 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Flush, OnFlush) 165 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Flush, OnFlush)
166 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Reset, OnReset) 166 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Reset, OnReset)
167 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_SetCdm, OnSetCdm)
167 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Destroy, OnDestroy) 168 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Destroy, OnDestroy)
168 IPC_MESSAGE_UNHANDLED(handled = false) 169 IPC_MESSAGE_UNHANDLED(handled = false)
169 IPC_END_MESSAGE_MAP() 170 IPC_END_MESSAGE_MAP()
170 return handled; 171 return handled;
171 } 172 }
172 173
173 void GpuVideoDecodeAccelerator::ProvidePictureBuffers( 174 void GpuVideoDecodeAccelerator::ProvidePictureBuffers(
174 uint32 requested_num_of_buffers, 175 uint32 requested_num_of_buffers,
175 const gfx::Size& dimensions, 176 const gfx::Size& dimensions,
176 uint32 texture_target) { 177 uint32 texture_target) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 void GpuVideoDecodeAccelerator::OnFlush() { 543 void GpuVideoDecodeAccelerator::OnFlush() {
543 DCHECK(video_decode_accelerator_.get()); 544 DCHECK(video_decode_accelerator_.get());
544 video_decode_accelerator_->Flush(); 545 video_decode_accelerator_->Flush();
545 } 546 }
546 547
547 void GpuVideoDecodeAccelerator::OnReset() { 548 void GpuVideoDecodeAccelerator::OnReset() {
548 DCHECK(video_decode_accelerator_.get()); 549 DCHECK(video_decode_accelerator_.get());
549 video_decode_accelerator_->Reset(); 550 video_decode_accelerator_->Reset();
550 } 551 }
551 552
553 void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) {
554 DCHECK(video_decode_accelerator_.get());
dcheng 2015/11/12 18:48:43 Nit: no .get() when testing a smart pointer
xhwang 2015/11/13 01:16:55 Done.
555 video_decode_accelerator_->SetCdm(cdm_id);
556 }
557
552 void GpuVideoDecodeAccelerator::OnDestroy() { 558 void GpuVideoDecodeAccelerator::OnDestroy() {
553 DCHECK(video_decode_accelerator_.get()); 559 DCHECK(video_decode_accelerator_.get());
554 OnWillDestroyStub(); 560 OnWillDestroyStub();
555 } 561 }
556 562
557 void GpuVideoDecodeAccelerator::OnFilterRemoved() { 563 void GpuVideoDecodeAccelerator::OnFilterRemoved() {
558 // We're destroying; cancel all callbacks. 564 // We're destroying; cancel all callbacks.
559 weak_factory_for_io_.InvalidateWeakPtrs(); 565 weak_factory_for_io_.InvalidateWeakPtrs();
560 filter_removed_.Signal(); 566 filter_removed_.Signal();
561 } 567 }
(...skipping 11 matching lines...) Expand all
573 void GpuVideoDecodeAccelerator::NotifyFlushDone() { 579 void GpuVideoDecodeAccelerator::NotifyFlushDone() {
574 if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(host_route_id_))) 580 if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(host_route_id_)))
575 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; 581 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed";
576 } 582 }
577 583
578 void GpuVideoDecodeAccelerator::NotifyResetDone() { 584 void GpuVideoDecodeAccelerator::NotifyResetDone() {
579 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 585 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
580 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 586 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
581 } 587 }
582 588
589 void GpuVideoDecodeAccelerator::NotifyCdmSet(bool success) {
590 if (!Send(new AcceleratedVideoDecoderHostMsg_CdmSet(host_route_id_, success)))
591 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_CdmSet) failed";
592 }
593
583 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { 594 void GpuVideoDecodeAccelerator::OnWillDestroyStub() {
584 // The stub is going away, so we have to stop and destroy VDA here, before 595 // The stub is going away, so we have to stop and destroy VDA here, before
585 // returning, because the VDA may need the GL context to run and/or do its 596 // returning, because the VDA may need the GL context to run and/or do its
586 // cleanup. We cannot destroy the VDA before the IO thread message filter is 597 // cleanup. We cannot destroy the VDA before the IO thread message filter is
587 // removed however, since we cannot service incoming messages with VDA gone. 598 // removed however, since we cannot service incoming messages with VDA gone.
588 // We cannot simply check for existence of VDA on IO thread though, because 599 // We cannot simply check for existence of VDA on IO thread though, because
589 // we don't want to synchronize the IO thread with the ChildThread. 600 // we don't want to synchronize the IO thread with the ChildThread.
590 // So we have to wait for the RemoveFilter callback here instead and remove 601 // So we have to wait for the RemoveFilter callback here instead and remove
591 // the VDA after it arrives and before returning. 602 // the VDA after it arrives and before returning.
592 if (filter_.get()) { 603 if (filter_.get()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return stub_->channel()->Send(message); 637 return stub_->channel()->Send(message);
627 } 638 }
628 639
629 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, 640 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message,
630 bool succeeded) { 641 bool succeeded) {
631 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); 642 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded);
632 Send(message); 643 Send(message);
633 } 644 }
634 645
635 } // namespace content 646 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698