| OLD | NEW | 
|    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/rtc_video_decoder.h" |    5 #include "content/renderer/media/rtc_video_decoder.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/logging.h" |    8 #include "base/logging.h" | 
|    9 #include "base/memory/ref_counted.h" |    9 #include "base/memory/ref_counted.h" | 
|   10 #include "base/message_loop/message_loop_proxy.h" |   10 #include "base/message_loop/message_loop_proxy.h" | 
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  287   if (state_ != RESETTING) { |  287   if (state_ != RESETTING) { | 
|  288     state_ = RESETTING; |  288     state_ = RESETTING; | 
|  289     factories_->GetTaskRunner()->PostTask( |  289     factories_->GetTaskRunner()->PostTask( | 
|  290         FROM_HERE, |  290         FROM_HERE, | 
|  291         base::Bind(&RTCVideoDecoder::ResetInternal, |  291         base::Bind(&RTCVideoDecoder::ResetInternal, | 
|  292                    weak_factory_.GetWeakPtr())); |  292                    weak_factory_.GetWeakPtr())); | 
|  293   } |  293   } | 
|  294   return WEBRTC_VIDEO_CODEC_OK; |  294   return WEBRTC_VIDEO_CODEC_OK; | 
|  295 } |  295 } | 
|  296  |  296  | 
|  297 void RTCVideoDecoder::NotifyInitializeDone() { |  | 
|  298   DVLOG(2) << "NotifyInitializeDone"; |  | 
|  299   NOTREACHED(); |  | 
|  300 } |  | 
|  301  |  | 
|  302 void RTCVideoDecoder::ProvidePictureBuffers(uint32 count, |  297 void RTCVideoDecoder::ProvidePictureBuffers(uint32 count, | 
|  303                                             const gfx::Size& size, |  298                                             const gfx::Size& size, | 
|  304                                             uint32 texture_target) { |  299                                             uint32 texture_target) { | 
|  305   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |  300   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 
|  306   DVLOG(3) << "ProvidePictureBuffers. texture_target=" << texture_target; |  301   DVLOG(3) << "ProvidePictureBuffers. texture_target=" << texture_target; | 
|  307  |  302  | 
|  308   if (!vda_) |  303   if (!vda_) | 
|  309     return; |  304     return; | 
|  310  |  305  | 
|  311   std::vector<uint32> texture_ids; |  306   std::vector<uint32> texture_ids; | 
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  675   } |  670   } | 
|  676  |  671  | 
|  677   // DestroyVDA() might already have been called. |  672   // DestroyVDA() might already have been called. | 
|  678   if (vda_) |  673   if (vda_) | 
|  679     vda_->ReusePictureBuffer(picture_buffer_id); |  674     vda_->ReusePictureBuffer(picture_buffer_id); | 
|  680 } |  675 } | 
|  681  |  676  | 
|  682 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, |  677 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, | 
|  683                                 base::WaitableEvent* waiter) { |  678                                 base::WaitableEvent* waiter) { | 
|  684   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |  679   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 
|  685   vda_ = factories_->CreateVideoDecodeAccelerator(profile); |  680   vda_ = factories_->CreateVideoDecodeAccelerator(); | 
|  686   if (vda_ && !vda_->Initialize(profile, this)) |  681   if (vda_ && !vda_->Initialize(profile, this)) | 
|  687     vda_.release()->Destroy(); |  682     vda_.release()->Destroy(); | 
|  688   waiter->Signal(); |  683   waiter->Signal(); | 
|  689 } |  684 } | 
|  690  |  685  | 
|  691 void RTCVideoDecoder::DestroyTextures() { |  686 void RTCVideoDecoder::DestroyTextures() { | 
|  692   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |  687   DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 
|  693  |  688  | 
|  694   // Not destroying PictureBuffers in |picture_buffers_at_display_| yet, since |  689   // Not destroying PictureBuffers in |picture_buffers_at_display_| yet, since | 
|  695   // their textures may still be in use by the user of this RTCVideoDecoder. |  690   // their textures may still be in use by the user of this RTCVideoDecoder. | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  806   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); |  801   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); | 
|  807   return status; |  802   return status; | 
|  808 } |  803 } | 
|  809  |  804  | 
|  810 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |  805 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 
|  811     const { |  806     const { | 
|  812   DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |  807   DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 
|  813 } |  808 } | 
|  814  |  809  | 
|  815 }  // namespace content |  810 }  // namespace content | 
| OLD | NEW |