Fix error checking

Wrong error variable was checked and redundant parentheses in
play-from-disk example.
This commit is contained in:
q191201771
2020-09-10 18:56:30 +08:00
committed by Tarrence van As
parent 0466659207
commit c2ed6ee835
2 changed files with 4 additions and 3 deletions

View File

@@ -199,6 +199,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Kuzmin Vladimir](https://github.com/tekig) * [Kuzmin Vladimir](https://github.com/tekig)
* [Alessandro Ros](https://github.com/aler9) * [Alessandro Ros](https://github.com/aler9)
* [Thomas Miller](https://github.com/tmiv) * [Thomas Miller](https://github.com/tmiv)
* [yoko(q191201771)](https://github.com/q191201771)
### License ### License
MIT License - see [LICENSE](LICENSE) for full text MIT License - see [LICENSE](LICENSE) for full text

View File

@@ -63,7 +63,7 @@ func main() {
if addTrackErr != nil { if addTrackErr != nil {
panic(addTrackErr) panic(addTrackErr)
} }
if _, addTrackErr = peerConnection.AddTrack(videoTrack); err != nil { if _, addTrackErr = peerConnection.AddTrack(videoTrack); addTrackErr != nil {
panic(addTrackErr) panic(addTrackErr)
} }
@@ -110,7 +110,7 @@ func main() {
if addTrackErr != nil { if addTrackErr != nil {
panic(addTrackErr) panic(addTrackErr)
} }
if _, addTrackErr = peerConnection.AddTrack(audioTrack); err != nil { if _, addTrackErr = peerConnection.AddTrack(audioTrack); addTrackErr != nil {
panic(addTrackErr) panic(addTrackErr)
} }
@@ -144,7 +144,7 @@ func main() {
} }
// The amount of samples is the difference between the last and current timestamp // The amount of samples is the difference between the last and current timestamp
sampleCount := float64((pageHeader.GranulePosition - lastGranule)) sampleCount := float64(pageHeader.GranulePosition - lastGranule)
lastGranule = pageHeader.GranulePosition lastGranule = pageHeader.GranulePosition
if oggErr = audioTrack.WriteSample(media.Sample{Data: pageData, Samples: uint32(sampleCount)}); oggErr != nil { if oggErr = audioTrack.WriteSample(media.Sample{Data: pageData, Samples: uint32(sampleCount)}); oggErr != nil {