Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
时间: 2024-04-05 07:34:52 浏览: 387
这个警告信息通常出现在使用FFmpeg进行音视频处理的时候,是因为设置了AVFMT_NOBINSEARCH或AVFMT_NOGENSEARCH标志,导致FFmpeg无法确定音视频包的时间戳。解决这个问题的方法是手动设置音视频包的时间戳。在读取音视频包的时候,可以通过packet->dts和packet->pts字段来获取音视频包的时间戳,然后将它们设置为AVPacket结构体中的dts和pts字段的值。如果你使用的是FFmpeg库,可以在av_packet_rescale_ts函数中对时间戳进行重新缩放。
相关问题
Implement time_per_word, which takes in times_per_player, a list of lists for each player with timestamps indicating when each player finished typing each word. It also takes in a list words. It returns a game with the given information. A game is a data abstraction that has a list of words and times. The times are stored as a list of lists of how long it took each player to type each word. times[i][j] indicates how long it took player i to type word j. For example, if times_per_player = [[1, 3, 5], [2, 5, 6]], the corresponding time attribute of the game would be [[2, 2], [3, 1]]. Timestamps are cumulative and always increasing, while the values in time are differences between consecutive timestamps. Be sure to use the game constructor when returning a game, rather than assuming a particular data format.Given timing data, return a game data abstraction, which contains a list of words and the amount of time each player took to type each word. Arguments: times_per_player: A list of lists of timestamps including the time the player started typing, followed by the time the player finished typing each word. words: a list of words, in the order they are typed.
Here's a possible implementation of the `time_per_word` function:
```python
from typing import List
from dataclasses import dataclass
@dataclass
class Game:
words: List[str]
times: List[List[int]]
def time_per_word(times_per_player: List[List[int]], words: List[str]) -> Game:
n_players = len(times_per_player)
n_words = len(words)
times = [[0] * (n_words - 1) for _ in range(n_players)]
for i in range(n_players):
for j in range(1, n_words):
times[i][j - 1] = times_per_player[i][j] - times_per_player[i][j - 1]
return Game(words=words, times=times)
```
The function takes in `times_per_player`, a list of lists where each inner list represents the timestamps for a single player, and `words`, a list of strings representing the words in the order they were typed. It returns a `Game` object containing the words and the time each player took to type each word.
The implementation uses a nested loop to iterate over all pairs of players and words, and computes the time difference between consecutive timestamps for each player and word. The resulting `times` matrix has dimensions `(n_players, n_words - 1)` to account for the fact that the first timestamp only indicates when typing started, not when the first word was completed. The `Game` object is constructed using the `dataclass` decorator from Python 3.7+ to create a simple data structure with named fields.
Note that this implementation assumes that all players typed the same set of words in the same order, and that the timestamps are cumulative and increasing (i.e., the time to type each word is always positive). If these assumptions don't hold, the function may produce incorrect results or raise errors.
Referring to Figure 6-24 , the following rules define timestamp capture: • A PTM Requester must update its stored t1 timestamp when transmitting a PTM Request Message, even if that transmission is a replay. • A PTM Responder must update its stored t2 timestamp when receiving a PTM Request Message, even if received TLP is a duplicate. • A PTM Responder must update its stored t3 timestamp when transmitting a PTM Response or ResponseD Message, even if that transmission is a replay. • A PTM Requester must update its stored t4 timestamp when receiving a PTM Response Message, even if received TLP is a duplicate. ◦ Timestamps must be based on the STP Symbol or Token that frames the TLP, as if observing the first bit of that Symbol or Token at the Port’s pins. Typically this will require an implementation specific adjustment to compensate for the inability to directly measure the time at the actual pins, as the time will commonly be measured at some internal point in the Rx or Tx path. The accuracy and consistency of this measurement are not bounded by this specification, but it is strongly recommended that the highest practical level of accuracy and consistency be achieved. 翻译一下
参考图6-24,以下规则定义了时间戳捕获:• PTM请求者在发送PTM请求消息时,必须更新其存储的t1时间戳,即使该传输是重播。• PTM响应者在接收PTM请求消息时,必须更新其存储的t2时间戳,即使接收到的TLP是重复的。• PTM响应者在传输PTM响应或ResponseD消息时,必须更新其存储的t3时间戳,即使该传输是重播。• PTM请求者在接收到PTM响应消息时,必须更新其存储的t4时间戳,即使接收到的TLP是重复的。◦ 时间戳必须基于框架TLP的STP符号或令牌,就好像在端口引脚上观察该符号或令牌的第一个比特位。通常,这将需要一种特定于实现的调整,以补偿无法直接测量实际引脚时间的能力,因为时间通常会在Rx或Tx路径中的某个内部点测量。此测量的准确性和一致性不受本规范的限制,但强烈建议实现最高实用级别的准确性和一致性。
阅读全文