| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/video/video_receive_stream.h" | 11 #include "webrtc/video/video_receive_stream.h" |
| 12 | 12 |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 | 14 |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <utility> | 17 #include <utility> |
| 18 | 18 |
| 19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/optional.h" | 21 #include "webrtc/base/optional.h" |
| 22 #include "webrtc/base/trace_event.h" |
| 22 #include "webrtc/common_video/h264/profile_level_id.h" | 23 #include "webrtc/common_video/h264/profile_level_id.h" |
| 23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 24 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 26 #include "webrtc/modules/utility/include/process_thread.h" | 27 #include "webrtc/modules/utility/include/process_thread.h" |
| 27 #include "webrtc/modules/video_coding/frame_object.h" | 28 #include "webrtc/modules/video_coding/frame_object.h" |
| 28 #include "webrtc/modules/video_coding/include/video_coding.h" | 29 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 29 #include "webrtc/modules/video_coding/jitter_estimator.h" | 30 #include "webrtc/modules/video_coding/jitter_estimator.h" |
| 30 #include "webrtc/modules/video_coding/timing.h" | 31 #include "webrtc/modules/video_coding/timing.h" |
| 31 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { | 466 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { |
| 466 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); | 467 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); |
| 467 video_receiver_.SetMinimumPlayoutDelay(delay_ms); | 468 video_receiver_.SetMinimumPlayoutDelay(delay_ms); |
| 468 } | 469 } |
| 469 | 470 |
| 470 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { | 471 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { |
| 471 return static_cast<VideoReceiveStream*>(ptr)->Decode(); | 472 return static_cast<VideoReceiveStream*>(ptr)->Decode(); |
| 472 } | 473 } |
| 473 | 474 |
| 474 bool VideoReceiveStream::Decode() { | 475 bool VideoReceiveStream::Decode() { |
| 476 TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode"); |
| 475 static const int kMaxWaitForFrameMs = 3000; | 477 static const int kMaxWaitForFrameMs = 3000; |
| 476 std::unique_ptr<video_coding::FrameObject> frame; | 478 std::unique_ptr<video_coding::FrameObject> frame; |
| 477 video_coding::FrameBuffer::ReturnReason res = | 479 video_coding::FrameBuffer::ReturnReason res = |
| 478 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame); | 480 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame); |
| 479 | 481 |
| 480 if (res == video_coding::FrameBuffer::ReturnReason::kStopped) | 482 if (res == video_coding::FrameBuffer::ReturnReason::kStopped) |
| 481 return false; | 483 return false; |
| 482 | 484 |
| 483 if (frame) { | 485 if (frame) { |
| 484 if (video_receiver_.Decode(frame.get()) == VCM_OK) | 486 if (video_receiver_.Decode(frame.get()) == VCM_OK) |
| 485 rtp_stream_receiver_.FrameDecoded(frame->picture_id); | 487 rtp_stream_receiver_.FrameDecoded(frame->picture_id); |
| 486 } else { | 488 } else { |
| 487 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs | 489 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs |
| 488 << " ms, requesting keyframe."; | 490 << " ms, requesting keyframe."; |
| 489 RequestKeyFrame(); | 491 RequestKeyFrame(); |
| 490 } | 492 } |
| 491 return true; | 493 return true; |
| 492 } | 494 } |
| 493 } // namespace internal | 495 } // namespace internal |
| 494 } // namespace webrtc | 496 } // namespace webrtc |
| OLD | NEW |