| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/gpu/gpu_video_decoder.h" | 5 #include "chrome/gpu/gpu_video_decoder.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/gpu_messages.h" | |
| 9 #include "chrome/gpu/gpu_channel.h" | 8 #include "chrome/gpu/gpu_channel.h" |
| 10 #include "chrome/gpu/media/fake_gl_video_decode_engine.h" | 9 #include "chrome/gpu/media/fake_gl_video_decode_engine.h" |
| 11 #include "chrome/gpu/media/fake_gl_video_device.h" | 10 #include "chrome/gpu/media/fake_gl_video_device.h" |
| 12 #include "content/common/child_thread.h" | 11 #include "content/common/child_thread.h" |
| 12 #include "content/common/gpu_messages.h" |
| 13 #include "media/base/data_buffer.h" | 13 #include "media/base/data_buffer.h" |
| 14 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
| 15 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "chrome/gpu/media/mft_angle_video_device.h" | 18 #include "chrome/gpu/media/mft_angle_video_device.h" |
| 19 #include "media/video/mft_h264_decode_engine.h" | 19 #include "media/video/mft_h264_decode_engine.h" |
| 20 #include <d3d9.h> | 20 #include <d3d9.h> |
| 21 #endif | 21 #endif |
| 22 | 22 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 void GpuVideoDecoder::ProduceVideoSample(scoped_refptr<Buffer> buffer) { | 121 void GpuVideoDecoder::ProduceVideoSample(scoped_refptr<Buffer> buffer) { |
| 122 SendEmptyBufferDone(); | 122 SendEmptyBufferDone(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, | 125 void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, |
| 126 const PipelineStatistics& statistics) { | 126 const PipelineStatistics& statistics) { |
| 127 // TODO(sjl): Do something with the statistics... | 127 // TODO(sjl): Do something with the statistics... |
| 128 | 128 |
| 129 if (frame->IsEndOfStream()) { | 129 if (frame->IsEndOfStream()) { |
| 130 SendConsumeVideoFrame(kGpuVideoInvalidFrameId, 0, 0, kGpuVideoEndOfStream); | 130 SendConsumeVideoFrame(0, 0, 0, kGpuVideoEndOfStream); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 int32 frame_id = kGpuVideoInvalidFrameId; | 134 int32 frame_id = -1; |
| 135 for (VideoFrameMap::iterator i = video_frame_map_.begin(); | 135 for (VideoFrameMap::iterator i = video_frame_map_.begin(); |
| 136 i != video_frame_map_.end(); ++i) { | 136 i != video_frame_map_.end(); ++i) { |
| 137 if (i->second == frame) { | 137 if (i->second == frame) { |
| 138 frame_id = i->first; | 138 frame_id = i->first; |
| 139 break; | 139 break; |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 DCHECK_NE(-1, frame_id) << "VideoFrame not recognized"; | 142 |
| 143 if (frame_id == -1) { |
| 144 NOTREACHED() << "VideoFrame not recognized"; |
| 145 return; |
| 146 } |
| 143 | 147 |
| 144 SendConsumeVideoFrame(frame_id, frame->GetTimestamp().InMicroseconds(), | 148 SendConsumeVideoFrame(frame_id, frame->GetTimestamp().InMicroseconds(), |
| 145 frame->GetDuration().InMicroseconds(), 0); | 149 frame->GetDuration().InMicroseconds(), 0); |
| 146 } | 150 } |
| 147 | 151 |
| 148 void* GpuVideoDecoder::GetDevice() { | 152 void* GpuVideoDecoder::GetDevice() { |
| 149 bool ret = gles2_decoder_->MakeCurrent(); | 153 bool ret = gles2_decoder_->MakeCurrent(); |
| 150 DCHECK(ret) << "Failed to switch context"; | 154 DCHECK(ret) << "Failed to switch context"; |
| 151 | 155 |
| 152 // Simply delegate the method call to GpuVideoDevice. | 156 // Simply delegate the method call to GpuVideoDevice. |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 418 } |
| 415 } | 419 } |
| 416 | 420 |
| 417 void GpuVideoDecoder::SendReleaseAllVideoFrames() { | 421 void GpuVideoDecoder::SendReleaseAllVideoFrames() { |
| 418 if (!sender_->Send( | 422 if (!sender_->Send( |
| 419 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( | 423 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( |
| 420 decoder_host_id()))) { | 424 decoder_host_id()))) { |
| 421 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; | 425 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; |
| 422 } | 426 } |
| 423 } | 427 } |
| OLD | NEW |