Unified · Split
| @@ -742,13 +742,14 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, · 741 unmodified lines | ||
| 742 | 742 | if (!(st->disposition & AV_DISPOSITION_DEFAULT)) |
| 743 | 743 | put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT)); |
| 744 | 744 | |
| 745 | − if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->delay) { | |
| 746 | − mkv->tracks[i].ts_offset = av_rescale_q(codec->delay, | |
| 745 | + if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->initial_padding) { | |
| 746 | + mkv->tracks[i].ts_offset = av_rescale_q(codec->initial_padding, | |
| 747 | 747 | (AVRational){ 1, codec->sample_rate }, |
| 748 | 748 | st->time_base); |
| 749 | 749 | |
| 750 | 750 | put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, |
| 751 | − av_rescale_q(codec->delay, (AVRational){ 1, codec->sample_rate }, | |
| 751 | + av_rescale_q(codec->initial_padding, | |
| 752 | + (AVRational){ 1, codec->sample_rate }, | |
| 752 | 753 | (AVRational){ 1, 1000000000 })); |
| 753 | 754 | } |
| 754 | 755 | |
| @@ -564,7 +564,10 @@ static int ogg_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 563 unmodified lines | ||
| 564 | 564 | } |
| 565 | 565 | granule = (oggstream->last_kf_pts<<oggstream->kfgshift) | pframe_count; |
| 566 | 566 | } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) |
| 567 | − granule = pkt->pts + pkt->duration + av_rescale_q(st->codec->delay, (AVRational){ 1, st->codec->sample_rate }, st->time_base); | |
| 567 | + granule = pkt->pts + pkt->duration + | |
| 568 | + av_rescale_q(st->codec->initial_padding, | |
| 569 | + (AVRational){ 1, st->codec->sample_rate }, | |
| 570 | + st->time_base); | |
| 568 | 571 | else |
| 569 | 572 | granule = pkt->pts + pkt->duration; |
| 570 | 573 | |