OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" | 39 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" |
40 #include "talk/media/webrtc/webrtcvideoframe.h" | 40 #include "talk/media/webrtc/webrtcvideoframe.h" |
41 #include "talk/media/webrtc/webrtcvoiceengine.h" | 41 #include "talk/media/webrtc/webrtcvoiceengine.h" |
42 #include "webrtc/base/buffer.h" | 42 #include "webrtc/base/buffer.h" |
43 #include "webrtc/base/logging.h" | 43 #include "webrtc/base/logging.h" |
44 #include "webrtc/base/stringutils.h" | 44 #include "webrtc/base/stringutils.h" |
45 #include "webrtc/call.h" | 45 #include "webrtc/call.h" |
46 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 46 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
47 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | 47 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
48 #include "webrtc/system_wrappers/interface/field_trial.h" | 48 #include "webrtc/system_wrappers/interface/field_trial.h" |
| 49 #include "webrtc/system_wrappers/interface/tick_util.h" |
49 #include "webrtc/system_wrappers/interface/trace_event.h" | 50 #include "webrtc/system_wrappers/interface/trace_event.h" |
50 #include "webrtc/video_decoder.h" | 51 #include "webrtc/video_decoder.h" |
51 #include "webrtc/video_encoder.h" | 52 #include "webrtc/video_encoder.h" |
52 | 53 |
53 #define UNIMPLEMENTED \ | 54 #define UNIMPLEMENTED \ |
54 LOG(LS_ERROR) << "Call to unimplemented function " << __FUNCTION__; \ | 55 LOG(LS_ERROR) << "Call to unimplemented function " << __FUNCTION__; \ |
55 RTC_NOTREACHED() | 56 RTC_NOTREACHED() |
56 | 57 |
57 namespace cricket { | 58 namespace cricket { |
58 namespace { | 59 namespace { |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 DCHECK(format_.height == 0); | 1721 DCHECK(format_.height == 0); |
1721 LOG(LS_VERBOSE) << "VideoFormat 0x0 set, Dropping frame."; | 1722 LOG(LS_VERBOSE) << "VideoFormat 0x0 set, Dropping frame."; |
1722 return; | 1723 return; |
1723 } | 1724 } |
1724 if (muted_) { | 1725 if (muted_) { |
1725 // Create a black frame to transmit instead. | 1726 // Create a black frame to transmit instead. |
1726 CreateBlackFrame(&video_frame, | 1727 CreateBlackFrame(&video_frame, |
1727 static_cast<int>(frame->GetWidth()), | 1728 static_cast<int>(frame->GetWidth()), |
1728 static_cast<int>(frame->GetHeight())); | 1729 static_cast<int>(frame->GetHeight())); |
1729 } | 1730 } |
| 1731 |
| 1732 // frame->GetTimeStamp() is essentially a delta, align to webrtc time |
| 1733 if (base_timestamp_ms_ == 0) { |
| 1734 base_timestamp_ms_ = webrtc::TickTime::MillisecondTimestamp() - |
| 1735 frame->GetTimeStamp() / 1000000; |
| 1736 } |
| 1737 |
| 1738 video_frame.set_render_time_ms(base_timestamp_ms_ + |
| 1739 frame->GetTimeStamp() / 1000000); |
1730 // Reconfigure codec if necessary. | 1740 // Reconfigure codec if necessary. |
1731 SetDimensions( | 1741 SetDimensions( |
1732 video_frame.width(), video_frame.height(), capturer->IsScreencast()); | 1742 video_frame.width(), video_frame.height(), capturer->IsScreencast()); |
1733 | 1743 |
1734 LOG(LS_VERBOSE) << "IncomingCapturedFrame: " << video_frame.width() << "x" | 1744 LOG(LS_VERBOSE) << "IncomingCapturedFrame: " << video_frame.width() << "x" |
1735 << video_frame.height() << " -> (codec) " | 1745 << video_frame.height() << " -> (codec) " |
1736 << parameters_.encoder_config.streams.back().width << "x" | 1746 << parameters_.encoder_config.streams.back().width << "x" |
1737 << parameters_.encoder_config.streams.back().height; | 1747 << parameters_.encoder_config.streams.back().height; |
1738 stream_->Input()->IncomingCapturedFrame(video_frame); | 1748 stream_->Input()->IncomingCapturedFrame(video_frame); |
1739 } | 1749 } |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2605 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2596 } | 2606 } |
2597 } | 2607 } |
2598 | 2608 |
2599 return video_codecs; | 2609 return video_codecs; |
2600 } | 2610 } |
2601 | 2611 |
2602 } // namespace cricket | 2612 } // namespace cricket |
2603 | 2613 |
2604 #endif // HAVE_WEBRTC_VIDEO | 2614 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |