OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/media/fake_gl_video_decode_engine.h" | 5 #include "chrome/gpu/media/fake_gl_video_decode_engine.h" |
6 | 6 |
7 #include "media/base/limits.h" | 7 #include "media/base/limits.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/video/video_decode_context.h" | 9 #include "media/video/video_decode_context.h" |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 for (int x = 0; x < width_; ++x) { | 101 for (int x = 0; x < width_; ++x) { |
102 row[x * 4 + offset + 1] = seed++; | 102 row[x * 4 + offset + 1] = seed++; |
103 seed &= 255; | 103 seed &= 255; |
104 } | 104 } |
105 row += width_ * 4; | 105 row += width_ * 4; |
106 } | 106 } |
107 ++seed; | 107 ++seed; |
108 | 108 |
109 // After we have filled the content upload the internal frame to the | 109 // After we have filled the content upload the internal frame to the |
110 // VideoFrame allocated through VideoDecodeContext. | 110 // VideoFrame allocated through VideoDecodeContext. |
111 context_->UploadToVideoFrame( | 111 context_->ConvertToVideoFrame( |
112 internal_frame_, frame, | 112 internal_frame_, frame, |
113 NewRunnableMethod(this, &FakeGlVideoDecodeEngine::UploadCompleteTask, | 113 NewRunnableMethod(this, &FakeGlVideoDecodeEngine::UploadCompleteTask, |
114 frame)); | 114 frame)); |
115 } | 115 } |
116 | 116 |
117 void FakeGlVideoDecodeEngine::ProduceVideoFrame( | 117 void FakeGlVideoDecodeEngine::ProduceVideoFrame( |
118 scoped_refptr<media::VideoFrame> frame) { | 118 scoped_refptr<media::VideoFrame> frame) { |
119 // Enqueue the frame to the pending queue. | 119 // Enqueue the frame to the pending queue. |
120 pending_frames_.push(frame); | 120 pending_frames_.push(frame); |
121 | 121 |
122 // Fake that we need some buffer. | 122 // Fake that we need some buffer. |
123 handler_->ProduceVideoSample(NULL); | 123 handler_->ProduceVideoSample(NULL); |
124 } | 124 } |
125 | 125 |
126 void FakeGlVideoDecodeEngine::UploadCompleteTask( | 126 void FakeGlVideoDecodeEngine::UploadCompleteTask( |
127 scoped_refptr<media::VideoFrame> frame) { | 127 scoped_refptr<media::VideoFrame> frame) { |
128 // |frame| is the upload target. We can immediately send this frame out. | 128 // |frame| is the upload target. We can immediately send this frame out. |
129 handler_->ConsumeVideoFrame(frame); | 129 handler_->ConsumeVideoFrame(frame); |
130 } | 130 } |
131 | 131 |
132 DISABLE_RUNNABLE_METHOD_REFCOUNT(FakeGlVideoDecodeEngine); | 132 DISABLE_RUNNABLE_METHOD_REFCOUNT(FakeGlVideoDecodeEngine); |
OLD | NEW |