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/gpu/rtc_video_decoder.h" | 5 #include "content/renderer/media/gpu/rtc_video_decoder.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 return; | 423 return; |
424 } | 424 } |
425 bool inserted = picture_buffers_at_display_ | 425 bool inserted = picture_buffers_at_display_ |
426 .insert(std::make_pair(picture.picture_buffer_id(), | 426 .insert(std::make_pair(picture.picture_buffer_id(), |
427 pb.client_texture_ids()[0])) | 427 pb.client_texture_ids()[0])) |
428 .second; | 428 .second; |
429 DCHECK(inserted); | 429 DCHECK(inserted); |
430 | 430 |
431 // Create a WebRTC video frame. | 431 // Create a WebRTC video frame. |
432 webrtc::VideoFrame decoded_image( | 432 webrtc::VideoFrame decoded_image( |
433 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(frame), timestamp, 0, | 433 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>( |
434 webrtc::kVideoRotation_0); | 434 frame, WebRtcVideoFrameAdapter::CopyTextureFrameCallback()), |
| 435 timestamp, 0, webrtc::kVideoRotation_0); |
435 | 436 |
436 // Invoke decode callback. WebRTC expects no callback after Release. | 437 // Invoke decode callback. WebRTC expects no callback after Release. |
437 { | 438 { |
438 base::AutoLock auto_lock(lock_); | 439 base::AutoLock auto_lock(lock_); |
439 DCHECK(decode_complete_callback_); | 440 DCHECK(decode_complete_callback_); |
440 if (IsBufferAfterReset(picture.bitstream_buffer_id(), | 441 if (IsBufferAfterReset(picture.bitstream_buffer_id(), |
441 reset_bitstream_buffer_id_)) { | 442 reset_bitstream_buffer_id_)) { |
442 decode_complete_callback_->Decoded(decoded_image); | 443 decode_complete_callback_->Decoded(decoded_image); |
443 } | 444 } |
444 // Reset error counter as we successfully decoded a frame. | 445 // Reset error counter as we successfully decoded a frame. |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 } | 887 } |
887 | 888 |
888 void RTCVideoDecoder::ClearPendingBuffers() { | 889 void RTCVideoDecoder::ClearPendingBuffers() { |
889 // Delete WebRTC input buffers. | 890 // Delete WebRTC input buffers. |
890 for (const auto& pending_buffer : pending_buffers_) | 891 for (const auto& pending_buffer : pending_buffers_) |
891 delete[] pending_buffer.first._buffer; | 892 delete[] pending_buffer.first._buffer; |
892 pending_buffers_.clear(); | 893 pending_buffers_.clear(); |
893 } | 894 } |
894 | 895 |
895 } // namespace content | 896 } // namespace content |
OLD | NEW |